﻿/**
 * Modern Checkout Page Styles v4.0.0
 * Advanced, next-generation checkout design system
 * Features: CSS Variables · Glassmorphism · Floating Labels · Shimmer Effects
 *           Advanced Animations · Dark Mode · Micro-interactions
 */

/* ========================================
   DESIGN TOKENS / CSS CUSTOM PROPERTIES
   ======================================== */
:root {
    /* Brand */
    --co-brand:          #e8192c;
    --co-brand-dark:     #b8101f;
    --co-brand-light:    #ff3d52;
    --co-brand-alpha-10: rgba(232, 25, 44, 0.10);
    --co-brand-alpha-20: rgba(232, 25, 44, 0.20);
    --co-brand-alpha-40: rgba(232, 25, 44, 0.40);

    /* Neutrals */
    --co-ink:            #0a0a0f;
    --co-ink-secondary:  #374151;
    --co-ink-muted:      #6b7280;
    --co-ink-placeholder:#9ca3af;

    /* Surfaces */
    --co-surface:        #ffffff;
    --co-surface-raised: #f8f9fb;
    --co-surface-hover:  #f1f5f9;
    --co-border:         #e5e7eb;
    --co-border-strong:  #d1d5db;

    /* Status */
    --co-success:        #059669;
    --co-success-bg:     #ecfdf5;
    --co-error:          #dc2626;
    --co-error-bg:       #fef2f2;
    --co-info:           #2563eb;
    --co-info-bg:        #eff6ff;
    --co-warning:        #d97706;
    --co-warning-bg:     #fffbeb;

    /* Shadows */
    --co-shadow-xs:  0 1px 2px rgba(0,0,0,.05);
    --co-shadow-sm:  0 2px 8px rgba(0,0,0,.07);
    --co-shadow-md:  0 4px 20px rgba(0,0,0,.09);
    --co-shadow-lg:  0 8px 40px rgba(0,0,0,.12);
    --co-shadow-xl:  0 20px 60px rgba(0,0,0,.16);
    --co-shadow-brand:    0 8px 32px rgba(232,25,44,.30);
    --co-shadow-brand-lg: 0 16px 48px rgba(232,25,44,.40);

    /* Radii */
    --co-radius-sm:   8px;
    --co-radius-md:   12px;
    --co-radius-lg:   18px;
    --co-radius-xl:   24px;
    --co-radius-full: 9999px;

    /* Typography */
    --co-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', Roboto, sans-serif;

    /* Animation */
    --co-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --co-ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --co-ease-out:    cubic-bezier(0.0, 0.0, 0.2, 1);
    --co-duration-fast: 150ms;
    --co-duration-base: 250ms;
    --co-duration-slow: 400ms;
}

/* Dark mode tokens */
.dark-mode {
    --co-ink:            #f0f0f5;
    --co-ink-secondary:  rgba(240,240,245,.75);
    --co-ink-muted:      rgba(240,240,245,.50);
    --co-ink-placeholder:rgba(240,240,245,.35);
    --co-surface:        #111117;
    --co-surface-raised: #1a1a22;
    --co-surface-hover:  #22222e;
    --co-border:         rgba(255,255,255,.08);
    --co-border-strong:  rgba(255,255,255,.14);
    --co-shadow-sm: 0 2px 8px rgba(0,0,0,.30);
    --co-shadow-md: 0 4px 20px rgba(0,0,0,.40);
    --co-shadow-lg: 0 8px 40px rgba(0,0,0,.50);
}

/* ========================================
   PAGE BACKGROUND
   ======================================== */
