/* ==========================================================================
   VERSION 4: ENTERPRISE DESIGN SYSTEM
   ========================================================================== */

/* ──────────────────────────────────────────────────────────────
   1.  CSS CUSTOM PROPERTIES (Root Variables)
   ────────────────────────────────────────────────────────────── */

:root {
    /* Color Palette */
    --clr-bg: #F9FAFB;
    --clr-surface: #FFFFFF;
    --clr-surface-alt: #F3F4F6;
    
    --clr-text-primary: #111827;
    --clr-text-secondary: #6B7280;
    --clr-text-tertiary: #9CA3AF;
    
    --clr-brand: #000000;
    --clr-brand-hover: #262626;
    
    --clr-border: #E5E7EB;
    --clr-border-focus: #111827;
    
    --clr-error: #DC2626;
    --clr-error-bg: #FEF2F2;
    --clr-success: #10B981;

    /* Typography */
    --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-serif: 'Playfair Display', Georgia, serif;
    
    /* Spacing Framework */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2.5rem;
    --space-xl: 4rem;

    /* Radii & Shadows */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.02);
    --shadow-md: 0 8px 20px rgba(0,0,0,0.06);
    --shadow-float: 0 24px 48px -12px rgba(0,0,0,0.12);

    /* Animation Curves (Apple Style) */
    --ease-out: 300ms cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: 400ms cubic-bezier(0.65, 0, 0.35, 1);
    --transition-fast: 150ms ease;
}


/* ──────────────────────────────────────────────────────────────
   2.  RESET & BASE STYLES
   ────────────────────────────────────────────────────────────── */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    background-color: var(--clr-bg);
    color: var(--clr-text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow-x: hidden;
}

/* Ambient Background */
.ambient-bg {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    z-index: -1;
    opacity: 0.5;
    pointer-events: none;
}
.blur-circle-1 {
    width: 40vw; height: 40vw;
    background: linear-gradient(to right, #E2E8F0, #CBD5E1);
    top: -10vw; left: -10vw;
}
.blur-circle-2 {
    width: 35vw; height: 35vw;
    background: linear-gradient(to right, #F8FAFC, #E2E8F0);
    bottom: -10vw; right: -5vw;
}


/* ──────────────────────────────────────────────────────────────
   3.  UTILITY CLASSES
   ────────────────────────────────────────────────────────────── */

.hidden { display: none !important; }
.mt-lg { margin-top: var(--space-lg); }
.font-medium { font-weight: 500; }
.text-secondary { color: var(--clr-text-secondary); }
.text-primary { color: var(--clr-text-primary); }

.required {
    color: var(--clr-error);
    margin-left: 4px;
    font-size: 0.9em;
}

.divider {
    height: 1px;
    background: var(--clr-border);
    margin: var(--space-lg) 0;
    width: 100%;
}


/* ──────────────────────────────────────────────────────────────
   4.  LAYOUT: SPLIT SCREEN ARCHITECTURE
   ────────────────────────────────────────────────────────────── */

.checkout-layout {
    display: flex;
    width: 100%;
    max-width: 1280px;
    min-height: 80vh;
    background: var(--clr-surface);
    box-shadow: var(--shadow-float);
    position: relative;
    flex-shrink: 0;
}

@media (min-width: 1024px) {
    body { padding: var(--space-xl) 2rem; }
    .checkout-layout { border-radius: var(--radius-lg); overflow: hidden; min-height: 75vh; }
}


/* ──────────────────────────────────────────────────────────────
   5.  LEFT PANE: SHOWCASE
   ────────────────────────────────────────────────────────────── */

.showcase-pane {
    flex: 0 0 42%;
    background: #F8FAFC;
    padding: var(--space-xl) var(--space-lg);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--clr-border);
    position: relative;
}

/* ── Showcase Header ── */
.showcase-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xl);
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--clr-text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color var(--transition-fast);
}
.btn-back:hover { color: var(--clr-brand); }

.brand-mark {
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.05em;
    color: var(--clr-brand);
}

/* ── Product Presentation ── */
.product-presentation { flex: 1; }

.badge-premium {
    display: inline-block;
    padding: 4px 12px;
    background: rgba(0,0,0,0.06);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: var(--space-sm);
    color: var(--clr-brand);
}

.product-title {
    font-family: var(--font-serif);
    font-size: clamp(2rem, 3.5vw, 3rem);
    line-height: 1.1;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.product-price {
    font-size: 1.25rem;
    color: var(--clr-text-secondary);
    margin-bottom: var(--space-lg);
}

/* ── Product Gallery ── */
.product-gallery {
    margin-bottom: var(--space-lg);
}

.gallery-main {
    width: 100%;
    aspect-ratio: 4/5;
    background: var(--clr-surface);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
    overflow: hidden;
    border: 1px solid rgba(0,0,0,0.04);
    box-shadow: var(--shadow-sm);
    position: relative;
}
.gallery-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity var(--ease-out);
}

.gallery-thumbnails {
    display: flex;
    gap: 12px;
}
.gallery-thumbnails img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 2px solid transparent;
    background: var(--clr-surface);
    transition: all var(--ease-out);
    opacity: 0.6;
}
.gallery-thumbnails img:hover {
    opacity: 1;
    transform: translateY(-2px);
}
.gallery-thumbnails img.active {
    opacity: 1;
    border-color: var(--clr-brand);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* ── Product Features ── */
.product-features {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.feature-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.feature-icon {
    width: 32px; height: 32px;
    background: var(--clr-surface);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--clr-brand);
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}
.feature-item span {
    font-size: 0.9rem;
    color: var(--clr-text-secondary);
    line-height: 1.4;
    padding-top: 5px;
}

/* ── Live Summary ── */
.live-summary {
    margin-top: auto;
    padding-top: var(--space-lg);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.summary-divider {
    height: 1px;
    background: var(--clr-border);
    margin: 16px 0;
}

.summary-total {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--clr-text-primary);
}


/* ──────────────────────────────────────────────────────────────
   6.  RIGHT PANE: INTERACTION FLOW
   ────────────────────────────────────────────────────────────── */

.interaction-pane {
    flex: 1;
    padding: var(--space-xl);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-y: auto;
    background: var(--clr-surface);
}

/* ── Progress Tracker ── */
.progress-tracker {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-xl);
    position: relative;
    padding-bottom: 12px;
}

.progress-step {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--clr-text-tertiary);
    transition: color var(--ease-out);
    position: relative;
    z-index: 2;
    background: var(--clr-surface);
    padding: 0 4px;
}
.progress-step.active { color: var(--clr-brand); }
.progress-step.completed { color: var(--clr-text-secondary); }

.progress-bar-bg {
    position: absolute;
    bottom: 0; left: 0; width: 100%; height: 2px;
    background: var(--clr-border);
    border-radius: 2px;
}
.progress-bar-fill {
    height: 100%;
    background: var(--clr-brand);
    width: 33.33%;
    border-radius: 2px;
    transition: width var(--ease-out);
}

/* ── Form Steps ── */
.checkout-form { flex: 1; display: flex; flex-direction: column; }
.form-step { display: none; flex-direction: column; animation: fadeIn var(--ease-out); }
.form-step.active { display: flex; }

.step-header { margin-bottom: var(--space-lg); }
.step-header h2 { font-size: 1.5rem; margin-bottom: 6px; letter-spacing: -0.01em; }
.step-header p { color: var(--clr-text-secondary); font-size: 0.95rem; }


