/* ReceiptWave — Mobile-first receipt viewer styles */
/* FIX 10: Sora + Inter instead of DM Sans */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

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

body {
    /* FIX 11: Inter body font, FIX 12: #F8FAFC bg, FIX 13: #1E293B text */
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #F8FAFC;
    color: #1E293B;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Headings use Sora */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Sora', sans-serif;
    font-weight: 800;
    color: #1B2A4A;
}

/* Layout containers */
.receipt-container {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px;
    min-height: 100vh;
}

.landing-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
    min-height: 100vh;
}

/* Receipt card — FIX 19: 16px radius, FIX 20: border */
.receipt {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #E2E8F0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 24px;
    margin-top: 16px;
}

/* Header */
.receipt-header {
    text-align: center;
    margin-bottom: 20px;
}

.business-logo {
    margin-bottom: 12px;
}

.logo-placeholder {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #2EBFA5;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
}

/* FIX 14: navy colour */
.business-name {
    font-size: 16px;
    font-weight: 600;
    color: #1B2A4A;
    margin-bottom: 4px;
}

/* FIX 16: slate colour */
.store-name {
    font-size: 14px;
    color: #94A3B8;
}

/* Meta info rows — FIX 15: 14px min */
.receipt-meta {
    margin-bottom: 16px;
}

.meta-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 14px;
}

/* FIX 16: slate colour */
.meta-label {
    color: #94A3B8;
}

.meta-value {
    color: #1E293B;
    font-weight: 500;
}

/* Divider — FIX 21: brand border */
.divider {
    border: none;
    border-top: 1px dashed #E2E8F0;
    margin: 16px 0;
}

/* Line items — FIX 15: 14px min */
.line-items {
    margin-bottom: 8px;
}

.line-item {
    display: grid;
    grid-template-columns: 2fr 0.5fr 1fr 1fr;
    gap: 8px;
    padding: 6px 0;
    font-size: 14px;
    align-items: center;
}

.line-item.header {
    font-weight: 600;
    color: #94A3B8;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #E2E8F0;
    padding-bottom: 8px;
    margin-bottom: 4px;
}

.item-qty,
.item-price,
.item-total {
    text-align: right;
}

.item-name {
    word-break: break-word;
}

/* Totals */
.totals {
    margin-bottom: 8px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 14px;
}

/* FIX 17: navy border + colour */
.grand-total {
    font-family: 'Sora', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: #1B2A4A;
    padding: 12px 0 8px;
    border-top: 2px solid #1B2A4A;
    margin-top: 8px;
}

/* Payment info */
.payment-info {
    margin-bottom: 16px;
}

.payment-method {
    background: rgba(34, 197, 94, 0.10);
    color: #22C55E;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

/* Actions */
.receipt-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

/* Buttons — FIX 18: 10px radius */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: #2EBFA5;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background 0.2s;
    flex: 1;
    min-height: 44px;
}

.btn:hover {
    background: #26a692;
}

.btn-secondary {
    background: transparent;
    color: #1B2A4A;
    border: 1.5px solid #E2E8F0;
}

.btn-secondary:hover {
    background: #F8FAFC;
    border-color: #2EBFA5;
}

.btn-large {
    padding: 14px 32px;
    font-size: 16px;
    width: 100%;
}

/* Branding */
.branding {
    text-align: center;
    padding: 20px 0 8px;
    font-size: 12px;
    color: #94A3B8;
}

.branding strong {
    color: #2EBFA5;
}

.tagline {
    font-size: 12px;
    margin-top: 2px;
}

/* Logo images */
.rw-logo-hero {
    text-align: center;
    margin-bottom: 8px;
}

.rw-logo-hero .rw-logo-img {
    height: 48px;
    display: inline-block;
}

.rw-footer-logo {
    height: 24px;
    display: inline-block;
    opacity: 0.6;
}

/* Error page */
.error-page {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #E2E8F0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 32px 24px;
    margin-top: 40px;
    text-align: center;
}

.error-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.error-page h1 {
    font-size: 22px;
    margin-bottom: 12px;
    color: #1B2A4A;
}

.error-message {
    font-size: 15px;
    color: #94A3B8;
    margin-bottom: 20px;
}

.error-details {
    background: #F8FAFC;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 24px;
    font-size: 14px;
    color: #1E293B;
    text-align: left;
}

.error-details p {
    margin-bottom: 8px;
}

.error-details p:last-child {
    margin-bottom: 0;
}

/* Claim form page */
.claim-page {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #E2E8F0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 32px 24px;
    margin-top: 40px;
    text-align: center;
}

.claim-page h1 {
    font-size: 22px;
    margin-bottom: 8px;
}

.claim-page > p {
    color: #94A3B8;
    margin-bottom: 24px;
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #1E293B;
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    font-size: 18px;
    border: 2px solid #E2E8F0;
    border-radius: 10px;
    text-align: center;
    letter-spacing: 2px;
    text-transform: uppercase;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #2EBFA5;
    box-shadow: 0 0 0 3px rgba(46, 191, 165, 0.15);
}

.validation-error {
    display: block;
    color: #EF4444;
    font-size: 14px;
    margin-top: 6px;
}