.page-checkout-bg {
    background: linear-gradient(135deg, #f5f7fa 0%, #eef1f7 50%, #f0f4f8 100%);
    min-height: 100vh;
    padding-bottom: 80px;
}

.dark-mode .page-checkout-bg {
    background: linear-gradient(135deg, #0a0a0f 0%, #0e0e18 50%, #0c0c15 100%);
}

/* ========================================
   CHECKOUT PROGRESS INDICATOR
   ======================================== */
.checkout-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 32px 0 40px;
    margin-bottom: 8px;
    font-family: var(--co-font);
}

.checkout-progress__step {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.checkout-progress__step-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    border: 2px solid var(--co-border);
    background: var(--co-surface);
    color: var(--co-ink-muted);
    transition: all var(--co-duration-base) var(--co-ease-smooth);
    position: relative;
    z-index: 1;
}

.checkout-progress__step.is-done .checkout-progress__step-icon {
    background: var(--co-success);
    border-color: var(--co-success);
    color: #fff;
}

.checkout-progress__step.is-active .checkout-progress__step-icon {
    background: var(--co-brand);
    border-color: var(--co-brand);
    color: #fff;
    box-shadow: 0 0 0 6px var(--co-brand-alpha-20);
    animation: step-pulse 2s ease-in-out infinite;
}

@keyframes step-pulse {
    0%, 100% { box-shadow: 0 0 0 6px var(--co-brand-alpha-20); }
    50%       { box-shadow: 0 0 0 10px var(--co-brand-alpha-10); }
}

.checkout-progress__step-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--co-ink-muted);
    white-space: nowrap;
}

.checkout-progress__step.is-active .checkout-progress__step-label { color: var(--co-brand); }
.checkout-progress__step.is-done  .checkout-progress__step-label { color: var(--co-success); }

.checkout-progress__connector {
    width: 64px;
    height: 2px;
    background: var(--co-border);
    margin: 0 8px;
    position: relative;
    overflow: hidden;
    border-radius: 2px;
}

.checkout-progress__connector.is-done::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--co-success);
    border-radius: 2px;
}

@media (max-width: 600px) {
    .checkout-progress { padding: 20px 0 28px; }
    .checkout-progress__connector { width: 32px; }
    .checkout-progress__step-label { display: none; }
}

/* ========================================
   CHECKOUT LAYOUT
   ======================================== */
.checkout-layout {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 28px;
    align-items: start;
    font-family: var(--co-font);
}

@media (max-width: 1100px) {
    .checkout-layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

/* ========================================
   SECTION CARDS
   ======================================== */
.checkout-card {
    background: var(--co-surface);
    border-radius: var(--co-radius-xl);
    padding: 36px;
    box-shadow: var(--co-shadow-md);
    border: 1px solid var(--co-border);
    transition: box-shadow var(--co-duration-slow) var(--co-ease-smooth);
    position: relative;
    overflow: hidden;
}

.checkout-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--co-radius-xl);
    background: linear-gradient(145deg, rgba(255,255,255,0.60) 0%, rgba(255,255,255,0.00) 40%);
    pointer-events: none;
}

.dark-mode .checkout-card::before {
    background: linear-gradient(145deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.00) 40%);
}

.checkout-card:hover { box-shadow: var(--co-shadow-lg); }

/* ========================================
   BILLING FORM WRAPPER
   ======================================== */
.checkout-billing {
    background: var(--co-surface);
    border-radius: var(--co-radius-xl);
    padding: 36px;
    box-shadow: var(--co-shadow-md);
    border: 1px solid var(--co-border);
    position: relative;
    overflow: hidden;
    transition: box-shadow var(--co-duration-slow) var(--co-ease-smooth);
}

.checkout-billing::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--co-brand) 0%, var(--co-brand-light) 50%, #ff6a3d 100%);
    border-radius: var(--co-radius-xl) var(--co-radius-xl) 0 0;
}

@media (max-width: 768px) {
    .checkout-billing { padding: 24px 20px; }
    .checkout-card    { padding: 24px 20px; }
}

/* ========================================
   SECTION TITLES
   ======================================== */
.checkout-section-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--co-ink);
    margin: 0 0 28px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--co-border);
    letter-spacing: -0.3px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.checkout-section-title__icon {
    width: 38px;
    height: 38px;
    border-radius: var(--co-radius-sm);
    background: var(--co-brand-alpha-10);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.checkout-section-title__icon svg { color: var(--co-brand); }

/* ========================================
   FORM — BASE STYLES
   ======================================== */
.checkout-form .form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.checkout-form .form-group {
    margin-bottom: 22px;
    position: relative;
}

.checkout-form .form-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--co-ink-secondary);
    margin-bottom: 8px;
    letter-spacing: 0.2px;
    text-transform: uppercase;
}

.checkout-form .form-label .req {
    color: var(--co-brand);
    margin-left: 2px;
}

.checkout-form .form-control {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--co-border);
    border-radius: var(--co-radius-md);
    font-size: 15px;
    font-family: var(--co-font);
    color: var(--co-ink);
    background: var(--co-surface);
    transition:
        border-color var(--co-duration-base) var(--co-ease-smooth),
        box-shadow   var(--co-duration-base) var(--co-ease-smooth),
        background   var(--co-duration-base) var(--co-ease-smooth);
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