/* ──────────────────────────────────────────────────────────────
   7.  FORM COMPONENTS (Floating Labels)
   ────────────────────────────────────────────────────────────── */

.input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.input-group {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.input-group input, 
.input-group select, 
.input-group textarea {
    width: 100%;
    background: transparent;
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-sm);
    padding: 1.35rem 1rem 0.5rem;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--clr-text-primary);
    transition: all var(--transition-fast);
    outline: none;
    appearance: none;
}
.input-group textarea { resize: vertical; min-height: 110px; }

.input-group label {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.95rem;
    color: var(--clr-text-secondary);
    pointer-events: none;
    transition: transform var(--ease-out), color var(--ease-out), font-size var(--ease-out);
    transform-origin: left top;
}
.input-group textarea + label { top: 1.5rem; }

/* Floating Label Trigger */
.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label,
.input-group select:focus + label,
.input-group select:valid + label,
.input-group textarea:focus + label,
.input-group textarea:not(:placeholder-shown) + label {
    transform: translateY(-90%) scale(0.75);
    color: var(--clr-text-tertiary);
}
.input-group input:focus + label,
.input-group select:focus + label,
.input-group textarea:focus + label {
    color: var(--clr-brand);
}

/* Focus & Hover States */
.input-group input:hover:not(:focus), 
.input-group select:hover:not(:focus), 
.input-group textarea:hover:not(:focus) {
    border-color: #D1D5DB;
}
.input-group input:focus, 
.input-group select:focus, 
.input-group textarea:focus {
    border-color: var(--clr-border-focus);
    box-shadow: 0 0 0 1px var(--clr-border-focus);
}

.select-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--clr-text-tertiary);
    pointer-events: none;
    font-size: 0.9rem;
}

/* Error States */
.input-group.invalid input,
.input-group.invalid select,
.input-group.invalid textarea {
    border-color: var(--clr-error);
    background-color: var(--clr-error-bg);
}

.error-msg {
    color: var(--clr-error);
    font-size: 0.75rem;
    margin-top: 4px;
    display: none;
    align-items: center;
    gap: 4px;
    animation: shake 400ms cubic-bezier(.36,.07,.19,.97) both;
}

.char-count {
    position: absolute;
    bottom: -1.25rem;
    right: 0;
    font-size: 0.75rem;
    color: var(--clr-text-tertiary);
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}


/* ──────────────────────────────────────────────────────────────
   8.  CUSTOM CONTROLS (Quantity, Radios, Upload)
   ────────────────────────────────────────────────────────────── */

/* ── Specifications Layout ── */
.specs-layout { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }

/* ── Quantity Control ── */
.quantity-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-sm);
    height: 100%;
    min-height: 3.5rem;
    padding: 0 8px;
    background: transparent;
}

.btn-qty {
    background: transparent; border: none;
    width: 2.25rem; height: 2.25rem; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--clr-text-primary);
    transition: background var(--transition-fast);
}
.btn-qty:hover { background: var(--clr-surface-alt); }
.qty-display { font-weight: 600; font-size: 1.05rem; width: 2.5rem; text-align: center; }

/* ── Radio Cards ── */
.selection-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }
.radio-card { cursor: pointer; position: relative; }
.radio-card input { position: absolute; opacity: 0; width: 0; height: 0; }

.card-content {
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-md);
    padding: 16px;
    height: 100%;
    transition: all var(--transition-fast);
}
.radio-card:hover .card-content { border-color: #9CA3AF; }
.radio-card input:focus-visible + .card-content { outline: 2px solid var(--clr-brand); outline-offset: 2px; }
.radio-card input:checked + .card-content {
    border-color: var(--clr-brand);
    box-shadow: 0 0 0 1px var(--clr-brand);
    background: #FAFAFA;
}

.card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }

.radio-custom {
    width: 18px; height: 18px;
    border: 1px solid var(--clr-border);
    border-radius: 50%;
    position: relative;
    transition: all var(--transition-fast);
}
.radio-custom::after {
    content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0);
    width: 8px; height: 8px; background: var(--clr-brand); border-radius: 50%;
    transition: transform var(--transition-fast);
}
.radio-card input:checked + .card-content .radio-custom { border-color: var(--clr-brand); }
.radio-card input:checked + .card-content .radio-custom::after { transform: translate(-50%, -50%) scale(1); }

.card-title { font-weight: 600; font-size: 0.95rem; }
.card-desc { font-size: 0.85rem; color: var(--clr-text-secondary); margin-bottom: 12px; line-height: 1.4; }
.card-price { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }

/* ── Expandable Shipping Area ── */
.shipping-fields {
    display: grid;
    grid-template-rows: 1fr;
    transition: grid-template-rows var(--ease-out);
}
.shipping-fields-inner { overflow: hidden; display: flex; flex-direction: column; gap: 0; padding-bottom: 8px;}
.shipping-fields.closed { grid-template-rows: 0fr; }


/* ──────────────────────────────────────────────────────────────
   9.  PAYMENT SECTION
   ────────────────────────────────────────────────────────────── */

/* ── Payment Module ── */
.payment-module {
    display: flex;
    gap: 32px;
    background: #F8FAFC;
    padding: 24px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    border: 1px solid var(--clr-border);
}

/* ── QR Code Wrapper ── */
.qr-wrapper { flex: 0 0 140px; }
.qr-placeholder {
    width: 140px; height: 140px;
    background: var(--clr-surface);
    border: 1.5px dashed #CBD5E1;
    border-radius: var(--radius-sm);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; gap: 8px;
    color: var(--clr-text-tertiary);
}
.qr-placeholder i { font-size: 2.5rem; color: #94A3B8;}
.qr-placeholder span { font-size: 0.75rem; font-weight: 500;}

/* ── Payment Instructions ── */
.payment-instructions h3 { font-size: 0.95rem; margin-bottom: 12px; }
.payment-instructions ol { padding-left: 20px; font-size: 0.9rem; color: var(--clr-text-secondary); line-height: 1.7; }
.payment-instructions li { margin-bottom: 4px; }
.payment-instructions strong { color: var(--clr-text-primary); }

/* ── Payment Summary ── */
.payment-summary {
    background: var(--clr-surface-alt);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    margin-bottom: 24px;
    border: 1px solid var(--clr-border);
    box-shadow: var(--shadow-sm);
}
.payment-summary .summary-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 0.95rem;
    color: var(--clr-text-secondary);
}
.payment-summary .summary-row:last-of-type {
    border-bottom: none;
}
.payment-summary .summary-divider {
    height: 1px;
    background: var(--clr-border);
    margin: 12px 0;
}
.payment-summary .summary-total {
    font-weight: 600;
    font-size: 1.15rem;
    color: var(--clr-text-primary);
}
.payment-summary .summary-total span:last-child {
    font-weight: 700;
    color: var(--clr-brand);
}

/* ── Trust Badges ── */
.trust-combo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 0 12px 0;
    font-size: 0.8rem;
    color: var(--clr-text-secondary);
    border-bottom: 1px solid var(--clr-border);
    margin-bottom: 16px;
}
.trust-combo .trust-left {
    display: flex;
    align-items: center;
    gap: 6px;
}
.trust-combo .lock-icon {
    color: var(--clr-success);
    opacity: 0.7;
}


/* ──────────────────────────────────────────────────────────────
   10. FILE UPLOAD
   ────────────────────────────────────────────────────────────── */

.upload-module { position: relative; margin-bottom: 24px;}
.hidden-input { position: absolute; width: 0; height: 0; opacity: 0; }

