/* =====================================================================
   Cash4Metal — Customer Submission Form (preview)
   Mirrors the visual language of the main site (gold-calculator/css/styles.css)
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600;700&family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    --bg-primary: #0a0a0b;
    --bg-secondary: #111113;
    --bg-card: #18181b;
    --bg-elevated: #1f1f23;

    --gold-deep: #8b6914;
    --gold-primary: #c9a227;
    --gold-bright: #e4c655;
    --gold-light: #f5e6a3;
    --gold-shimmer: linear-gradient(135deg, #c9a227 0%, #f5e6a3 25%, #c9a227 50%, #f5e6a3 75%, #c9a227 100%);

    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --text-gold: #e4c655;

    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-soft: rgba(255, 255, 255, 0.10);
    --border-gold: rgba(201, 162, 39, 0.4);
    --border-gold-bright: rgba(228, 198, 85, 0.6);

    --success: #22c55e;
    --error: #ef4444;
    --warning: #f59e0b;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.6);
    --shadow-gold: 0 0 40px rgba(201, 162, 39, 0.15);
    --glow-gold: 0 0 20px rgba(228, 198, 85, 0.3);

    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 24px;

    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration-fast: 150ms;
    --duration-normal: 300ms;
    --duration-slow: 500ms;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; scroll-behavior: smooth; }

body {
    font-family: 'DM Sans', system-ui, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    background-image:
        url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-blend-mode: overlay;
    background-size: 200px;
}

[hidden] { display: none !important; }

.visually-hidden {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- Layout ---------- */
.container {
    max-width: 880px;
    margin: 0 auto;
    padding: var(--space-6);
    position: relative;
}

.container::before {
    content: ''; position: fixed; top: -50%; right: -20%;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(201, 162, 39, 0.03) 0%, transparent 70%);
    pointer-events: none; z-index: -1;
}

.container::after {
    content: ''; position: fixed; bottom: -30%; left: -10%;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(201, 162, 39, 0.02) 0%, transparent 70%);
    pointer-events: none; z-index: -1;
}

/* ---------- Header ---------- */
.header {
    text-align: center;
    padding: var(--space-12) 0 var(--space-8);
    position: relative;
    animation: fadeInDown 0.8s var(--ease-out) both;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.logo-area { position: relative; display: inline-block; }

.logo-area::before {
    content: ''; position: absolute; top: -20px; left: 50%; transform: translateX(-50%);
    width: 60px; height: 2px;
    background: var(--gold-shimmer);
    background-size: 200% 100%;
    animation: shimmer 3s linear infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.site-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(1.75rem, 5vw, 2.5rem);
    font-weight: 600;
    letter-spacing: -0.02em;
    background: var(--gold-shimmer);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 4s linear infinite;
}

.header-tagline {
    margin-top: var(--space-3);
    font-size: 0.9375rem;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

/* ---------- Section + headings ---------- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.form-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    margin-bottom: var(--space-6);
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.7s var(--ease-out) both;
}

.form-section::before {
    content: ''; position: absolute; top: 0; right: 0;
    width: 150px; height: 150px;
    background: radial-gradient(circle at 100% 0%, rgba(201, 162, 39, 0.04) 0%, transparent 70%);
    pointer-events: none;
}

.section-heading {
    font-family: 'DM Sans', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: var(--space-2);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.heading-icon { font-size: 1rem; color: var(--gold-primary); opacity: 0.85; }

.section-subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-5);
    border-bottom: 1px solid var(--border-subtle);
}

/* ---------- Form fields ---------- */
.field-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-5);
}

.field-grid .field-full { grid-column: 1 / -1; }

.field {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.field-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.field-label .req { color: var(--gold-bright); margin-left: 2px; }

.field-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: -2px;
}

.field-error {
    font-size: 0.75rem;
    color: var(--error);
    min-height: 1em;
}

.text-input,
.textarea-input,
.select-input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 400;
    outline: none;
    transition: border-color var(--duration-fast) var(--ease-out),
                background-color var(--duration-fast) var(--ease-out);
}

.text-input.numeric,
.bank-input,
.weight-cell input,
.carat-cell select {
    font-family: 'JetBrains Mono', monospace;
}

.text-input::placeholder,
.textarea-input::placeholder { color: var(--text-muted); opacity: 0.55; }

.text-input:hover,
.textarea-input:hover,
.select-input:hover {
    background: var(--bg-elevated);
}

.text-input:focus,
.textarea-input:focus,
.select-input:focus {
    border-color: var(--gold-primary);
    background: var(--bg-elevated);
}

.textarea-input {
    min-height: 96px;
    resize: vertical;
}

