﻿/* ==========================================================================
   1. DESIGN TOKENS (:ROOT VARIABLES) - WCAG AAA COMPLIANT
   ========================================================================== */
:root {
    /* Brand Themes - AAA > 7:1 Contrast */
    --brand-vitalsource: #24386e;
    --brand-redshelf: #9e0b1f;
    --brand-cei: #304f6a;
    /* Base Colors */
    --bg-page: #f4f6f9;
    --bg-card: #ffffff;
    --bg-subtle: #f8fafc;
    /* Text Colors - AAA > 7:1 Contrast */
    --text-main: #1e293b;
    --text-heading: #0f172a;
    --text-muted: #334155;
    --border-light: #e2e8f0;
    /* Interactive Elements */
    --color-link: #113285;
    --color-link-hover: #0b2159;
    --color-focus: #113285;
    /* Copy Button Success State */
    --success-bg: #d4edda;
    --success-border: #c3e6cb;
    --success-text: #092e0f;
    /* Layout, Spacing, and Curves */
    --container-max: 800px;
    --radius-card: 12px;
    --radius-btn: 6px;
    /* Elevation Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    /* Typography */
    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* ==========================================================================
   2. GLOBAL BASE (MOBILE FIRST)
   ========================================================================== */
body {
    font-family: var(--font-sans);
    background-color: var(--bg-page);
    color: var(--text-main);
    margin: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Container fluidly adapts, keeping padding tight on mobile */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 16px;
    box-sizing: border-box; /* Ensures padding doesn't break widths */
}

.page-main {
    padding-top: 16px;
    padding-bottom: 32px;
}

/* Accessible Focus Outlines */
a:focus-visible,
button:focus-visible {
    outline: 3px solid var(--color-focus);
    outline-offset: 3px;
    border-radius: var(--radius-btn);
}

.page-title {
    font-size: 1.75rem; /* Smaller for mobile */
    font-weight: 800;
    color: var(--text-heading);
    margin-top: 0;
    margin-bottom: 8px;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.lead {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 24px;
}

a {
    color: var(--color-link);
    text-decoration: underline;
    text-underline-offset: 3px;
    font-weight: 500;
    transition: color 0.15s ease;
    word-break: break-word; /* Prevents long URLs from breaking mobile layouts */
}

    a:hover {
        color: var(--color-link-hover);
    }

/* ==========================================================================
   3. PANELS & CARDS
   ========================================================================== */
.panel {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    overflow: hidden;
    margin-bottom: 24px;
}

.panel-heading {
    padding: 16px;
}

.brand-title {
    margin: 0;
    font-size: 1.25rem; /* Scaled for mobile */
    line-height: 1.4;
    font-weight: 600;
}

.panel-body {
    padding: 16px;
}

.panel-heading-sub {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-main);
    background-color: var(--bg-subtle);
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
}

.panel-footer {
    padding: 16px;
    background-color: var(--bg-subtle);
    border-top: 1px solid var(--border-light);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ==========================================================================
   4. INSTRUCTIONS & REDEMPTION LISTS
   ========================================================================== */
.instruction-list {
    padding-left: 20px;
    margin: 8px 0 16px 0;
}

    .instruction-list li {
        margin-bottom: 12px;
    }

.instruction-note {
    font-style: italic;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0;
}

.list-group {
    list-style: none;
    padding: 0;
    margin: 0;
}

.list-group-item {
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
    background-color: var(--bg-card);
}

    .list-group-item:last-child {
        border-bottom: none;
    }

/* Mobile: Stack items vertically */
.redemption-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

/* ==========================================================================
   5. INTERACTIVE BUTTONS & BADGES
   ========================================================================== */
.btn-copy {
    font-family: inherit;
    font-size: 1rem;
    letter-spacing: 0.05em;
    padding: 10px 16px; /* Increased padding for minimum 44px touch target height */
    border-radius: var(--radius-btn);
    cursor: pointer;
    background: var(--bg-subtle);
    border: 1px solid var(--border-light);
    color: var(--text-heading);
    box-shadow: var(--shadow-sm);
    transition: transform 0.1s ease, background-color 0.2s ease, border-color 0.2s ease;
    width: 100%; /* Full width buttons on mobile */
    text-align: center;
}

    .btn-copy:active {
        transform: translateY(2px);
    }

    .btn-copy.is-copied {
        background-color: var(--success-bg) !important;
        border-color: var(--success-border) !important;
        color: var(--success-text) !important;
    }

.badge-status {
    background-color: var(--bg-page);
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: var(--radius-btn);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid var(--border-light);
}

    .badge-status:empty {
        display: none;
    }

    .book-details {
        color: var(--text-muted);
        font-size: 0.95rem;
        line-height: 1.4;
    }

/* ==========================================================================
   6. PROVIDER THEMES
   ========================================================================== */
.panel-vitalsource .panel-heading-brand {
    background-color: var(--brand-vitalsource);
    color: var(--bg-card);
}

.panel-vitalsource .btn-copy {
    border-color: var(--brand-vitalsource);
    background-color: #f0f4f8;
}

.panel-redshelf .panel-heading-brand {
    background-color: var(--brand-redshelf);
    color: var(--bg-card);
}

.panel-redshelf .btn-copy {
    border-color: var(--brand-redshelf);
    background-color: #fbf0f1;
}

.panel-cei .panel-heading-brand {
    background-color: var(--brand-cei);
    color: var(--bg-card);
}

.panel-cei .btn-copy {
    border-color: var(--brand-cei);
    background-color: #f0f4f8;
}

/* ==========================================================================
   7. ERROR COMPONENT
   ========================================================================== */
.alert-error-container {
    text-align: center;
    padding: 32px 16px;
    background: var(--bg-card);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    border-top: 4px solid var(--brand-redshelf);
}

.error-title {
    color: var(--brand-redshelf);
    margin-top: 0;
    font-size: 1.5rem;
}

/* ==========================================================================
   8. ACCESSIBILITY UTILITIES
   ========================================================================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   9. MEDIA QUERIES (TABLET & DESKTOP OVERRIDES)
   ========================================================================== */

/* TABLET (768px and up) */
@media (min-width: 768px) {
    .container {
        padding: 24px;
    }

    .page-title {
        font-size: 2.25rem;
    }

    .lead {
        font-size: 1.125rem;
    }

    .brand-title {
        font-size: 1.5rem;
    }

    .panel {
        margin-bottom: 32px;
    }

    .panel-heading,
    .panel-body,
    .panel-footer,
    .list-group-item {
        padding: 24px;
    }

    /* Move from vertical stack to horizontal layout */
    .redemption-item {
        flex-direction: row;
        align-items: center;
    }

    /* Buttons go back to auto-width instead of 100% block */
    .btn-copy {
        width: auto;
    }

        .btn-copy:hover {
            transform: translateY(-1px);
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        }

    .error-title {
        font-size: 2rem;
    }
}

/* DESKTOP (1024px and up) */
@media (min-width: 1024px) {
    .page-main {
        padding-top: 32px;
        padding-bottom: 48px;
    }

    .page-title {
        font-size: 2.5rem;
    }
}