.upload-dropzone {
    border: 1.5px dashed var(--clr-border);
    border-radius: var(--radius-md);
    padding: 32px 24px;
    text-align: center; cursor: pointer;
    transition: all var(--transition-fast);
    background: var(--clr-surface);
}
.upload-dropzone:hover, .upload-dropzone.dragover, .upload-dropzone:focus-visible {
    border-color: var(--clr-brand);
    background: #F8FAFC;
    outline: none;
}
.dropzone-content i { font-size: 2.5rem; color: #94A3B8; margin-bottom: 12px; }
.dropzone-content h4 { font-size: 1.05rem; font-weight: 600; margin-bottom: 4px; }
.dropzone-content p { font-size: 0.9rem; color: var(--clr-text-secondary); margin-bottom: 8px; }
.dropzone-content p span { color: var(--clr-brand); font-weight: 500; text-decoration: underline; text-underline-offset: 2px;}
.file-types { font-size: 0.8rem; color: var(--clr-text-tertiary); }

.upload-success {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px;
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-md);
    background: var(--clr-surface);
    box-shadow: var(--shadow-sm);
}

.file-thumbnail {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid var(--clr-border);
    flex-shrink: 0;
    background: var(--clr-surface);
}

.file-info {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex: 1;
    min-width: 0;
}
.file-icon { width: 44px; height: 44px; background: #ECFDF5; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; color: var(--clr-success); }
.file-details { display: flex; flex-direction: column; }
.filename { font-size: 0.9rem; font-weight: 600; max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--clr-text-primary);}
.filesize { font-size: 0.8rem; color: var(--clr-text-secondary); }

.btn-icon { background: transparent; border: none; font-size: 1.25rem; color: var(--clr-text-tertiary); cursor: pointer; transition: color var(--transition-fast); padding: 4px;}
.btn-icon:hover { color: var(--clr-error); }

.upload-error-msg {
    color: var(--clr-error); font-size: 0.8rem; position: absolute; bottom: -20px; left: 0; opacity: 0; transition: opacity var(--transition-fast); display: flex; align-items: center; gap: 4px;
}


/* ──────────────────────────────────────────────────────────────
   11. CHECKBOX AGREEMENT
   ────────────────────────────────────────────────────────────── */

.checkbox-container {
    display: flex; align-items: flex-start; gap: 12px;
    cursor: pointer; position: relative;
    padding: 8px 0;
}
.checkbox-container input { position: absolute; opacity: 0; width: 0; height: 0; }
.checkbox-custom {
    width: 20px; height: 20px; border: 1.5px solid #D1D5DB; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--transition-fast); margin-top: 2px; flex-shrink: 0;
}
.checkbox-custom i { color: white; font-size: 0.8rem; opacity: 0; transition: opacity var(--transition-fast); }
.checkbox-container input:checked + .checkbox-custom { background: var(--clr-brand); border-color: var(--clr-brand); }
.checkbox-container input:checked + .checkbox-custom i { opacity: 1; }
.checkbox-container:hover .checkbox-custom { border-color: var(--clr-brand); }
.checkbox-container input:focus-visible + .checkbox-custom { outline: 2px solid var(--clr-brand); outline-offset: 2px; }
.checkbox-container.invalid .checkbox-custom { border-color: var(--clr-error); background: var(--clr-error-bg);}
.checkbox-label { font-size: 0.9rem; color: var(--clr-text-secondary); line-height: 1.5; }


/* ──────────────────────────────────────────────────────────────
   12. BUTTONS & NAVIGATION
   ────────────────────────────────────────────────────────────── */

.action-row {
    margin-top: auto;
    padding-top: var(--space-xl);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

button {
    font-family: inherit; font-size: 0.95rem; font-weight: 600;
    padding: 1rem 2rem; border-radius: var(--radius-full);
    cursor: pointer; transition: all var(--transition-fast);
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}

.btn-primary {
    background: var(--clr-brand); color: white; border: 1px solid var(--clr-brand);
}
.btn-primary:hover:not(:disabled) { background: var(--clr-brand-hover); border-color: var(--clr-brand-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-primary:active:not(:disabled) { transform: translateY(0); box-shadow: none; }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-secondary {
    background: transparent; color: var(--clr-text-primary); border: 1px solid var(--clr-border);
}
.btn-secondary:hover { background: var(--clr-surface-alt); }

.spinner { display: none; animation: spin 1s linear infinite; font-size: 1.25rem;}
@keyframes spin { 100% { transform: rotate(360deg); } }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}


/* ──────────────────────────────────────────────────────────────
   13. PAGE FOOTER
   ────────────────────────────────────────────────────────────── */

.page-footer {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px 32px 24px;
    background: transparent;
    border-top: 1px solid var(--clr-border);
    flex-shrink: 0;
}

@media (min-width: 1024px) {
    .page-footer {
        padding: 20px 48px 24px;
    }
}

.footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
}
.footer-content p {
    font-size: 0.8rem;
    color: var(--clr-text-secondary);
    text-align: center;
}
.footer-content p strong {
    color: var(--clr-text-primary);
    font-weight: 600;
}

@media (max-width: 640px) {
    .page-footer {
        padding: 16px 20px 20px;
    }
    .footer-content p {
        font-size: 0.75rem;
    }
}


/* ──────────────────────────────────────────────────────────────
   14. ANIMATIONS
   ────────────────────────────────────────────────────────────── */

/* All keyframes are defined near their usage above:
   - shake   → error-msg
   - spin    → spinner
   - fadeIn  → form-step
   No additional animation keyframes exist.
   */


/* ──────────────────────────────────────────────────────────────
   15. RESPONSIVE: SMALL ADJUSTMENTS (≤ 640px)
   ────────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
    .input-grid, .specs-layout, .selection-cards {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 12px;
    }
    .action-row {
        flex-direction: column-reverse;
        gap: 12px;
        padding-top: var(--space-lg);
    }
    .action-row button { width: 100%; }
    .upload-dropzone { padding: 24px 16px; }
    .filename { max-width: 160px; }

    .payment-summary {
        padding: 14px 16px;
    }
    .payment-summary .summary-row {
        font-size: 0.9rem;
    }
    .payment-summary .summary-total {
        font-size: 1.05rem;
    }

    .trust-combo {
        font-size: 0.7rem;
        padding: 6px 0 10px 0;
    }
}


/* ──────────────────────────────────────────────────────────────
   16. RESPONSIVE: TABLET & MOBILE LAYOUT (≤ 1023px)
   ────────────────────────────────────────────────────────────── */

@media (max-width: 1023px) {
    .checkout-layout { flex-direction: column; min-height: 100vh; }
    
    /* Showcase becomes top header */
    .showcase-pane { 
        flex: none; width: 100%; border-right: none; border-bottom: 1px solid var(--clr-border); 
        padding: var(--space-lg) var(--space-md); 
    }
    
    .showcase-header { margin-bottom: var(--space-md); }
    .product-presentation { display: flex; flex-direction: column; }
    
    /* Modify layout for mobile showcase */
    .product-title { font-size: 1.75rem; margin-bottom: 4px;}
    .product-price { margin-bottom: var(--space-md); }
    
    .product-gallery { display: flex; gap: 16px; margin-bottom: 0; }
    .gallery-main { width: 120px; flex-shrink: 0; aspect-ratio: 4/5; margin-bottom: 0;}
    .gallery-thumbnails { display: none; } /* Hide thumbs on mobile for space */
    .product-features { justify-content: center; }
    .feature-item { gap: 8px;}
    .feature-icon { width: 24px; height: 24px;}
    
    /* Wrap gallery and text */
    .mobile-product-wrap { display: flex; gap: 16px; margin-bottom: 16px;}
    
    .live-summary { display: none; } /* Rely on the Submit button total instead */
    
    .interaction-pane { width: 100%; padding: var(--space-lg) var(--space-md); }
    
    .payment-module { flex-direction: column; gap: var(--space-md); align-items: center; text-align: center;}
    .payment-instructions ol { text-align: left; display: inline-block;}
}


/* ──────────────────────────────────────────────────────────────
   17. RESPONSIVE: QR CODE BREAKPOINTS (Enterprise Grade)
   ────────────────────────────────────────────────────────────── */

/* ── QR Code Base (Shared across all) ── */

.qr-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    min-height: 300px;
}