.input-with-prefix {
    display: flex;
    align-items: stretch;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: border-color var(--duration-fast) var(--ease-out);
}

.input-with-prefix:focus-within {
    border-color: var(--gold-primary);
    background: var(--bg-elevated);
}

.input-with-prefix .input-prefix {
    padding: var(--space-3) var(--space-4);
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 500;
    border-right: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.02);
    display: inline-flex;
    align-items: center;
}

.input-with-prefix .text-input,
.input-with-prefix .bank-input {
    background: transparent;
    border: none;
}

.input-with-prefix .text-input:focus,
.input-with-prefix .bank-input:focus {
    background: transparent;
}

/* ---------- Items table ---------- */
.items-wrapper {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.items-header,
.item-row {
    display: grid;
    grid-template-columns: 2.2fr 1fr 1fr 36px;
    gap: var(--space-3);
    align-items: center;
}

.items-header {
    padding: 0 var(--space-3);
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.item-row {
    padding: var(--space-3);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    transition: border-color var(--duration-fast) var(--ease-out),
                background-color var(--duration-fast) var(--ease-out);
}

.item-row:hover { background: var(--bg-elevated); }
.item-row:focus-within { border-color: var(--border-gold); background: var(--bg-elevated); }

.item-row input,
.item-row select {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    outline: none;
    transition: border-color var(--duration-fast) var(--ease-out);
}

.item-row input:focus,
.item-row select:focus { border-color: var(--gold-primary); }

.item-remove {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    width: 36px; height: 36px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color var(--duration-fast) var(--ease-out),
                border-color var(--duration-fast) var(--ease-out);
}

.item-remove:hover {
    color: var(--error);
    border-color: rgba(239, 68, 68, 0.3);
}

.items-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-top: var(--space-2);
}

.btn-add-row {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    background: transparent;
    color: var(--text-primary);
    border: 1px dashed var(--border-soft);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color var(--duration-fast) var(--ease-out),
                color var(--duration-fast) var(--ease-out);
}

.btn-add-row:hover { border-color: var(--gold-primary); color: var(--gold-bright); }

.items-summary {
    display: flex;
    gap: var(--space-6);
    align-items: baseline;
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

.items-summary strong {
    font-family: 'JetBrains Mono', monospace;
    color: var(--gold-bright);
    font-size: 0.9375rem;
    margin-left: var(--space-2);
}

/* ---------- File upload ---------- */
.file-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-8);
    background: var(--bg-card);
    border: 1px dashed var(--border-soft);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: border-color var(--duration-fast) var(--ease-out),
                background-color var(--duration-fast) var(--ease-out);
}

.file-drop:hover,
.file-drop.is-dragover {
    border-color: var(--gold-primary);
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.file-drop .file-icon {
    font-size: 1.5rem;
    color: var(--gold-primary);
}

.file-drop .file-primary {
    font-size: 0.9375rem;
    font-weight: 500;
}

.file-drop .file-secondary {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.file-list {
    list-style: none;
    margin-top: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.file-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
}

.file-list li .file-meta { color: var(--text-muted); }

.file-list .file-remove {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.875rem;
    padding: 4px 8px;
}

.file-list .file-remove:hover { color: var(--error); }

/* ---------- Checkboxes ---------- */
.checklist {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.check-row {
    display: flex;
    gap: var(--space-3);
    align-items: flex-start;
    padding: var(--space-4);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color var(--duration-fast) var(--ease-out),
                background-color var(--duration-fast) var(--ease-out);
}

.check-row:hover { background: var(--bg-elevated); }

.check-row input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px; height: 18px;
    border: 1px solid var(--border-soft);
    border-radius: 4px;
    background: var(--bg-primary);
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    margin-top: 2px;
    transition: border-color var(--duration-fast) var(--ease-out),
                background-color var(--duration-fast) var(--ease-out);
}

.check-row input[type="checkbox"]:checked {
    background: var(--gold-primary);
    border-color: var(--gold-primary);
}

.check-row input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 2px; left: 5px;
    width: 5px; height: 9px;
    border: solid var(--bg-primary);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.check-row input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--gold-bright);
    outline-offset: 2px;
}

.check-text {
    color: var(--text-primary);
    font-size: 0.9375rem;
    line-height: 1.5;
}

.check-text a { color: var(--gold-bright); text-decoration: underline; }

/* ---------- Signature pad ---------- */
.signature-block {
    display: grid;
    grid-template-columns: 1fr 220px;
    gap: var(--space-5);
    align-items: stretch;
}

@media (max-width: 640px) {
    .signature-block { grid-template-columns: 1fr; }
}

