/* Optiformis Wine Catalogue - Premium Burgundy/Gold Dark Theme
   UK English | Premium Dark Design | Burgundy #722F37 / Gold #D4AF37
*/

/* ============================================
   CSS VARIABLES - Burgundy/Gold Theme
   ============================================ */
:root {
    /* Brand Colours */
    --burgundy-primary: #722F37;
    --burgundy-dark: #4A1F24;
    --burgundy-light: #8B3A42;
    --gold-accent: #D4AF37;
    --gold-light: #E8C967;
    --gold-dark: #B8942E;
    
    /* Background Shades */
    --bg-darkest: #0D0A0B;
    --bg-dark: #1A1416;
    --bg-card: #241C1E;
    --bg-elevated: #2E2427;
    
    /* Text Colours */
    --text-primary: #F5F0E8;
    --text-secondary: #B8A99A;
    --text-muted: #7A6B5E;
    
    /* Functional Colours */
    --success: #4A7C59;
    --warning: #C9A227;
    --danger: #A63D40;
    --info: #5A7D8C;
    
    /* Spacing & Sizing */
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --border-radius-sm: 4px;
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(212, 175, 55, 0.15);
}

/* ============================================
   BASE STYLES
   ============================================ */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-darkest);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 0;
    line-height: 1.3;
}

h1 { font-size: 2.5rem; letter-spacing: -0.02em; }
h2 { font-size: 2rem; letter-spacing: -0.01em; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

a {
    color: var(--gold-accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--gold-light);
}

/* ============================================
   HEADER & NAVIGATION
   ============================================ */
header {
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--burgundy-dark) 100%);
    border-bottom: 1px solid rgba(212, 175, 55, 0.2);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
}

.logo a {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gold-accent);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    text-shadow: 0 0 20px rgba(212, 175, 55, 0.3);
}

.logo a:hover {
    color: var(--gold-light);
}

.nav-links {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 2rem;
}

.nav-links li a {
    color: var(--text-secondary);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
    position: relative;
}

.nav-links li a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--gold-accent);
    transition: all var(--transition-normal);
    transform: translateX(-50%);
}

.nav-links li a:hover,
.nav-links li a.active {
    color: var(--gold-accent);
}

.nav-links li a:hover::after,
.nav-links li a.active::after {
    width: 80%;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    min-height: calc(100vh - 200px);
}

/* ============================================
   CATALOGUE HEADER SECTION
   ============================================ */
.catalogue-header {
    text-align: center;
    padding: 4rem 2rem;
    background: linear-gradient(180deg, rgba(114, 47, 55, 0.15) 0%, transparent 100%);
    border-radius: var(--border-radius-lg);
    margin-bottom: 3rem;
    position: relative;
    overflow: hidden;
}

.catalogue-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at center top, rgba(212, 175, 55, 0.08) 0%, transparent 60%);
    pointer-events: none;
}