#qrcode {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px;
    background: #ffffff;
    border: 2px solid #e8ecf1;
    border-radius: 12px;
}
#qrcode img,
#qrcode canvas {
    width: 200px !important;
    height: 200px !important;
    display: block;
}

.qr-label {
    margin-top: 16px;
    text-align: center;
}
.qr-label span {
    font-size: 18px;
    font-weight: 600;
    color: #1a2332;
    display: block;
}
.qr-label small {
    font-size: 13px;
    color: #6b7a8f;
}

.qr-amount {
    margin-top: 10px;
    padding: 8px 20px;
    background: #f0f4ff;
    border-radius: 20px;
    font-size: 16px;
    font-weight: 600;
    color: #1a73e8;
}

.qr-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #9aa6b5;
}
.qr-placeholder i {
    font-size: 64px;
    margin-bottom: 12px;
}

/* ── Small Phones (320px – 430px) ── */
@media (max-width: 430px) {
    .payment-module {
        flex-direction: column;
        gap: var(--space-md);
        align-items: center;
        padding: 16px;
    }
    .qr-wrapper {
        width: 100%;
        min-height: auto;
        padding: 16px;
    }
    #qrcode img,
    #qrcode canvas {
        width: 160px !important;
        height: 160px !important;
    }
    .qr-amount {
        font-size: 14px;
        padding: 6px 16px;
    }
    .payment-instructions {
        width: 100%;
        text-align: left;
    }
    .payment-instructions ol {
        font-size: 0.85rem;
        padding-left: 16px;
    }
    .payment-summary {
        padding: 14px 16px;
    }
    .payment-summary .summary-row {
        font-size: 0.85rem;
        padding: 4px 0;
    }
    .payment-summary .summary-total {
        font-size: 1rem;
    }
}

/* ── Medium Phones (480px – 600px) ── */
@media (min-width: 431px) and (max-width: 600px) {
    .payment-module {
        flex-direction: column;
        gap: var(--space-md);
        align-items: center;
        padding: 20px;
    }
    .qr-wrapper {
        width: 100%;
        min-height: auto;
    }
}

/* ── Large Phones / Small Tablets (601px – 767px) ── */
@media (min-width: 601px) and (max-width: 767px) {
    .payment-module {
        flex-direction: column;
        gap: var(--space-md);
        align-items: center;
        padding: 20px;
    }
    .qr-wrapper {
        width: 100%;
        min-height: auto;
    }
}

/* ── Tablets (768px – 1023px) ── */
@media (min-width: 768px) and (max-width: 1023px) {
    .payment-module {
        flex-direction: row;
        gap: 24px;
        align-items: flex-start;
        padding: 24px;
    }
    .qr-wrapper {
        flex: 0 0 160px;
        min-height: auto;
        padding: 12px;
    }
    #qrcode img,
    #qrcode canvas {
        width: 140px !important;
        height: 140px !important;
    }
    .payment-instructions {
        flex: 1;
    }
}

/* ── Small Notebooks / Large Tablets Landscape (1024px – 1279px) ── */
@media (min-width: 1024px) and (max-width: 1279px) {
    .payment-module {
        gap: 24px;
        padding: 20px;
    }
    .qr-wrapper {
        flex: 0 0 130px;
        min-height: auto;
        padding: 12px;
    }
    #qrcode img,
    #qrcode canvas {
        width: 140px !important;
        height: 140px !important;
    }
}

/* ── Laptops / Desktops (1280px – 1599px) ── */
@media (min-width: 1280px) and (max-width: 1599px) {
    .payment-module {
        gap: 28px;
        padding: 24px;
    }
    .qr-wrapper {
        flex: 0 0 150px;
        min-height: auto;
        padding: 16px;
    }
    #qrcode img,
    #qrcode canvas {
        width: 160px !important;
        height: 160px !important;
    }
}

/* ── Large Desktops / Ultra-wide (1600px+) ── */
@media (min-width: 1600px) {
    .payment-module {
        gap: 40px;
        padding: 32px;
    }
    .qr-wrapper {
        flex: 0 0 180px;
        min-height: auto;
        padding: 20px;
    }
    #qrcode img,
    #qrcode canvas {
        width: 200px !important;
        height: 200px !important;
    }
}

/* ── iPad Pro 11" & 13" Portrait Specific ── */
@media (min-width: 820px) and (max-width: 1024px) and (orientation: portrait) {
    .payment-module {
        flex-direction: row;
        gap: 20px;
    }
    .qr-wrapper {
        flex: 0 0 140px;
    }
    #qrcode img,
    #qrcode canvas {
        width: 130px !important;
        height: 130px !important;
    }
}

/* ── iPad Pro 11" & 13" Landscape Specific ── */
@media (min-width: 1024px) and (max-width: 1366px) and (orientation: landscape) {
    .payment-module {
        gap: 20px;
        padding: 16px;
        flex-direction: row;
    }
    .qr-wrapper {
        flex: 0 0 120px;
        min-height: auto;
        padding: 10px;
    }
    #qrcode img,
    #qrcode canvas {
        width: 120px !important;
        height: 120px !important;
    }
    .qr-label span {
        font-size: 14px;
    }
    .qr-amount {
        font-size: 12px;
        padding: 4px 12px;
    }
}

/* ── Foldable Devices (Samsung Galaxy Fold, etc.) ── */
@media (max-width: 280px) {
    .payment-module {
        flex-direction: column;
        gap: var(--space-sm);
        align-items: center;
        padding: 12px;
    }
    .qr-wrapper {
        width: 100%;
        min-height: auto;
        padding: 10px;
    }
    #qrcode img,
    #qrcode canvas {
        width: 120px !important;
        height: 120px !important;
    }
    .qr-amount {
        font-size: 12px;
        padding: 4px 12px;
    }
    .qr-label span {
        font-size: 14px;
    }
    .payment-instructions ol {
        font-size: 0.75rem;
        padding-left: 14px;
    }
    .payment-summary {
        padding: 10px 12px;
    }
    .payment-summary .summary-row {
        font-size: 0.75rem;
        padding: 3px 0;
    }
}

/* ── Foldable Unfolded / Small Tablet Portrait (600px – 767px) ── */
@media (min-width: 600px) and (max-width: 767px) and (orientation: portrait) {
    .qr-wrapper {
        width: 100%;
        min-height: auto;
    }
}

/* ── Landscape Phone (max-height: 500px) ── */
@media (max-height: 500px) and (orientation: landscape) {
    .qr-wrapper {
        flex: 0 0 100px;
        min-height: auto;
        padding: 8px;
    }
    #qrcode img,
    #qrcode canvas {
        width: 100px !important;
        height: 100px !important;
    }
    .qr-label span {
        font-size: 12px;
    }
    .qr-label small {
        font-size: 10px;
    }
    .qr-amount {
        font-size: 10px;
        padding: 2px 10px;
        margin-top: 4px;
    }
}