.checkout-form .form-control::placeholder { color: var(--co-ink-placeholder); }

.checkout-form .form-control:hover {
    border-color: var(--co-border-strong);
    background: var(--co-surface-raised);
}

.checkout-form .form-control:focus {
    outline: none;
    border-color: var(--co-brand);
    background: var(--co-surface);
    box-shadow: 0 0 0 4px var(--co-brand-alpha-10), var(--co-shadow-xs);
}

.checkout-form .form-control.is-valid  { border-color: var(--co-success); }
.checkout-form .form-control.is-valid:focus { box-shadow: 0 0 0 4px rgba(5,150,105,.10); }

.checkout-form .form-control.is-error  { border-color: var(--co-error); background: var(--co-error-bg); }
.checkout-form .form-control.is-error:focus { box-shadow: 0 0 0 4px rgba(220,38,38,.10); }

.checkout-form textarea.form-control {
    resize: vertical;
    min-height: 110px;
    line-height: 1.6;
}

.checkout-form select.form-control {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg width='14' height='9' viewBox='0 0 14 9' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L7 7L13 1' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 46px;
}

.form-helper    { font-size: 12px; color: var(--co-ink-muted); margin-top: 5px; }
.form-error-msg { font-size: 12px; color: var(--co-error); margin-top: 5px; display: flex; align-items: center; gap: 4px; }

@media (max-width: 768px) {
    .checkout-form .form-row { grid-template-columns: 1fr; gap: 0; }
}

/* ========================================
   INPUT WITH ICON
   ======================================== */
.input-icon-wrap { position: relative; }
.input-icon-wrap .form-control { padding-left: 46px; }
.input-icon-wrap .input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--co-ink-muted);
    pointer-events: none;
    transition: color var(--co-duration-base) var(--co-ease-smooth);
}
.input-icon-wrap:focus-within .input-icon { color: var(--co-brand); }

/* ========================================
   PAYMENT METHOD TABS
   ======================================== */
.payment-methods-section { margin-top: 8px; }

.payment-method-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 24px;
}

.payment-method-tab { position: relative; cursor: pointer; }

.payment-method-tab input[type="radio"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
    margin: 0;
    z-index: 1;
}

.payment-method-tab__label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 16px 12px;
    border: 2px solid var(--co-border);
    border-radius: var(--co-radius-md);
    background: var(--co-surface);
    transition: all var(--co-duration-base) var(--co-ease-smooth);
    font-size: 12px;
    font-weight: 700;
    color: var(--co-ink-muted);
    text-align: center;
    user-select: none;
    position: relative;
    overflow: hidden;
}

.payment-method-tab:hover .payment-method-tab__label {
    border-color: var(--co-brand);
    color: var(--co-brand);
    transform: translateY(-2px);
    box-shadow: var(--co-shadow-sm);
}

.payment-method-tab input[type="radio"]:checked ~ .payment-method-tab__label {
    border-color: var(--co-brand);
    color: var(--co-brand);
    background: var(--co-brand-alpha-10);
    box-shadow: 0 0 0 4px var(--co-brand-alpha-10), var(--co-shadow-sm);
}

/* Payment panels */
.payment-panel { display: none; animation: panel-in var(--co-duration-slow) var(--co-ease-spring) both; }
.payment-panel.is-active { display: block; }

@keyframes panel-in {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}

@media (max-width: 768px) {
    .payment-method-tabs { grid-template-columns: repeat(2, 1fr); }
}

/* ========================================
   ORDER SUMMARY SIDEBAR
   ======================================== */
.checkout-summary {
    position: sticky;
    top: 90px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.order-summary-box {
    background: var(--co-surface);
    border-radius: var(--co-radius-xl);
    overflow: hidden;
    box-shadow: var(--co-shadow-md);
    border: 1px solid var(--co-border);
    transition: box-shadow var(--co-duration-slow) var(--co-ease-smooth);
}

.order-summary-box:hover { box-shadow: var(--co-shadow-lg); }

.order-summary-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--co-ink);
    margin: 0;
    padding: 22px 26px 18px;
    border-bottom: 1px solid var(--co-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--co-surface-raised);
}