.catalogue-header h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--gold-accent) 0%, var(--gold-light) 50%, var(--gold-accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.catalogue-header p {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin: 0;
}

/* ============================================
   FILTERS SECTION
   ============================================ */
.filters {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
    border: 1px solid rgba(212, 175, 55, 0.1);
    box-shadow: var(--shadow-sm);
}

.filters form {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.filters select,
.filters input[type="text"] {
    flex: 1;
    min-width: 200px;
    padding: 0.75rem 1rem;
    background: var(--bg-dark);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.filters select:focus,
.filters input[type="text"]:focus {
    outline: none;
    border-color: var(--gold-accent);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.filters select option {
    background: var(--bg-dark);
    color: var(--text-primary);
}

.filters button[type="submit"] {
    padding: 0.75rem 2rem;
    background: linear-gradient(135deg, var(--burgundy-primary) 0%, var(--burgundy-dark) 100%);
    color: var(--gold-accent);
    border: 1px solid var(--gold-accent);
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.filters button[type="submit"]:hover {
    background: linear-gradient(135deg, var(--burgundy-light) 0%, var(--burgundy-primary) 100%);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

/* ============================================
   PRODUCT GRID
   ============================================ */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

/* ============================================
   PRODUCT CARD
   ============================================ */
.product-card {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    border: 1px solid rgba(212, 175, 55, 0.1);
    transition: all var(--transition-normal);
    position: relative;
}

.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--burgundy-primary), var(--gold-accent), var(--burgundy-primary));
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    border-color: rgba(212, 175, 55, 0.3);
}

.product-card:hover::before {
    opacity: 1;
}

.product-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-bottom: 1px solid rgba(212, 175, 55, 0.1);
    transition: transform var(--transition-slow);
}

.product-card:hover img {
    transform: scale(1.05);
}

.product-card h3 {
    padding: 1.25rem 1.25rem 0.5rem;
    font-size: 1.2rem;
    margin: 0;
    color: var(--text-primary);
}

.product-card .category {
    padding: 0 1.25rem;
    font-size: 0.875rem;
    color: var(--gold-accent);
    margin: 0;
}

.product-card .price {
    padding: 0.5rem 1.25rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gold-light);
    margin: 0;
}

.product-card .rating {
    padding: 0 1.25rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.product-card .btn-secondary {
    display: block;
    margin: 1rem 1.25rem 1.25rem;
    padding: 0.75rem 1.5rem;
    background: transparent;
    color: var(--gold-accent);
    border: 1px solid var(--gold-accent);
    border-radius: var(--border-radius);
    text-align: center;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.product-card .btn-secondary:hover {
    background: var(--gold-accent);
    color: var(--bg-darkest);
    box-shadow: var(--shadow-glow);
}

/* ============================================
   NO PRODUCTS MESSAGE
   ============================================ */
.no-products {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
    font-size: 1.2rem;
    grid-column: 1 / -1;
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 3rem;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    height: 44px;
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    font-weight: 500;
    transition: all var(--transition-fast);
}

.pagination a:hover {
    background: var(--bg-elevated);
    border-color: var(--gold-accent);
    color: var(--gold-accent);
}

.pagination .current {
    background: linear-gradient(135deg, var(--burgundy-primary) 0%, var(--burgundy-dark) 100%);
    border-color: var(--gold-accent);
    color: var(--gold-accent);
    font-weight: 700;
}

.pagination .ellipsis {
    border: none;
    background: transparent;
    color: var(--text-muted);
}

/* ============================================
   PRODUCT DETAIL PAGE
   ============================================ */
.product-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    padding: 2rem 0;
}

.product-image {
    position: relative;
}

.product-image img {
    width: 100%;
    border-radius: var(--border-radius-lg);
    border: 1px solid rgba(212, 175, 55, 0.2);
    box-shadow: var(--shadow-lg);
}

.product-info h1 {
    margin-bottom: 0.5rem;
    font-size: 2.5rem;
}

.product-info .category {
    color: var(--gold-accent);
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

.product-info .price {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gold-light);
    margin: 1rem 0;
}

.product-info .rating {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.product-info .description {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border-left: 3px solid var(--gold-accent);
}

.product-info form {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.product-info label {
    color: var(--text-secondary);
    font-weight: 500;
}

.product-info input[type="number"] {
    width: 80px;
    padding: 0.75rem;
    background: var(--bg-dark);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    font-size: 1rem;
    text-align: center;
}

.product-info .stock {
    font-size: 0.95rem;
    color: var(--success);
}

.product-info .stock.out-of-stock {
    color: var(--danger);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-primary {
    padding: 0.875rem 2rem;
    background: linear-gradient(135deg, var(--burgundy-primary) 0%, var(--burgundy-dark) 100%);
    color: var(--gold-accent);
    border: 1px solid var(--gold-accent);
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--burgundy-light) 0%, var(--burgundy-primary) 100%);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.btn-secondary {
    padding: 0.75rem 1.5rem;
    background: transparent;
    color: var(--gold-accent);
    border: 1px solid var(--gold-accent);
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-secondary:hover {
    background: var(--gold-accent);
    color: var(--bg-darkest);
}

/* ============================================
   REVIEWS SECTION
   ============================================ */
.reviews {
    margin-top: 4rem;
    padding-top: 3rem;
    border-top: 1px solid rgba(212, 175, 55, 0.1);
}

.reviews h2 {
    margin-bottom: 2rem;
    color: var(--gold-accent);
}

.review-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.review-item {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    border: 1px solid rgba(212, 175, 55, 0.1);
}

.review-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.review-author {
    font-weight: 600;
    color: var(--text-primary);
}

.review-rating {
    color: var(--gold-accent);
    font-weight: 500;
}

.review-date {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.review-text {
    color: var(--text-secondary);
    line-height: 1.7;
    margin: 0;
}

.review-form-link {
    margin-top: 2rem;
}

/* ============================================
   FOOTER
   ============================================ */
footer {
    background: var(--bg-dark);
    border-top: 1px solid rgba(212, 175, 55, 0.1);
    padding: 3rem 2rem;
    text-align: center;
    margin-top: 4rem;
}

footer p {
    margin: 0;
    color: var(--text-muted);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    min-width: 300px;
    padding: 1rem 1.5rem;
    background: var(--bg-elevated);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--gold-accent);
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease forwards;
    color: var(--text-primary);
}

.toast.success {
    border-left-color: var(--success);
}

.toast.error {
    border-left-color: var(--danger);
}

.toast.warning {
    border-left-color: var(--warning);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ============================================
   LOADING INDICATOR
   ============================================ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(13, 10, 11, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    backdrop-filter: blur(4px);
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 3px solid rgba(212, 175, 55, 0.1);
    border-top-color: var(--gold-accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ============================================
   FAVOURITE BUTTON
   ============================================ */
.favorite-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--text-muted);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.favorite-btn:hover {
    border-color: var(--danger);
    color: var(--danger);
}

.favorite-btn.favorited {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

/* ============================================
   RATING STARS
   ============================================ */
.rating-stars {
    display: inline-flex;
    gap: 2px;
}

.rating-stars .star {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.rating-stars .star.filled {
    color: var(--gold-accent);
}

.rating-stars .star.half {
    background: linear-gradient(90deg, var(--gold-accent) 50%, var(--text-muted) 50%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 1024px) {
    .product-detail {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .product-info h1 {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    nav {
        flex-direction: column;
        padding: 1rem;
    }
    
    .nav-links {
        margin-top: 1rem;
        gap: 1rem;
    }
    
    main {
        padding: 1rem;
    }
    
    .catalogue-header {
        padding: 2rem 1rem;
    }
    
    .catalogue-header h1 {
        font-size: 2rem;
    }
    
    .filters form {
        flex-direction: column;
    }
    
    .filters select,
    .filters input[type="text"] {
        width: 100%;
        min-width: unset;
    }
    
    .product-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .pagination {
        gap: 0.375rem;
    }
    
    .pagination a,
    .pagination span {
        min-width: 40px;
        height: 40px;
        padding: 0.375rem 0.75rem;
    }
}

@media (max-width: 480px) {
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    
    .product-info .price {
        font-size: 1.5rem;
    }
    
    .toast-container {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
    }
    
    .toast {
        min-width: unset;
        width: 100%;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    body {
        background: white !important;
        color: black !important;
    }
    
    header, footer, .filters, .btn-secondary, .favorite-btn {
        display: none !important;
    }
    
    .product-card {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #ddd;
    }
    
    .product-detail {
        grid-template-columns: 1fr;
    }
}

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

:focus-visible {
    outline: 2px solid var(--gold-accent);
    outline-offset: 2px;
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--burgundy-primary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--burgundy-light);
}

/* ============================================
   SELECTION STYLING
   ============================================ */
::selection {
    background: rgba(212, 175, 55, 0.3);
    color: var(--text-primary);
}