/* ──────────────────────────────────────────────────────────────
   18. PREMIUM MOBILE LAYOUT (Nike / Apple Aesthetic)
   ────────────────────────────────────────────────────────────── */

/* ── สำหรับหน้าจอที่มีความกว้าง ≤ 1023px ── */
@media (max-width: 1023px) {
    /* 1. Thumbnails - ซ่อน Scrollbar & ปรับ Animation ให้สมูท */
    .gallery-thumbnails {
        display: flex !important;
        max-width: 400px !important; 
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        gap: 16px; /* เพิ่มระยะห่างให้ดูหายใจได้ */
        padding: 12px 16px 20px 16px;
        width: 100%;
        max-width: 100%;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        
        /* Hiding scrollbars for a cleaner Apple-like UI */
        scrollbar-width: none; 
        -ms-overflow-style: none; 
    }
    .gallery-thumbnails::-webkit-scrollbar {
        display: none; 
    }

    .gallery-thumbnails img {
        flex: 0 0 76px !important;
        width: 76px !important;
        height: 76px !important;
        object-fit: cover;
        border-radius: 14px; /* มุมโค้งมนแบบ Squircle */
        cursor: pointer;
        scroll-snap-align: center; /* ให้รูปอยู่กึ่งกลางตอนไถ */
        
        /* Premium Inactive State */
        opacity: 0.4;
        transform: scale(0.92);
        transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1); /* Apple's smooth easing */
        border: 1px solid rgba(255, 255, 255, 0.05); 
    }
    
    .gallery-thumbnails img.active {
        opacity: 1;
        transform: scale(1);
        border: 1px solid var(--clr-border, rgba(0,0,0,0.1)); /* หรือใช้สีขาวถ้ารองรับ Dark Mode */
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12); /* Soft deep shadow */
    }

    /* 2. Main Gallery - จัดกึ่งกลางและเพิ่มมิติ */
    .product-gallery {
        flex-direction: column !important;
        align-items: center;
        gap: 16px;
        margin-bottom: 24px;
    }
    .gallery-main {
        width: 100% !important;
        max-width: 340px !important;
        aspect-ratio: 4/5;
        margin: 0 auto;
        border-radius: 20px;
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.06); /* แสงเงาดูแพง */
        transition: transform 0.3s ease;
    }

    /* 3. Typography & Features - จัดระเบียบให้อ่านง่าย */
    .product-presentation {
        text-align: center;
        padding: 0 16px;
    }
    .product-title {
        font-size: 2rem !important;
        font-weight: 700 !important;
        letter-spacing: -0.03em !important; /* บีบตัวอักษรนิดๆ แบบ SF Pro / Futura */
        line-height: 1.1;
        margin-bottom: 8px;
    }
    .product-price {
        font-size: 1.35rem !important;
        font-weight: 500 !important;
        letter-spacing: -0.01em;
        opacity: 0.8;
    }
    .product-features {
        flex-direction: row !important;
        flex-wrap: wrap;
        justify-content: center;
        gap: 12px 20px;
        margin-top: 16px;
    }
    .feature-item {
        flex: 0 1 auto;
        display: flex;
        align-items: center;
        gap: 6px;
        background: rgba(128, 128, 128, 0.05); /* พื้นหลังจางๆ ให้ตัวหนังสือเด่น */
        padding: 6px 12px;
        border-radius: 8px;
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
    }
    .feature-item span {
        font-size: 0.85rem !important;
        font-weight: 500;
        text-align: left;
    }

    /* 4. Layout องค์ประกอบอื่นๆ */
    .live-summary {
        display: block !important;
        margin-top: 24px;
        padding-top: 16px;
        border-top: 1px solid rgba(128, 128, 128, 0.15);
    }
    .input-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 16px;
    }
    .specs-layout, .selection-cards {
        grid-template-columns: 1fr 1fr !important;
        gap: 16px;
    }

    /* 5. Action Buttons - ทรง Capsule (Pill-shaped) แบบ Nike */
    .action-row {
        flex-direction: row !important;
        flex-wrap: wrap;
        gap: 12px;
        margin-top: 24px;
    }
    .action-row button {
        flex: 1 1 auto;
        min-width: 120px;
        padding: 14px 24px;
        border-radius: 999px !important; /* ทรงแคปซูล */
        font-size: 1rem;
        font-weight: 600;
        text-transform: uppercase; /* ให้ความรู้สึก Sport/Premium แบบ Nike */
        letter-spacing: 0.05em;
        transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease;
    }
    .action-row button:active {
        transform: scale(0.96); /* Feedback ตอนกด */
    }
}

/* ── ปรับเพิ่มสำหรับหน้าจอเล็กมาก (≤ 600px) ── */
@media (max-width: 600px) {
    .input-grid, .specs-layout, .selection-cards {
        grid-template-columns: 1fr !important;
    }
    .action-row {
        flex-direction: column-reverse !important;
    }
    .action-row button {
        width: 100% !important;
    }
    .gallery-main {
        max-width: 370px !important;
    }
    .gallery-thumbnails img {
        flex: 0 0 64px !important;
        width: 64px !important;
        height: 64px !important;
    }
    .product-title {
        font-size: 1.75rem !important;
    }
    .payment-module {
        flex-direction: column !important;
        align-items: center !important;
        background: rgba(128, 128, 128, 0.03); /* คลุมโทนจางๆ */
        border-radius: 16px;
        padding: 20px;
    }
}

/* ── ปรับสำหรับมือถือแนวนอน (height ≤ 500px) ── */
@media (max-height: 500px) and (orientation: landscape) {
    .product-gallery {
        flex-direction: row !important; /* แนวนอนให้ภาพอยู่ซ้าย */
        align-items: flex-start;
    }
    .gallery-main {
        max-width: 220px !important;
        margin: 0 !important;
    }
    .gallery-thumbnails {
        flex-direction: column !important; /* Thumbnail เรียงลงมา */
        overflow-y: auto !important;
        overflow-x: hidden !important;
        height: 220px;
        padding: 0 12px;
    }
    .gallery-thumbnails img {
        flex: 0 0 54px !important;
        width: 54px !important;
        height: 54px !important;
    }
    .product-features, .step-header p {
        display: none !important;
    }
    .product-title {
        font-size: 1.4rem !important;
    }
    .action-row {
        flex-direction: row !important;
        padding-top: 16px !important;
    }
    .action-row button {
        width: auto !important;
        flex: 1;
        padding: 10px 16px !important;
        font-size: 0.85rem !important;
    }
    .action-row .btn-secondary {
        flex: 0 0 auto;
    }
}


/* ──────────────────────────────────────────────────────────────
   19. PREMIUM QR CODE STYLING (Apple / Nike Aesthetic)
   ────────────────────────────────────────────────────────────── */

/* ฐานสำหรับทุกหน้าจอ */
.qr-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 20px;
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.02);
    border: 1px solid rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
    width: 100%;
    max-width: 280px;
    margin: 0 auto;
    min-height: auto;
}

#qrcode {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px;
    background: #ffffff;
    border-radius: 18px;
    border: 1.5px solid #f0f2f5;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.02);
}

#qrcode img,
#qrcode canvas {
    width: 200px !important;
    height: 200px !important;
    display: block;
    border-radius: 0px;
}

