/* ============================================
   Coffee Bean Reviews - Modern Light Theme
   Color Palette (Modern Blue Highlights):
============================================ */

:root {
    --color-primary: #FFFFFF;
    --color-secondary: #E8F4F8;
    --color-accent: #2563EB;
    --color-accent-hover: #1D4ED8;
    --color-background: #F0F9FF;
    --color-surface: #FFFFFF;
    --color-text: #1E3A8A;
    --color-text-muted: #64748B;
    --color-border: #CBD5E1;
    --shadow-sm: 0 2px 8px rgba(37, 99, 235, 0.1);
    --shadow-md: 0 4px 16px rgba(37, 99, 235, 0.15);
    --shadow-lg: 0 8px 32px rgba(37, 99, 235, 0.2);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--color-background);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ============================================
   HEADER SECTION
============================================ */
.header {
    background: linear-gradient(135deg, var(--color-surface) 0%, var(--color-secondary) 100%);
    padding: 32px 20px;
    text-align: center;
    margin-bottom: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.header h1 {
    font-size: 3rem;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 12px;
}

.subtitle {
    font-size: 1.25rem;
    color: var(--color-text-muted);
}

/* ============================================
   INTRODUCTION SECTION
============================================ */
.introduction {
    background-color: var(--color-surface);
    padding: 32px 36px;
    margin-bottom: 40px;
    border-left: 6px solid var(--color-accent);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.introduction h2 {
    margin-bottom: 20px;
    color: var(--color-text);
    font-size: 2rem;
}

.introduction p {
    max-width: 1050px;
    margin-bottom: 16px;
    color: var(--color-text-muted);
}

.introduction p:last-child {
    margin-bottom: 0;
}

.introduction strong {
    color: var(--color-text);
}

/* ============================================
   FILTER SECTION
============================================ */
.filters {
    background-color: #e3ecff;
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: 48px;
}

.filter-form {
    max-width: 1000px;
    margin: 0 auto;
    display: grid;
    gap: 24px;
}

/* Filter row layout - 2 columns for filter items */
.filter-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: center;
}

/* Individual filter item width and padding */
.filter-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.filter-item label {
    font-weight: 600;
    color: var(--color-text);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-input:focus, .filter-select:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

/* Button row - each button gets full width of its cell */
.filter-buttons-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    align-items: center;
    margin-top: 0;
}

.filter-buttons-row .btn-apply {
    justify-self: center;
    width: 100%;
}

.filter-buttons-row .btn-reset {
    justify-self: center;
    width: 100%;
}

/* NOTE: responsive overrides for the filter controls live at the bottom of
   this file. They must come *after* the base rules below, otherwise equal
   specificity means the base rule wins and the mobile sizing never applies. */

.filter-item.disabled {
    opacity: 0.4;
    pointer-events: none;
}

.filter-input, .filter-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    background-color: var(--color-surface);
    color: var(--color-text);
    font-size: 0.95rem;
    transition: var(--transition);
}

.filter-input:focus, .filter-select:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.15);
}

.btn-apply {
    padding: 12px 28px;
    background-color: var(--color-accent);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-apply:hover {
    background-color: var(--color-accent-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-reset {
    padding: 12px 28px;
    background-color: transparent;
    color: var(--color-text-muted);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-reset:hover {
    border-color: var(--color-danger);
    color: var(--color-danger);
    background-color: rgba(239, 68, 68, 0.05);
}

/* ============================================
   STATS SECTION  
============================================ */
.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    margin-bottom: 48px;
}

.stat-card {
    background-color: var(--color-surface);
    padding: 32px 25px;
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-md);
}

.stat-number {
    font-size: 3rem;
    font-weight: 800;
    color: var(--color-accent);
}

.stat-label {
    margin-top: 12px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

/* ============================================
   REVIEWS SECTION
============================================ */
.reviews-section {
    min-height: 60vh;
}

.loading-spinner, .hidden {
    display: none !important;
}

.error-container {
    background-color: rgba(239, 68, 68, 0.1);
    border: 2px solid #EF4444;
    color: #EF4444;
    padding: 15px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    text-align: center;
}

.error-container strong {
    display: block;
    margin-bottom: 8px;
}

/* No Results State */
.no-results {
    text-align: center;
    padding: 60px 20px;
    background-color: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.no-results p {
    font-size: 1.2rem;
    color: var(--color-text-muted);
    margin-bottom: 24px;
}

/* Results Count */
.results-count {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 24px;
    padding: 16px 20px;
    background-color: var(--color-secondary);
    border-radius: var(--radius-md);
}

/* Review Grid */
.reviews-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 28px;
}

/* Review Card */
.review-card {
    background-color: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border-top: 4px solid var(--color-accent);
}

.review-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-md);
}

/* Review Header */
.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--color-border);
}

.review-brand {
    font-size: 0.8rem;
    color: var(--color-accent);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-weight: 700;
}