.claim-help {
    margin-top: 24px;
    font-size: 14px;
    color: #94A3B8;
}

.claim-help p {
    margin-bottom: 4px;
}

/* Landing page */
.landing-hero {
    text-align: center;
    padding: 48px 0 24px;
}

.landing-hero h1 {
    font-size: 32px;
    color: #2EBFA5;
    margin-bottom: 8px;
}

.hero-tagline {
    font-size: 16px;
    color: #94A3B8;
}

.landing-content {
    margin-top: 24px;
}

.feature-list {
    margin-bottom: 32px;
}

.feature {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #E2E8F0;
    padding: 20px;
    margin-bottom: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.feature h3 {
    font-size: 16px;
    margin-bottom: 6px;
    color: #1B2A4A;
}

.feature p {
    font-size: 14px;
    color: #94A3B8;
}

.cta-section {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #E2E8F0;
    padding: 24px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.cta-section h2 {
    font-size: 20px;
    margin-bottom: 8px;
}

.cta-section p {
    font-size: 14px;
    color: #94A3B8;
    margin-bottom: 16px;
}

/* Wallet buttons — FIX 22: navy not black */
.wallet-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.wallet-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.2s;
    flex: 1;
    min-height: 44px;
}

.wallet-btn:hover {
    opacity: 0.85;
}

.wallet-btn-apple {
    background: #1B2A4A;
}

.wallet-btn-google {
    background: #1a73e8;
}

/* App download banner */
.app-banner {
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
    text-align: center;
}

.app-banner-text {
    margin-bottom: 12px;
}

.app-banner-text strong {
    display: block;
    font-size: 15px;
    color: #1B2A4A;
    margin-bottom: 4px;
}

.app-banner-text p {
    font-size: 14px;
    color: #94A3B8;
    margin: 0;
}

.app-banner-badges {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.store-badge {
    display: inline-block;
    text-decoration: none;
}

.store-badge img {
    height: 40px;
    border-radius: 10px;
}

.store-badge-text {
    display: inline-block;
    background: #1B2A4A;
    color: #fff;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
}

/* Print styles */
@media print {
    body {
        background: #fff;
    }

    .receipt-container {
        max-width: 100%;
        padding: 0;
    }

    .receipt {
        box-shadow: none;
        border-radius: 0;
        border: none;
        padding: 16px;
    }

    .no-print {
        display: none !important;
    }

    .branding {
        display: none;
    }

    .logo-placeholder {
        background: #1B2A4A !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* Tab switcher */
.receipt-tabs {
    display: flex;
    border-bottom: 2px solid #E2E8F0;
    margin-bottom: 16px;
}

.receipt-tabs .tab {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: none;
    font-size: 16px;
    font-weight: 500;
    color: #94A3B8;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
}

.receipt-tabs .tab.active {
    color: #2EBFA5;
    border-bottom-color: #2EBFA5;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Original receipt image */
.receipt-image {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    display: block;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.save-hint {
    text-align: center;
    margin-top: 12px;
    color: #94A3B8;
    font-size: 14px;
}

.original-receipt {
    padding: 16px 0;
}

/* Styled receipt text fallback — FIX 21: 14px min */
.receipt-text-view {
    margin: 0 auto;
    max-width: 320px;
    background: #fffef9;
    border: 1px solid #E2E8F0;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    padding: 20px 16px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    white-space: pre;
    overflow-x: auto;
    color: #1E293B;
}

/* Sticky footer layout */
html, body { height: 100%; margin: 0; }
.receipt-container { display: flex; flex-direction: column; min-height: 100vh; }
.receipt-scroll-zone { flex: 1; overflow-y: auto; min-height: 0; }
.receipt-footer-zone {
  flex-shrink: 0;
  background: #F8FAFC;
  border-top: 1px solid #E2E8F0;
  padding-bottom: env(safe-area-inset-bottom);
}

/* Redesign: clean receipt wrapper */
.receipt { border: none; box-shadow: none; padding: 0; margin-top: 0; border-radius: 16px; overflow: hidden; background: white; }

/* Line items — 3 column flex */
.line-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; font-size: 14px; }
.line-item.header { display: none !important; }
.item-name { flex: 1; color: #1E293B; font-size: 14px; }
.item-qty { color: #94A3B8; margin: 0 12px; font-size: 13px; font-weight: 500; }
.item-total { color: #1E293B; font-weight: 500; font-size: 14px; }

/* Totals */
.total-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; }
.grand-total { display: flex; justify-content: space-between; border-top: none; padding: 10px 0 8px; font-size: 18px; font-weight: 800; color: #1B2A4A; font-family: 'Sora', sans-serif; }
.total-divider { border: none; border-top: 2px solid #1B2A4A; margin: 8px 0; }

/* Hide tab switcher */
.receipt-tabs { display: none !important; }

/* Footer zone white bg */
.receipt-footer-zone { background: white; }

/* Responsive */
@media (min-width: 768px) {
    .receipt-container {
        padding: 32px;
        margin-top: 24px;
    }

    .receipt {
        padding: 32px;
    }
}