.qr-label {
    margin-top: 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.qr-label span {
    font-size: 18px;
    font-weight: 600;
    color: #1a2332;
    letter-spacing: -0.01em;
}
.qr-label small {
    font-size: 13px;
    color: #6b7a8f;
    font-weight: 400;
}

.qr-amount {
    margin-top: 12px;
    padding: 8px 20px;
    background: #f5f7fa;
    border-radius: 40px;
    font-size: 16px;
    font-weight: 600;
    color: #1a73e8;
    letter-spacing: 0.02em;
    border: 1px solid #e8ecf1;
}

/* ── มือถือทั่วไป (≤ 600px) ── */
@media (max-width: 600px) {
    .qr-wrapper {
        max-width: 100%;
        padding: 20px 16px;
        border-radius: 20px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    }
    #qrcode {
        padding: 10px;
    }
    #qrcode img,
    #qrcode canvas {
        width: 180px !important;
        height: 180px !important;
    }
    .qr-label span {
        font-size: 17px;
    }
    .qr-label small {
        font-size: 12px;
    }
    .qr-amount {
        font-size: 15px;
        padding: 6px 16px;
    }
}

/* ── จอเล็กมาก (≤ 430px) ── */
@media (max-width: 430px) {
    .qr-wrapper {
        padding: 16px 12px;
        border-radius: 16px;
    }
    #qrcode img,
    #qrcode canvas {
        width: 160px !important;
        height: 160px !important;
    }
    .qr-label span {
        font-size: 16px;
    }
    .qr-amount {
        font-size: 14px;
        padding: 5px 14px;
    }
}

/* ── มือถือแนวนอน (height ≤ 500px) ── */
@media (max-height: 500px) and (orientation: landscape) {
    .qr-wrapper {
        max-width: 200px;
        padding: 12px;
        border-radius: 16px;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px 16px;
    }
    #qrcode {
        padding: 6px;
        flex: 0 0 120px;
    }
    #qrcode img,
    #qrcode canvas {
        width: 120px !important;
        height: 120px !important;
    }
    .qr-label {
        margin-top: 0;
        flex: 1;
        min-width: 80px;
        text-align: left;
    }
    .qr-label span {
        font-size: 14px;
    }
    .qr-label small {
        font-size: 10px;
    }
    .qr-amount {
        margin-top: 0;
        font-size: 12px;
        padding: 4px 12px;
        width: 100%;
        text-align: center;
    }
}


/* ──────────────────────────────────────────────────────────────
   PREMIUM PAYMENT BRAND & QR LABEL (Enterprise-grade)
   ────────────────────────────────────────────────────────────── */

.payment-brand-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 2rem;          /* ใช้ rem แทน px */
    margin-bottom: 0.5rem;
    transition: height var(--transition-fast), margin var(--transition-fast);
}

.payment-brand-logo img {
    height: 100%;
    width: auto;
    object-fit: contain;
    display: block;
    /* หากต้องการรองรับ Dark Mode ในอนาคต สามารถเพิ่ม filter ได้ */
}

.qr-label small {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--clr-text-secondary);   /* ใช้ตัวแปรระบบ */
    letter-spacing: 0.02em;
    line-height: 1.4;
    margin-top: 0.25rem;
    transition: font-size var(--transition-fast), color var(--transition-fast);
}

/* ── Responsive (สอดคล้องกับ breakpoints ที่มีอยู่) ── */

/* หน้าจอ ≤ 600px (มือถือทั่วไป) */
@media (max-width: 600px) {
    .payment-brand-logo {
        height: 1.75rem;
        margin-bottom: 0.4rem;
    }
    .qr-label small {
        font-size: 0.75rem;
        margin-top: 0.2rem;
    }
}

/* หน้าจอ ≤ 430px (มือถือเล็ก) */
@media (max-width: 430px) {
    .payment-brand-logo {
        height: 1.5rem;
        margin-bottom: 0.3rem;
    }
    .qr-label small {
        font-size: 0.7rem;
        margin-top: 0.15rem;
    }
}

/* มือถือแนวนอน (height ≤ 500px) */
@media (max-height: 500px) and (orientation: landscape) {
    .payment-brand-logo {
        height: 1.4rem;
        margin-bottom: 0.25rem;
    }
    .qr-label small {
        font-size: 0.65rem;
        margin-top: 0.1rem;
        line-height: 1.3;
    }
}
















/* ──────────────────────────────────────────────────────────────
   ORDER DETAIL ROW (Enterprise-grade)
   ────────────────────────────────────────────────────────────── */

.order-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    font-size: 0.95rem;
    color: var(--clr-text-secondary);
    border-bottom: 1px solid var(--clr-border);
    transition: background var(--transition-fast), padding var(--ease-out);
}

.order-detail-row:last-of-type {
    border-bottom: none;
}

.order-detail-row > span:first-child {
    font-weight: 500;
    color: var(--clr-text-secondary);
    letter-spacing: 0.01em;
}

.order-detail-row > span:last-child {
    font-weight: 500;
    color: var(--clr-text-primary);
    text-align: right;
    flex-shrink: 0;
    margin-left: 1rem;
}

/* Hover effect (เฉพาะอุปกรณ์ที่มีการ hover) */
@media (hover: hover) {
    .order-detail-row:hover {
        background: var(--clr-surface-alt);
        border-radius: var(--radius-sm);
        padding-left: 0.5rem;
        padding-right: 0.5rem;
        margin: 0 -0.5rem;
    }
}

/* ── Responsive: หน้าจอเล็ก (≤ 600px) ── */
@media (max-width: 600px) {
    .order-detail-row {
        padding: 0.6rem 0;
        font-size: 0.9rem;
        flex-wrap: wrap;
    }
    .order-detail-row > span:first-child {
        flex: 1 0 40%;
    }
    .order-detail-row > span:last-child {
        flex: 1 0 50%;
        margin-left: 0.5rem;
        text-align: right;
        word-break: break-word;
    }
    .order-detail-row > span {
        word-break: break-word;
    }
}

/* ── หน้าจอเล็กมาก (≤ 430px) ── */
@media (max-width: 430px) {
    .order-detail-row {
        padding: 0.5rem 0;
        font-size: 0.85rem;
    }
    .order-detail-row > span:first-child {
        flex: 0 1 auto;
    }
    .order-detail-row > span:last-child {
        flex: 1 1 auto;
    }
}

/* ── มือถือแนวนอน (height ≤ 500px) ── */
@media (max-height: 500px) and (orientation: landscape) {
    .order-detail-row {
        padding: 0.4rem 0;
        font-size: 0.8rem;
    }
}

/* ──────────────────────────────────────────────────────────────
   20. POST-ORDER SUCCESS EXPERIENCE (additive — does not alter
       any rule above; scoped entirely to .order-success and its
       descendants)
   ────────────────────────────────────────────────────────────── */

.order-success {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    padding: var(--space-xl) var(--space-md);
    display: flex;
    justify-content: center;
}

.success-card {
    width: 100%;
    background: var(--clr-surface);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-float);
    padding: var(--space-xl) var(--space-lg);
    text-align: center;
    animation: successCardIn 500ms var(--ease-out) both;
}

.success-icon {
    width: 84px;
    height: 84px;
    margin: 0 auto var(--space-md);
    background: var(--clr-success);
    color: #FFFFFF;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.25rem;
    box-shadow: 0 12px 28px rgba(16, 185, 129, 0.28);
    animation: successPop 550ms var(--ease-out) 120ms both;
}