.signature-pad-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.signature-pad-wrap canvas {
    width: 100%;
    height: 160px;
    background:
        repeating-linear-gradient(
            to right,
            rgba(255,255,255,0.02) 0,
            rgba(255,255,255,0.02) 8px,
            transparent 8px,
            transparent 16px
        ),
        var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    display: block;
    cursor: crosshair;
    touch-action: none;
}

.signature-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.btn-clear-sig {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: 0.75rem;
    cursor: pointer;
    transition: color var(--duration-fast) var(--ease-out),
                border-color var(--duration-fast) var(--ease-out);
}

.btn-clear-sig:hover { color: var(--error); border-color: rgba(239,68,68,0.3); }

/* ---------- Submit ---------- */
.submit-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-8) 0 var(--space-4);
}

.btn-submit {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-10);
    background: linear-gradient(135deg, var(--gold-primary) 0%, var(--gold-deep) 100%);
    color: var(--bg-primary);
    border: none;
    border-radius: var(--radius-md);
    font-family: 'DM Sans', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: transform var(--duration-fast) var(--ease-spring),
                box-shadow var(--duration-fast) var(--ease-out),
                opacity var(--duration-fast) var(--ease-out);
}

.btn-submit:hover { transform: translateY(-2px); box-shadow: var(--glow-gold); }
.btn-submit:active { transform: translateY(0); }
.btn-submit[disabled] { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none; }

.submit-disclaimer {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-align: center;
    max-width: 520px;
}

/* ---------- Status banner ---------- */
.status-banner {
    margin-top: var(--space-4);
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    display: flex;
    gap: var(--space-3);
    align-items: flex-start;
    font-size: 0.875rem;
}

.status-banner.is-success { border-color: rgba(34,197,94,0.3); color: #bbf7d0; background: rgba(34,197,94,0.06); }
.status-banner.is-error { border-color: rgba(239,68,68,0.3); color: #fecaca; background: rgba(239,68,68,0.06); }
.status-banner.is-info { border-color: var(--border-gold); color: var(--gold-light); background: rgba(201,162,39,0.06); }

/* ---------- Footer ---------- */
.footer {
    text-align: center;
    padding: var(--space-8) 0;
    color: var(--text-muted);
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.footer a { color: var(--text-secondary); text-decoration: none; }
.footer a:hover { color: var(--gold-bright); }

/* ---------- Helper / shared ---------- */
.preview-banner {
    margin-bottom: var(--space-6);
    padding: var(--space-3) var(--space-4);
    background: rgba(245,158,11,0.08);
    border: 1px solid rgba(245,158,11,0.25);
    border-radius: var(--radius-md);
    color: #fde68a;
    font-size: 0.75rem;
    text-align: center;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.prose {
    color: var(--text-primary);
    font-size: 0.9375rem;
    line-height: 1.7;
}

.prose h2 {
    font-family: 'Playfair Display', Georgia, serif;
    color: var(--text-primary);
    margin: var(--space-8) 0 var(--space-3);
    font-size: 1.25rem;
    font-weight: 600;
}

.prose h3 {
    font-family: 'DM Sans', sans-serif;
    color: var(--gold-bright);
    margin: var(--space-6) 0 var(--space-2);
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.prose p { margin-bottom: var(--space-3); color: var(--text-secondary); }
.prose ul { padding-left: var(--space-5); margin-bottom: var(--space-4); color: var(--text-secondary); }
.prose li { margin-bottom: var(--space-2); }

.prose .editable {
    background: rgba(245,158,11,0.07);
    border-left: 2px solid rgba(245,158,11,0.5);
    padding: 2px 6px;
    border-radius: 2px;
    color: #fde68a;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .container { padding: var(--space-4); }
    .form-section { padding: var(--space-6); }
    .field-grid { grid-template-columns: 1fr; gap: var(--space-4); }
    .items-header { display: none; }
    .item-row {
        grid-template-columns: 1fr;
        gap: var(--space-2);
    }
    .item-row .item-cell::before {
        content: attr(data-label);
        display: block;
        font-size: 0.6875rem;
        font-weight: 600;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.1em;
        margin-bottom: 4px;
    }
    .item-remove-cell { justify-self: end; }
    .items-summary { flex-direction: column; gap: var(--space-2); }
    .items-actions { flex-direction: column; align-items: stretch; }
    .btn-add-row { justify-content: center; }
}

@media print {
    body { background: white; color: black; }
    .preview-banner, .footer, .file-drop, .submit-wrap { display: none; }
    .form-section { border: 1px solid #ccc; background: white; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