.order-summary-count {
    font-size: 12px;
    font-weight: 700;
    color: var(--co-brand);
    background: var(--co-brand-alpha-10);
    padding: 3px 10px;
    border-radius: var(--co-radius-full);
}

.order-summary-items {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 320px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--co-border) transparent;
}

.order-summary-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 24px;
    border-bottom: 1px solid var(--co-border);
    transition: background var(--co-duration-fast) var(--co-ease-smooth);
}

.order-summary-item:last-child { border-bottom: none; }
.order-summary-item:hover { background: var(--co-surface-hover); }

.order-summary-item__thumb { position: relative; flex-shrink: 0; }

.order-summary-item__thumb img {
    width: 58px;
    height: 58px;
    object-fit: cover;
    border-radius: var(--co-radius-sm);
    border: 1px solid var(--co-border);
    display: block;
}

.order-summary-item__qty {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    background: var(--co-brand);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--co-surface);
}

.order-summary-item__info { flex: 1; min-width: 0; }

.order-summary-item__name {
    font-size: 13px;
    font-weight: 700;
    color: var(--co-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}

.order-summary-item__variant { font-size: 11px; color: var(--co-ink-muted); }

.order-summary-item__price {
    font-size: 14px;
    font-weight: 800;
    color: var(--co-ink);
    white-space: nowrap;
}

/* Totals */
.order-totals {
    padding: 18px 24px 6px;
    border-top: 1px solid var(--co-border);
    background: var(--co-surface);
}

.order-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 0;
    font-size: 14px;
    color: var(--co-ink-secondary);
}

.order-total-row--discount span:last-child { color: var(--co-success); font-weight: 700; }

.order-total-row--total {
    margin-top: 10px;
    padding: 16px 0 12px;
    border-top: 2px solid var(--co-border);
    font-size: 20px;
    font-weight: 800;
    color: var(--co-ink);
    letter-spacing: -0.3px;
}