.success-title {
    font-family: var(--font-serif);
    font-size: clamp(1.65rem, 3vw, 2.25rem);
    letter-spacing: -0.02em;
    margin-bottom: 0.6rem;
    color: var(--clr-brand);
}
.success-title:focus-visible { outline: none; }

.success-message {
    color: var(--clr-text-secondary);
    font-size: 1rem;
    line-height: 1.6;
    max-width: 440px;
    margin: 0 auto var(--space-lg);
}

.success-details {
    text-align: left;
    background: var(--clr-surface-alt);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-md);
    padding: 0.25rem var(--space-md);
    margin-bottom: var(--space-lg);
}

.success-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-sm);
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--clr-border);
    font-size: 0.95rem;
}
.success-detail-row:last-child { border-bottom: none; }

.detail-label {
    color: var(--clr-text-secondary);
    font-weight: 500;
}
.detail-value {
    color: var(--clr-text-primary);
    font-weight: 600;
    text-align: right;
    word-break: break-word;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.3rem 0.85rem;
    background: #FEF3C7;
    color: #92620A;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}
.status-pill::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #D97706;
    flex-shrink: 0;
}

.success-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* The secondary action is a real <a> (per spec, so it can point to a
   real tracking URL later); give it the same visual treatment as the
   existing button base + .btn-secondary, scoped to this component only. */
.success-actions a.btn-secondary {
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 1rem 2rem;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: transparent;
    color: var(--clr-text-primary);
    border: 1px solid var(--clr-border);
    text-decoration: none;
}
.success-actions a.btn-secondary:hover { background: var(--clr-surface-alt); }