.review-date {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

/* Review Name */
.review-name {
    font-size: 1.35rem;
    color: var(--color-text);
    margin-bottom: 12px;
    font-weight: 700;
    line-height: 1.3;
}

/* Origin Badge */
.origin-badge {
    display: inline-block;
    background-color: rgba(37, 99, 235, 0.1);
    color: var(--color-accent);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 14px;
}

/* Overall Rating */
.overall-rating {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding: 12px 14px;
    background-color: rgba(37, 99, 235, 0.05);
    border-radius: var(--radius-md);
}

.overall-rating span {
    font-size: 1.2rem;
    font-weight: 600;
}

/* Review Attributes */
.review-attributes {
    width: 100%;
    margin-bottom: 16px;
}

.attributes-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 0.85rem;
}

.attributes-table tr {
    border-bottom: 1px solid var(--color-border);
}

.attributes-table tr:last-child {
    border-bottom: none;
}

.attributes-table th,
.attributes-table td {
    padding: 10px 8px;
    text-align: left;
    vertical-align: top;
}

.attributes-table th {
    width: 34%;
    font-weight: 600;
    color: var(--color-text-muted);
}

.attributes-table td {
    color: var(--color-text);
    overflow-wrap: anywhere;
}

.rating-bar-container {
    display: inline-block;
    width: calc(100% - 42px);
    background-color: rgba(37, 99, 235, 0.1);
    border-radius: 4px;
    height: 6px;
    overflow: hidden;
    min-width: 40px;
}

.rating-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--color-accent), #60A5FA);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.rating-value {
    display: inline-block;
    font-weight: 700;
    font-size: 1rem;
    color: var(--color-text);
    margin-left: 6px;
}

/* Rating Color Classes */
.rating-5-6 { color: #EF4444; }    /* Red - Lower quality */
.rating-7 { color: #3B82F6; }      /* Blue - Good */
.rating-8 { color: #60A5FA; }      /* Light Blue - Very Good */
.rating-9 { color: #3B82F6; }      /* Blue - Excellent */
.rating-10 { color: #2563EB; text-shadow: 0 0 8px rgba(37, 99, 235, 0.4); }    /* Dark Blue - Perfect */

/* ============================================
   NO RESULTS MESSAGE
============================================ */
.no-results {
    text-align: center;
    padding: 60px 20px;
}

.no-results p {
    font-size: 1.3rem;
    color: var(--color-text-muted);
    margin-bottom: 24px;
}

.browse-all-btn {
    padding: 14px 32px;
    background-color: var(--color-accent);
    border: 2px solid rgba(37, 99, 235, 0.3);
    border-radius: var(--radius-md);
    color: white;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.browse-all-btn:hover {
    background-color: #3B82F6;
    border-color: var(--color-accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ============================================
   FOOTER
============================================ */
.footer {
    text-align: center;
    padding: 30px 20px;
    margin-top: auto;
    color: var(--color-text-muted);
    font-size: 0.9rem;
    border-top: 1px solid rgba(245, 230, 211, 0.1);
}

/* ============================================
   SPINNER / LOADING ANIMATION
   ============================================ */
.spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 40px 20px;
    color: var(--color-text-muted);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(245, 230, 211, 0.1);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   RESPONSIVE DESIGN
============================================ */
@media (max-width: 768px) {
    .header {
        padding: 40px 15px;
    }

    .header h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1.1rem;
    }

    .filters-row {
        grid-template-columns: 1fr;
    }

    .reviews-grid {
        grid-template-columns: 1fr;
    }

    .stats-section {
        grid-template-columns: 1fr;
    }

    .stat-number {
        font-size: 2.5rem;
    }

    .attributes-table th,
    .attributes-table td {
        padding: 8px 6px;
    }

    .rating-bar-container {
        min-width: 35px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }

    .header h1 {
        font-size: 1.6rem;
    }

    .review-card {
        padding: 20px;
    }

    .review-name {
        font-size: 1.15rem;
    }

    .stat-number {
        font-size: 2rem;
    }
}

/* ============================================
   UTILITIES & ANIMATIONS
============================================ */
.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.review-card {
    animation: fadeIn 0.4s ease forwards;
}

/* ============================================
   RESPONSIVE FILTER LAYOUT
   Kept last so these overrides beat the base filter rules earlier in the file.
   ============================================ */

/* Stack all elements vertically when viewport is too narrow */
@media (max-width: 1200px) {
    .filter-row {
        gap: 14px;
    }
}

@media (max-width: 950px) {
    .filter-row,
    .filter-buttons-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* Filter items maintain their order */
    .brand-filter,
    .origin-filter {
        order: 1;
    }
}

@media (max-width: 600px) {
    .filter-row,
    .filter-buttons-row {
        gap: 16px;
    }

    .filter-item label {
        font-size: 0.7rem;
    }

    .filter-input,
    .filter-select {
        padding: 8px 12px;
        font-size: 0.85rem;
    }

    .btn-apply,
    .btn-reset {
        padding: 10px 20px;
        font-size: 0.85rem;
    }
}