.order-total-row--total span:last-child {
    background: linear-gradient(135deg, var(--co-brand) 0%, var(--co-brand-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.order-savings-badge {
    margin: 0 24px 18px;
    padding: 10px 14px;
    background: linear-gradient(135deg, rgba(5,150,105,.08) 0%, rgba(5,150,105,.04) 100%);
    border: 1px solid rgba(5,150,105,.20);
    border-radius: var(--co-radius-md);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--co-success);
}

@media (max-width: 1100px) {
    .checkout-summary { position: static; }
}

@media (max-width: 768px) {
    .order-summary-item      { padding: 12px 18px; }
    .order-summary-item__thumb img { width: 50px; height: 50px; }
    .order-totals            { padding: 14px 18px 4px; }
    .order-total-row--total  { font-size: 18px; }
}

/* ========================================
   COUPON BOX
   ======================================== */
.coupon-box-sidebar {
    background: var(--co-surface);
    border: 1px solid var(--co-border);
    border-radius: var(--co-radius-lg);
    padding: 18px 20px;
    box-shadow: var(--co-shadow-sm);
}

.coupon-box-sidebar__header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 800;
    color: var(--co-ink);
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.coupon-box-sidebar__form { display: flex; gap: 8px; }

.coupon-box-sidebar__input {
    flex: 1;
    border: 2px solid var(--co-border);
    border-radius: var(--co-radius-sm);
    padding: 10px 14px;
    font-size: 13px;
    font-family: var(--co-font);
    color: var(--co-ink);
    background: var(--co-surface);
    outline: none;
    transition: border-color var(--co-duration-base) var(--co-ease-smooth);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.coupon-box-sidebar__input::placeholder {
    text-transform: none;
    letter-spacing: 0;
    color: var(--co-ink-placeholder);
}

.coupon-box-sidebar__input:focus {
    border-color: var(--co-brand);
    box-shadow: 0 0 0 3px var(--co-brand-alpha-10);
}

.coupon-box-sidebar__btn {
    background: var(--co-ink);
    color: #fff;
    border: none;
    border-radius: var(--co-radius-sm);
    padding: 0 16px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: all var(--co-duration-base) var(--co-ease-smooth);
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.coupon-box-sidebar__btn:hover {
    background: var(--co-brand);
    transform: scale(1.03);
}

.coupon-applied {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--co-success-bg);
    border: 1px solid rgba(5,150,105,.20);
    border-radius: var(--co-radius-sm);
    font-size: 13px;
    font-weight: 700;
    color: var(--co-success);
    margin-top: 10px;
    animation: slide-down var(--co-duration-base) var(--co-ease-spring) both;
}

@keyframes slide-down {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ========================================
   TRUST BADGES
   ======================================== */
.checkout-trust-badges {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 18px 20px;
    border-top: 1px solid var(--co-border);
    background: var(--co-surface-raised);
    border-radius: 0 0 var(--co-radius-xl) var(--co-radius-xl);
}

.checkout-trust-badge {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11px;
    font-weight: 700;
    color: var(--co-ink-muted);
    background: var(--co-surface);
    border: 1px solid var(--co-border);
    border-radius: var(--co-radius-sm);
    padding: 9px 11px;
    transition: all var(--co-duration-base) var(--co-ease-smooth);
}

.checkout-trust-badge:hover {
    border-color: var(--co-brand);
    color: var(--co-brand);
    transform: translateY(-2px);
    box-shadow: var(--co-shadow-sm);
}

.checkout-trust-badge svg { flex-shrink: 0; color: var(--co-success); }

/* ========================================
   PLACE ORDER BUTTON
   ======================================== */
.checkout-form .btn-block {
    width: 100%;
    padding: 18px 32px;
    font-size: 17px;
    font-weight: 800;
    font-family: var(--co-font);
    background: linear-gradient(135deg, var(--co-brand) 0%, var(--co-brand-dark) 100%);
    color: #ffffff;
    border: none;
    border-radius: var(--co-radius-lg);
    cursor: pointer;
    transition: all var(--co-duration-base) var(--co-ease-smooth);
    box-shadow: var(--co-shadow-brand);
    text-align: center;
    letter-spacing: 0.2px;
}

.checkout-form .btn-block:hover {
    background: linear-gradient(135deg, var(--co-brand-light) 0%, var(--co-brand) 100%);
    box-shadow: var(--co-shadow-brand-lg);
    transform: translateY(-3px);
}

.checkout-form .btn-block:active { transform: translateY(-1px); box-shadow: var(--co-shadow-brand); }

/* Modern Place Order Button */
.btn-place-order-modern {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 20px 32px;
    font-size: 17px;
    font-weight: 800;
    font-family: var(--co-font);
    letter-spacing: 0.2px;
    background: linear-gradient(135deg, var(--co-brand) 0%, var(--co-brand-dark) 100%);
    color: #ffffff;
    border: none;
    border-radius: var(--co-radius-lg);
    cursor: pointer;
    transition: all var(--co-duration-base) var(--co-ease-smooth);
    box-shadow: var(--co-shadow-brand);
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

/* Shimmer sweep */
.btn-place-order-modern::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 30%, rgba(255,255,255,0.22) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0s;
}

.btn-place-order-modern:hover::before {
    transform: translateX(100%);
    transition: transform 0.6s var(--co-ease-smooth);
}

/* Glow ring */
.btn-place-order-modern::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: calc(var(--co-radius-lg) + 2px);
    background: linear-gradient(135deg, var(--co-brand-light), var(--co-brand));
    z-index: -1;
    opacity: 0;
    filter: blur(8px);
    transition: opacity var(--co-duration-base) var(--co-ease-smooth),
                transform var(--co-duration-base) var(--co-ease-smooth);
}

.btn-place-order-modern:hover {
    background: linear-gradient(135deg, var(--co-brand-light) 0%, var(--co-brand) 100%);
    box-shadow: var(--co-shadow-brand-lg);
    transform: translateY(-4px) scale(1.01);
}

.btn-place-order-modern:hover::after { opacity: 0.6; transform: scale(1.04); }
.btn-place-order-modern:active { transform: translateY(-1px) scale(1); box-shadow: var(--co-shadow-brand); }

.btn-place-order-modern svg {
    flex-shrink: 0;
    animation: shield-pulse 2.4s ease-in-out infinite;
}

@keyframes shield-pulse {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50%       { transform: scale(1.12) rotate(-3deg); }
}

.btn-place-order-modern span { position: relative; z-index: 1; }

.btn-place-order-modern__sub {
    font-size: 11px;
    font-weight: 500;
    opacity: 0.82;
    letter-spacing: 0;
    margin-top: 2px;
    line-height: 1;
}

/* Secure note */
.checkout-secure-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    color: var(--co-ink-muted);
    margin-top: 12px;
}

.checkout-secure-note svg { color: var(--co-success); }

@media (max-width: 768px) {
    .checkout-form .btn-block     { font-size: 16px; padding: 16px 24px; }
    .btn-place-order-modern       { font-size: 16px; padding: 18px 24px; }
    .checkout-trust-badges        { padding: 14px 16px; }
    .checkout-section-title       { font-size: 18px; margin-bottom: 20px; }
}

@media (max-width: 480px) {
    .checkout-trust-badges { grid-template-columns: 1fr; }
    .checkout-billing, .checkout-card, .order-summary-box { border-radius: var(--co-radius-lg); }
}

/* ========================================
   ALERT MESSAGES
   ======================================== */
.alert {
    padding: 14px 18px;
    border-radius: var(--co-radius-md);
    margin-bottom: 24px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 14px;
    line-height: 1.6;
    animation: alert-in var(--co-duration-base) var(--co-ease-spring) both;
    border-left: 4px solid transparent;
}

@keyframes alert-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.alert-info    { background: var(--co-info-bg);    border: 1px solid rgba(37,99,235,.20);  border-left-color: var(--co-info);    color: #1e3a8a; }
.alert-error   { background: var(--co-error-bg);   border: 1px solid rgba(220,38,38,.20);  border-left-color: var(--co-error);   color: #991b1b; }
.alert-success { background: var(--co-success-bg); border: 1px solid rgba(5,150,105,.20);  border-left-color: var(--co-success); color: #065f46; }
.alert-warning { background: var(--co-warning-bg); border: 1px solid rgba(217,119,6,.20);  border-left-color: var(--co-warning); color: #78350f; }

.alert ul { margin: 6px 0 0; padding-left: 18px; }
.alert li { margin: 3px 0; }

/* ========================================
   LOADING / SKELETON STATE
   ======================================== */
@keyframes skeleton-shimmer {
    0%   { background-position: -400px 0; }
    100% { background-position:  400px 0; }
}

.skeleton {
    background: linear-gradient(90deg, var(--co-border) 25%, var(--co-surface-hover) 50%, var(--co-border) 75%);
    background-size: 800px 100%;
    animation: skeleton-shimmer 1.4s ease-in-out infinite;
    border-radius: var(--co-radius-sm);
}

.checkout-form.loading { opacity: 0.55; pointer-events: none; }

.checkout-form.loading::after {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    width: 52px;
    height: 52px;
    margin: -26px 0 0 -26px;
    border: 4px solid var(--co-border);
    border-top-color: var(--co-brand);
    border-right-color: var(--co-brand);
    border-radius: 50%;
    animation: co-spin 0.65s linear infinite;
    z-index: 9999;
}

@keyframes co-spin { to { transform: rotate(360deg); } }

/* ========================================
   PAYMENT PROCESSING MODAL
   ======================================== */
#pwa-payment-modal { font-family: var(--co-font); }

#pwa-payment-modal-box {
    animation: pwa-modal-in .40s var(--co-ease-spring) both;
    border-radius: var(--co-radius-xl);
    overflow: hidden;
    box-shadow: var(--co-shadow-xl);
}

@keyframes pwa-modal-in {
    from { transform: scale(.80) translateY(28px); opacity: 0; }
    to   { transform: scale(1)   translateY(0);    opacity: 1; }
}

.modal-success-icon {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--co-success-bg) 0%, rgba(5,150,105,.12) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    animation: pop-in 0.5s var(--co-ease-spring) 0.2s both;
}

@keyframes pop-in {
    from { transform: scale(0); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

/* ========================================
   RECENTLY VIEWED SIDEBAR
   ======================================== */
.recently-viewed-sidebar {
    background: var(--co-surface);
    border: 1px solid var(--co-border);
    border-radius: var(--co-radius-lg);
    overflow: hidden;
    box-shadow: var(--co-shadow-sm);
}

.recently-viewed-sidebar__title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 800;
    color: var(--co-ink);
    padding: 14px 18px 12px;
    border-bottom: 1px solid var(--co-border);
    margin: 0;
    background: var(--co-surface-raised);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.recently-viewed-list  { list-style: none; margin: 0; padding: 0; }
.recently-viewed-item  { border-bottom: 1px solid var(--co-border); }
.recently-viewed-item:last-child { border-bottom: none; }

.recently-viewed-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    transition: background var(--co-duration-fast) var(--co-ease-smooth);
}

.recently-viewed-link:hover { background: var(--co-brand-alpha-10); }

.recently-viewed-img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: var(--co-radius-sm);
    flex-shrink: 0;
    border: 1px solid var(--co-border);
    background: var(--co-surface-raised);
}

.recently-viewed-info { flex: 1; min-width: 0; }

.recently-viewed-name {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--co-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
}

.recently-viewed-price {
    font-size: 13px;
    font-weight: 800;
    color: var(--co-brand);
}

/* ========================================
   DARK MODE OVERRIDES
   ======================================== */
.dark-mode .checkout-billing,
.dark-mode .checkout-card,
.dark-mode .order-summary-box,
.dark-mode .coupon-box-sidebar,
.dark-mode .recently-viewed-sidebar {
    background: var(--co-surface);
    border-color: var(--co-border);
    box-shadow: var(--co-shadow-lg);
}

.dark-mode .order-summary-title,
.dark-mode .recently-viewed-sidebar__title { background: var(--co-surface-raised); }

.dark-mode .checkout-trust-badges   { background: var(--co-surface-raised); }
.dark-mode .checkout-trust-badge    { background: var(--co-surface); border-color: var(--co-border); }
.dark-mode .checkout-progress__step-icon { background: var(--co-surface-raised); border-color: var(--co-border); }
.dark-mode .order-savings-badge     { background: rgba(5,150,105,.10); border-color: rgba(5,150,105,.20); }

/* ========================================
   FOCUS VISIBLE
   ======================================== */
:focus-visible {
    outline: 3px solid var(--co-brand);
    outline-offset: 3px;
}

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

/* ========================================
   CHECKOUT PAGE — BREADCRUMB & STEPS
   ======================================== */
.breadcrumb-bar-modern {
    background: var(--co-surface-raised);
    padding: 16px 0;
    border-bottom: 1px solid var(--co-border);
}
.breadcrumb-modern {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 14px;
}
.breadcrumb-modern__link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--co-ink-muted);
    text-decoration: none;
    transition: color var(--co-duration-base) var(--co-ease-smooth);
}
.breadcrumb-modern__link:hover { color: var(--co-brand); }
.breadcrumb-modern__sep { color: var(--co-border-strong); display: flex; }
.breadcrumb-modern__current { color: var(--co-ink); font-weight: 600; }

/* Checkout Steps */
.checkout-steps-modern {
    background: var(--co-surface);
    padding: 32px 0;
    border-bottom: 1px solid var(--co-border);
}
.checkout-steps-modern__wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 600px;
    margin: 0 auto;
}
.checkout-step-modern {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.checkout-step-modern__circle {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--co-surface-raised);
    color: var(--co-ink-placeholder);
    border-radius: var(--co-radius-full);
    font-size: 18px;
    font-weight: 700;
    transition: all var(--co-duration-base) var(--co-ease-spring);
    border: 3px solid transparent;
}
.checkout-step-modern--done .checkout-step-modern__circle {
    background: var(--co-success);
    color: #fff;
    border-color: var(--co-success);
}
.checkout-step-modern--active .checkout-step-modern__circle {
    background: var(--co-brand);
    color: #fff;
    border-color: var(--co-brand);
    box-shadow: 0 0 0 4px var(--co-brand-alpha-10);
}
.checkout-step-modern__label {
    font-size: 13px;
    font-weight: 600;
    color: var(--co-ink-muted);
    white-space: nowrap;
}
.checkout-step-modern--done .checkout-step-modern__label,
.checkout-step-modern--active .checkout-step-modern__label { color: var(--co-ink); }
.checkout-step-modern__line {
    flex: 1;
    height: 3px;
    background: var(--co-border);
    margin: 0 16px;
    max-width: 120px;
    border-radius: 2px;
    transition: background var(--co-duration-slow) var(--co-ease-smooth);
}
.checkout-step-modern__line--done { background: var(--co-success); }
@media (max-width: 768px) {
    .checkout-steps-modern { padding: 24px 0; }
    .checkout-step-modern__circle { width: 40px; height: 40px; font-size: 16px; }
    .checkout-step-modern__label { font-size: 12px; }
    .checkout-step-modern__line { margin: 0 8px; max-width: 60px; }
}