@keyframes successCardIn {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes successPop {
    0% { transform: scale(0.6); opacity: 0; }
    70% { transform: scale(1.08); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .success-card, .success-icon { animation: none; }
}

/* ── Desktop & Tablet Landscape ── */
@media (min-width: 640px) and (orientation: landscape) {
    .success-actions button,
    .success-actions a.btn-secondary {
        font-size: 0.865rem; 
        padding: 0.85rem 1.5rem; 
    }
}

/* ── Tablet and up: actions sit side by side ── */
@media (min-width: 640px) {
    .success-actions { flex-direction: row; }
    .success-actions button,
    .success-actions a.btn-secondary { flex: 1; }
}

/* ── Roomier spacing on larger viewports (tablet/desktop/large monitors) ── */
@media (min-width: 768px) {
    .order-success { padding: calc(var(--space-xl) * 1.15) var(--space-lg); }
}

/* ── Small phones ── */
@media (max-width: 480px) {
    .order-success { padding: var(--space-lg) var(--space-sm); }
    .success-card { padding: var(--space-lg) var(--space-md); }
    .success-icon { width: 68px; height: 68px; font-size: 1.9rem; }
    .success-detail-row { font-size: 0.88rem; padding: 0.7rem 0; }
    .success-actions button,
    .success-actions a.btn-secondary { padding: 0.9rem 1.5rem; font-size: 0.9rem; }
}

/* ── Foldables / ultra-narrow ── */
@media (max-width: 320px) {
    .success-detail-row { flex-wrap: wrap; }
    .detail-value { text-align: left; }
}




/* ──────────────────────────────────────────────────────────────
   HONEYPOT - Anti-Spam (Hidden from humans, visible to bots)
   ────────────────────────────────────────────────────────────── */
.honeypot {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 0;
    height: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}
.honeypot input {
    width: 0;
    height: 0;
    padding: 0;
    margin: 0;
    border: none;
    outline: none;
}







/* ──────────────────────────────────────────────────────────────
   FIX: iPad Landscape & Tablet Landscape - Balanced Layout
   ────────────────────────────────────────────────────────────── */
@media (min-width: 900px) and (max-width: 1366px) and (orientation: landscape) {
    /* 0. Interaction Pane - ลดขอบฟอร์มด้านข้าง */
    .interaction-pane {
        padding: var(--space-lg) 21px !important;  /* ✅ เพิ่มบรรทัดนี้ */
    }

    /* 1. Payment Module - ลดขอบด้านข้างลง */
    .payment-module {
        display: flex !important;
        flex-direction: row !important;
        align-items: stretch !important;
        gap: 24px !important;
        padding: 16px 16px !important;
    }

    /* 2. QR Wrapper - ปรับขนาดให้พอดี */
    .qr-wrapper {
        flex: 0 0 150px !important;
        max-width: 200px !important;
        padding: 14px 10px !important;
        min-height: auto !important;
        border-radius: 20px !important;
    }

    /* 3. QR Code */
    #qrcode {
        padding: 10px !important;
        border-radius: 14px !important;
    }
    #qrcode img,
    #qrcode canvas {
        width: 150px !important;
        height: 150px !important;
    }

    /* 4. ข้อความใน QR */
    .qr-label {
        gap: 4px !important;
        margin-top: 10px !important;
    }
    .qr-label span {
        font-size: 15px !important;
        font-weight: 600 !important;
    }
    .qr-label small {
        font-size: 12px !important;
        font-weight: 500 !important;
    }

    /* จำนวนเงิน - 2 บรรทัด สีฟ้าแบบเดิม */
    .qr-amount {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        font-size: 12.5px !important;
        padding: 6px 12px !important;
        margin-top: 6px !important;
        border-radius: 30px !important;
        background: #f0f4ff !important;
        color: #1a73e8 !important;
        border: 1px solid #e8ecf1 !important;
        box-shadow: none !important;
        line-height: 1.3 !important;
        gap: 1px !important;
        min-width: auto !important;
    }
    .qr-amount .label {
        font-size: 11px !important;
        font-weight: 500 !important;
        opacity: 0.7 !important;
        letter-spacing: 0.04em !important;
        text-transform: uppercase !important;
        color: #1a73e8 !important;
    }
    .qr-amount .amount {
        font-size: 14px !important;
        font-weight: 700 !important;
        letter-spacing: 0.02em !important;
        color: #1a73e8 !important;
    }

    /* 5. Payment Instructions - ใช้พื้นที่ที่เหลือ */
    .payment-instructions {
        flex: 1 !important;
        max-width: none !important;
        min-width: 0 !important;
        padding: 0 4px !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
    }

    /* 6. หัวข้อและเนื้อหาใน Instructions - ลดขนาดลงเล็กน้อย */
    .payment-instructions h3 {
        font-size: 1rem !important;
        font-weight: 600 !important;
        margin-bottom: 8px !important;
        letter-spacing: 0.02em !important;
        justify-content: center !important;
        color: var(--clr-text-primary, #111827) !important;
    }
    .payment-instructions ol {
        font-size: 0.885rem !important;
        padding-left: 16px !important;
        line-height: 1.6 !important;
        color: var(--clr-text-secondary, #6B7280) !important;
        margin: 0 !important;
    }
    .payment-instructions ol li {
        margin-bottom: 4px !important;
        padding-left: 2px !important;
    }

    /* 7. Payment Summary - ลด padding */
    .payment-summary {
        padding: 10px 14px !important;
        margin-bottom: 14px !important;
        border-radius: var(--radius-md, 12px) !important;
    }
    .payment-summary .summary-row {
        font-size: 0.885rem !important;
        padding: 4px 0 !important;
    }
    .payment-summary .summary-divider {
        margin: 8px 0 !important;
    }
    .payment-summary .summary-total {
        font-size: 0.955rem !important;
        margin-bottom: 1px !important;
    }

    /* 8. Trust Badge */
    .trust-combo {
        font-size: 0.785rem !important;
        padding: 4px 0 8px 0 !important;
        margin-bottom: 10px !important;
    }

    /* 9. Upload Dropzone */
    .upload-dropzone {
        padding: 16px 16px !important;
    }
    .upload-dropzone h4 {
        font-size: 0.875rem !important;
    }
    .upload-dropzone p {
        font-size: 0.825rem !important;
    }
    
    /* 10. Checkbox */
    .checkbox-label {
        font-size: 0.885rem !important;
    }
}









.size-guide-link{
    display:inline-flex;
    align-items:center;
    gap:6px;

    margin-top:8px;

    font-size:.83rem;
    font-weight:500;

    color:var(--clr-text-secondary);

    text-decoration:none;

    transition:.25s ease;
}

.size-guide-link:hover{
    color:#000;
}

.size-guide-link .ph-arrow-up-right{
    font-size:14px;
    transition:.25s ease;
}

.size-guide-link:hover .ph-arrow-up-right{
    transform:translate(2px,-2px);
}





/* ===========================
   Size Guide Modal
=========================== */

.size-modal{
    position:fixed;
    inset:0;
    z-index:9999;
    display:grid;
    place-items:center;
    padding:clamp(10px,2vw,22px);
    opacity:0;
    visibility:hidden;
    pointer-events:none;
    transition:opacity .28s ease, visibility .28s ease;
    overscroll-behavior:contain;
    -webkit-tap-highlight-color:transparent;
}

.size-modal.show{
    opacity:1;
    visibility:visible;
    pointer-events:auto;
}

.size-modal-backdrop{
    position:absolute;
    inset:0;
    z-index:1;
    background:
        radial-gradient(circle at 50% 20%, rgba(255,255,255,.08), transparent 34%),
        rgba(8,8,10,.84);
    backdrop-filter:blur(16px) saturate(120%);
    -webkit-backdrop-filter:blur(16px) saturate(120%);
}

/* สำคัญ: ให้ shell shrink-wrap ตามรูปจริง */
.size-modal-shell{
    position:relative;
    z-index:2;
    display:inline-grid;
    place-items:center;
    width:fit-content;
    height:fit-content;
    max-width:min(94vw, 860px);
    max-height:92vh;
    transform:translate3d(0,12px,0) scale(.976);
    transition:transform .36s cubic-bezier(.22,.61,.36,1);
    will-change:transform;
    isolation:isolate;
}

.size-modal.show .size-modal-shell{
    transform:translate3d(0,0,0) scale(1);
}

/* รูปเป็นตัวกำหนดขนาดของกล่อง */
.size-modal-image{
    display:block;
    width:auto;
    height:auto;
    max-width:min(94vw, 860px);
    max-height:92vh;
    object-fit:contain;
    object-position:center center;
    border-radius:24px;
    background:#fff;
    box-shadow:
        0 34px 100px rgba(0,0,0,.38),
        inset 0 1px 0 rgba(255,255,255,.55);
    user-select:none;
    -webkit-user-drag:none;
    pointer-events:auto;
}

/* ===========================
   Close Button
=========================== */

.size-modal-close{
    position:absolute;
    top:clamp(8px,1vw,10px);
    right:clamp(8px,1vw,10px);
    width:clamp(38px,3.2vw,44px);
    height:clamp(38px,3.2vw,44px);
    border:none;
    border-radius:999px;
    cursor:pointer;
    display:grid;
    place-items:center;
    background:
        linear-gradient(180deg, rgba(255,255,255,.90), rgba(255,255,255,.74));
    backdrop-filter:blur(18px) saturate(120%);
    -webkit-backdrop-filter:blur(18px) saturate(120%);
    box-shadow:
        0 12px 30px rgba(0,0,0,.16),
        inset 0 1px 0 rgba(255,255,255,.82);
    transform:translateZ(0);
    transition:
        transform .24s cubic-bezier(.22,.61,.36,1),
        background .24s ease,
        box-shadow .24s ease;
    overflow:hidden;
    -webkit-appearance:none;
    appearance:none;
    touch-action:manipulation;
    z-index:3;
}

.size-modal-close::before{
    content:"";
    position:absolute;
    inset:-1px;
    border-radius:inherit;
    background:
        radial-gradient(circle at 30% 25%, rgba(255,255,255,.72), transparent 45%),
        radial-gradient(circle at 70% 80%, rgba(0,0,0,.04), transparent 40%);
    opacity:.5;
    pointer-events:none;
}

.size-modal-close::after{
    content:"";
    position:absolute;
    inset:0;
    border-radius:inherit;
    border:1px solid rgba(255,255,255,.46);
    opacity:.85;
    pointer-events:none;
}

.size-modal-close:hover{
    transform:scale(1.05) rotate(2deg);
    background:
        linear-gradient(180deg, rgba(255,255,255,.96), rgba(255,255,255,.84));
    box-shadow:
        0 16px 38px rgba(0,0,0,.20),
        inset 0 1px 0 rgba(255,255,255,.92);
}

.size-modal-close:active{
    transform:scale(.96);
}

.size-modal-close:focus-visible{
    outline:none;
    box-shadow:
        0 0 0 3px rgba(255,255,255,.22),
        0 0 0 6px rgba(255,255,255,.10),
        0 16px 38px rgba(0,0,0,.20),
        inset 0 1px 0 rgba(255,255,255,.92);
}

.size-modal-close svg{
    width:17px;
    height:17px;
    stroke:#111;
    stroke-width:1.8;
    fill:none;
    stroke-linecap:round;
    stroke-linejoin:round;
    position:relative;
    z-index:1;
}

.size-close-orb{
    position:absolute;
    inset:-10px;
    border-radius:999px;
    background:
        radial-gradient(circle at 50% 50%, rgba(255,255,255,.28), transparent 60%);
    opacity:0;
    transform:scale(.88);
    transition:opacity .24s ease, transform .24s ease;
    pointer-events:none;
}

.size-modal-close:hover .size-close-orb{
    opacity:1;
    transform:scale(1);
}

body.modal-open{
    overflow:hidden;
    touch-action:none;
    overscroll-behavior:contain;
}

/* ===========================
   Mobile
=========================== */

@media (max-width:640px){
    .size-modal{
        padding:10px;
    }

    .size-modal-shell{
        width:fit-content;
        max-width:94vw;
        max-height:92vh;
    }

    .size-modal-image{
        max-width:94vw;
        max-height:92vh;
        border-radius:20px;
    }

    .size-modal-close{
        top:8px;
        right:8px;
        width:40px;
        height:40px;
    }

    .size-modal-close svg{
        width:16px;
        height:16px;
    }
}

@media (prefers-reduced-motion: reduce){
    .size-modal,
    .size-modal-shell,
    .size-modal-close,
    .size-close-orb{
        transition:none !important;
    }
}



/* ===========================
    Input Group & Helper Text Student ID
=========================== */

/* ปรับ .input-group ให้มีความสูงเต็ม grid cell */
.input-group {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%; /* ✅ เพิ่มบรรทัดนี้ */
}

/* ปรับ .input-helper ให้อยู่ด้านล่างสุด */
.input-helper {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;    /* ✅ เปลี่ยนจาก margin-top: 8px เป็น auto */
    padding-top: 6px;    /* ✅ เพิ่มระยะห่างจากส่วนบน */
    font-size: 0.78rem;
    color: #A1A1AA;
}


/* ===========================
    General User Note Styling
=========================== */

.general-user-note {
    margin-top: 8px;
    font-weight: 500;
}

.general-user-note strong {
    font-weight: 700;
}