/* Global Reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-color: #f5f5f5;
    opacity: 1;
    pointer-events: none;
    z-index: 3000;
    transition: opacity 180ms ease;
}

body.page-ready::before {
    opacity: 0;
}

h1, h2, h3, h4, h5, h6 {
    margin-bottom: 0.5rem;
    font-weight: 600;
}

ul {
    list-style: none;
    padding: 0;
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    display: block;
}

/* Header Areas */
/* Sticky Wrapper */
.sticky-top {
    position: sticky;
    top: 0;
    z-index: 1000;
}

/* Background layer for Header - Sits between Content and Cart Panel */
.sticky-top::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #fff;
    /* Removed border and shadow to seamless blend with cart panel */
    z-index: -1; /* Behind content (auto/0), but above Cart Panel (-2) */
}

/* Site Header (Top Bar) layout */
.sticky-top header {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 1.25rem;
    gap: 1.4rem;
    flex-wrap: nowrap;
    border-bottom: none; /* Moved to ::before */
    height: 68px; /* Explicit height for hit area consistency */
    
    background-color: transparent; /* Transparent so ::before BG shows through */
    position: relative;
    z-index: auto; /* Let content sit naturally in stacking context */
    box-shadow: none; /* Moved to ::before */
}

.sticky-top header > section {
    margin: 0;
    display: flex;
    align-items: center;
}

/* Logo */
.sticky-top header h1 {
    margin: 0;
    font-size: 1.5rem;
    color: #cf0a2c;
    flex-shrink: 0;
    font-weight: 600;
}

/* Search Bar (Restored Style) */
.sticky-top header form {
    display: flex;
    margin-right: 0;
}

.sticky-top header .site-search {
    display: flex;
    align-items: stretch;
    margin-right: 0;
    width: clamp(6.2rem, 8vw, 6.8rem);
    overflow: hidden;
    border: 1px solid #c8ced6;
    border-radius: 999px;
    background: #e5e7e9;
}

.sticky-top header input[type="search"] {
    flex: 1;
    padding: 0.45rem 0.7rem;
    border: none;
    border-radius: 999px;
    outline: none;
    width: auto;
    min-width: 0;
    background: transparent;
    color: #333;
    text-align: center;
}

/* User Tools Nav */
.sticky-top header nav ul {
    display: flex;
    gap: 0;
    padding: 0;
    margin: 0;
    align-items: center; /* Ensure vertical centering */
}

.sticky-top header .user-tools {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    margin-left: 0;
    flex-wrap: wrap;
}

.sticky-top header #auth-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 70px;
    font-size: 0.9rem;
    color: #666;
    position: relative;
}

.sticky-top header #auth-nav .auth-nav-shell {
    position: relative;
    display: flex;
    align-items: stretch;
    justify-content: center;
    height: 70px;
}

.sticky-top header #auth-nav .auth-nav-shell::after {
    content: "";
    position: absolute;
    left: 50%;
    top: calc(100% - 0.2rem);
    width: 100%;
    height: 0.4rem;
    transform: translateX(-50%);
}

.sticky-top header #auth-nav .auth-label {
    color: #333;
    font-weight: 600;
    white-space: nowrap;
    font-size: 0.9rem;
}

.sticky-top header #auth-nav .auth-nav-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 0;
    padding: 0 0.9rem;
    min-height: 70px;
    cursor: pointer;
    font: inherit;
    color: #333;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
}

.sticky-top header #auth-nav .auth-nav-trigger:hover,
.sticky-top header #auth-nav .auth-nav-trigger:focus-visible {
    background: rgba(0, 0, 0, 0.02);
    border-color: transparent;
    outline: none;
}

.sticky-top header #auth-nav .auth-nav-menu {
    position: absolute;
    left: 50%;
    top: calc(100% - 0.45rem);
    width: fit-content;
    min-width: max-content;
    padding: 0.25rem;
    border-radius: 14px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: #fff;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate(-50%, -4px);
    transition: opacity 0.16s ease, transform 0.16s ease, visibility 0.16s ease;
    z-index: 1200;
}

.sticky-top header #auth-nav .auth-nav-shell:hover .auth-nav-menu,
.sticky-top header #auth-nav .auth-nav-shell:focus-within .auth-nav-menu,
.sticky-top header #auth-nav .auth-nav-shell.is-open .auth-nav-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate(-50%, 0);
}

.sticky-top header #auth-nav .auth-nav-menu a,
.sticky-top header #auth-nav .auth-nav-menu button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 36px;
    padding: 0.55rem 0.8rem;
    border: none;
    background: transparent;
    border-radius: 10px;
    color: #333;
    text-align: center;
    cursor: pointer;
    font: inherit;
    white-space: nowrap;
}

.sticky-top header #auth-nav .auth-links {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.sticky-top header #auth-nav .auth-links a,
.sticky-top header #auth-nav .auth-links button,
.sticky-top header #auth-nav .auth-links span {
    display: inline-flex;
    align-items: center;
    color: inherit;
}

.sticky-top header #auth-nav .auth-nav-menu a:hover,
.sticky-top header #auth-nav .auth-nav-menu button:hover,
.sticky-top header #auth-nav .auth-nav-menu a:focus-visible,
.sticky-top header #auth-nav .auth-nav-menu button:focus-visible {
    background: rgba(207, 10, 44, 0.08);
    color: #cf0a2c;
    outline: none;
}

.sticky-top header nav a, 
.cart-trigger {
    display: flex;
    align-items: center;
    padding: 0 0.9rem; /* Horizontal padding */
    height: 70px; /* Full header height */
    font-size: 0.9rem;
    color: #666;
    transition: color 0.3s;
    font-weight: 400;
}

.sticky-top header nav a:hover,
.cart-trigger:hover {
    color: #cf0a2c;
    background-color: rgba(0,0,0,0.02); /* Slight hover feedback for area */
}

.sticky-top header nav a,
.sticky-top header .cart-trigger {
    justify-content: center;
}

.sticky-top header .cart-trigger {
    font-weight: 400;
}

.sticky-top header .cart-trigger {
    white-space: nowrap;
}

/* Main Navigation Menu (Moved to Header) */
.sticky-top header > nav {
    margin: 0;
    padding: 0;
    border: none;
    height: 100%;
    flex: 0 0 auto;
}

.sticky-top header > nav ul {
    display: flex;
    gap: 0;
    padding: 0;
    margin: 0;
    height: 100%;
}

.sticky-top header > nav a {
    display: flex;
    align-items: center;
    padding: 0 0.9rem;
    height: 100%; /* Full height */
    font-weight: 400;
    position: relative;
    transition: color 0.3s;
    font-size: 0.95rem;
}

.sticky-top header > nav a:hover {
    color: #cf0a2c;
}

/* Main Content */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
    flex: 1;
    min-height: 60vh;
    position: relative; /* For cart positioning context if needed */
}

#hero-section.hero-pending {
    visibility: hidden;
}

#hero-section article {
    min-height: 420px;
}

/* Shopping Cart Panel (Dropdown with Hybrid Focus/Hover) */
/* Trigger Label Styling */
/* .cart-trigger default style handled by generic nav rule above */
/* Just refine specific overrides */
.cart-trigger {
    user-select: none; 
}

/* Initially hidden (slid up behind header) */
.cart-panel {
    position: fixed;
    top: 0;
    left: 0; 
    width: 100%; 
    height: auto;
    max-height: 80vh; 
    background-color: #fff;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    
    /* Key change for "Behind Header" effect: */
    /* Must be lower than ::before (-1) */
    z-index: -2; 
    
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    display: flex;
    flex-direction: column;
    
    /* Transform logic for slide down */
    transform: translateY(-110%);
    
    /* Padding to push content below the visual header height (approx 70-80px) */
    /* Adjusted to 95px to create balanced spacing (approx 25px visual gap below 70px header) */
    padding: 95px 40px 40px; 
    border-radius: 0;
}

/* Logic: 
   1. Checkbox Checked (Click on Mobile) -> Show
   2. Hover on Li (Desktop) -> Show
*/

#cart-toggle:checked ~ .cart-panel {
    transform: translateY(0);
}

@media (hover: hover) {
    /* On hover-capable devices (Desktop), hover triggers the panel */
    .cart-menu-item:hover .cart-panel {
        transform: translateY(0);
    }

    /* On desktop, disable the click-to-check behavior for the label so it doesn't get 'stuck' open */
    .cart-trigger {
        pointer-events: none; /* Clicks pass through, but hover on parent Li still works */
    }
    
    /* Re-enable pointer events for the Li so hover works? No, pointer-events: none on label 
       just means clicking the text wont check the box. The Li is the container. 
       Li hover still works. */
}

/* Removed .cart-panel header styles as element is deleted */

.sticky-top header nav .cart-panel ul {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 0.2rem 0;
    margin: 0;
}

.sticky-top header nav .cart-panel ul > li {
    width: 100%;
    display: flex;
    justify-content: center;
}

.cart-panel article {
    display: grid;
    grid-template-columns: 220px 110px 190px 120px;
    align-items: center;
    justify-items: start;
    gap: 0.9rem;
    padding: 0.85rem 0.4rem;
    width: 747px;
    max-width: calc(100% - 16px);
    border: none;
    border-radius: 0;
    text-align: left;
}

.cart-panel .cart-qty {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cart-panel .cart-qty label {
    font-size: 0.85rem;
    color: #555;
}

.cart-panel .cart-qty input[type="number"] {
    width: 70px;
    padding: 0.25rem 0.4rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    text-align: center;
    appearance: textfield;
    -moz-appearance: textfield;
}

.cart-panel .cart-qty input[type="number"]::-webkit-outer-spin-button,
.cart-panel .cart-qty input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.cart-panel h4 {
    font-size: 0.95rem;
    margin: 0;
    text-align: left;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-panel button {
    background-color: transparent;
    border: 1px solid #ccc;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    align-self: flex-start;
    font-size: 0.8rem;
}

.cart-panel footer {
    border-top: none; /* Removed separator line */
    padding-top: 1rem;
    margin-top: 1.5rem; /* Increased spacing to match top gap */
}

.cart-panel footer button {
    width: 100%;
    margin-top: 1rem;
    background-color: #cf0a2c;
    color: white;
    border: none;
    padding: 0.8rem;
    font-weight: bold;
    border-radius: 20px;
}

/* ─── Dynamic cart items (Phase 3) ──────────────────────────────────────── */
.cart-panel .qty-dec,
.cart-panel .qty-inc {
    width: 28px;
    height: 28px;
    padding: 0;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    font-size: 0;
    line-height: 0;
    flex-shrink: 0;
    background: transparent;
    border: none;
    color: #000;
    cursor: pointer;
    font-weight: 600;
    position: relative;
}

.cart-panel .qty-dec::before,
.cart-panel .qty-inc::before,
.cart-panel .qty-inc::after {
    content: "";
    position: absolute;
    background: currentColor;
    border-radius: 2px;
}

.cart-panel .qty-dec::before,
.cart-panel .qty-inc::before {
    width: 12px;
    height: 2px;
}

.cart-panel .qty-inc::after {
    width: 2px;
    height: 12px;
}

.cart-panel .qty-dec:hover,
.cart-panel .qty-inc:hover {
    color: #cf0a2c;
}

.cart-panel .cart-remove {
    align-self: center;
    background: white;
    color: #cf0a2c;
    border: 1px solid #cf0a2c;
    border-radius: 20px;
    padding: 0.3rem 0.9rem;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    justify-self: start;
    text-align: left;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cart-panel .cart-remove:hover {
    background-color: #cf0a2c;
    color: white;
}

.cart-panel .cart-item-price {
    font-weight: 600;
    font-size: 0.9rem;
    margin: 0;
    min-width: 88px;
    text-align: left;
    justify-self: start;
}

.cart-panel .cart-qty {
    justify-content: flex-start;
    min-width: 150px;
    justify-self: start;
    text-align: left;
}

.cart-empty {
    padding: 1rem 0;
    text-align: center;
    color: #888;
    font-size: 0.9rem;
    list-style: none;
}

/* Section Styling */
main > section {
    margin-bottom: 3rem;
}

main > section header {
    background: transparent;
    border: none;
    margin-bottom: 1.5rem;
}

main > section h2 {
    text-align: center;
    font-size: 1.8rem;
    color: #333;
    font-weight: 300;
}

/* Featured Hero Banner */
section:has(> article) article {
    background-color: #fff;
    text-align: center;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

section:has(> article) img {
    margin: 0 auto 1.5rem;
    max-height: 300px;
    background-color: #eee; /* Placeholder bg */
}

section:has(> article) a {
    display: inline-block;
    margin-top: 1rem;
    color: #cf0a2c;
    font-weight: 600;
}

/* Product Grid (Flexbox Implementation) */
/* The UL containing LIs */
main section > ul {
    display: flex;
    flex-wrap: wrap;
    gap: 20px; /* Consistent spacing */
    justify-content: flex-start;
}

#product-list {
    min-height: 520px;
}

.product-list-message {
    flex: 0 0 100%;
    padding: 1rem;
    text-align: center;
    color: #666;
}

/* Individual Product Cards */
main section > ul > li {
    /* 
     * Flexible widths: 
     * calc((100% - total_gap_width) / num_cols) 
     * 3 columns: gap=20px * 2 = 40px subtraction not needed if using gap property 
     * basis = calc((100% - 40px) / 3)
     */
    flex: 0 1 calc((100% - 40px) / 3);
    background-color: #fff;
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

main section > ul > li:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

/* Product Card Layout */
main section > ul > li article {
    padding: 1.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    height: 100%;
}

main section > ul > li figure {
    margin-bottom: 1rem;
    background-color: #f9f9f9;
    height: 200px; /* Fixed height for image area */
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

main section > ul > li figure a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

main section > ul > li img {
    max-height: 80%;
    width: auto;
}

main section > ul > li h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

main section > ul > li p {
    color: #cf0a2c;
    font-weight: bold;
    margin-bottom: 1rem;
    margin-top: auto; /* Pushes price down if title is short, keeps alignment */
}

main section > ul > li button {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid #cf0a2c;
    color: #cf0a2c;
    background: white;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

main section > ul > li button:hover {
    background-color: #cf0a2c;
    color: white;
}

/* Footer Styling */
body > footer {
    background-color: #f5f5f5; /* Light grey footer */
    padding: 3rem 2rem;
    border-top: 1px solid #e0e0e0;
}

body > footer > nav {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto 2rem;
    border: none;
    background: transparent;
    padding: 0;
}

body > footer h3 {
    font-size: 0.9rem;
    color: #333;
    margin-bottom: 1rem;
    text-transform: uppercase;
}

body > footer ul li {
    margin-bottom: 0.5rem;
}

body > footer a {
    color: #777;
    font-size: 0.85rem;
    white-space: nowrap;
    background: transparent;
}

body > footer a:hover {
    color: #333;
    text-decoration: underline;
}

body > footer > section {
    text-align: center;
    color: #999;
    font-size: 0.8rem;
    border-top: 1px solid #e0e0e0;
    padding-top: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    /* Header Stack */
    .sticky-top header {
        flex-direction: column;
        align-items: stretch;
        height: auto;
        gap: 0.75rem;
    }
    
    .sticky-top header h1 {
        text-align: center;
        padding-top: 1rem;
    }

    .sticky-top header form {
        justify-content: center;
        padding: 0.5rem 0;
    }

    .sticky-top header .site-search {
        justify-content: center;
        padding: 0.5rem 0;
        margin-right: 0;
        width: min(8rem, 100%);
    }

    .sticky-top header > nav {
        margin: 0;
        width: 100%;
    }

    .sticky-top header #auth-nav {
        justify-content: center;
    }

    .sticky-top header .user-tools {
        margin-left: 0;
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .sticky-top header #auth-nav {
        width: 100%;
        justify-content: center;
        height: 50px;
        font-size: 0.85rem;
    }

    .sticky-top header #auth-nav .auth-nav-shell,
    .sticky-top header #auth-nav .auth-nav-trigger {
        min-height: 50px;
        height: 50px;
    }

    .sticky-top header nav ul {
        justify-content: center;
        margin-top: 0;
    }

    .sticky-top header > nav a,
    .sticky-top header nav a, 
    .cart-trigger {
        height: 50px;
        font-size: 0.85rem;
    }

    /* Navigation scrollable on small screens */
    .sticky-top header > nav {
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 0;
    }
    
    .sticky-top header > nav ul {
        justify-content: flex-start;
    }

    .sticky-top header #auth-nav .auth-nav-menu {
        right: auto;
        left: 50%;
        transform: translate(-50%, -4px);
    }

    .sticky-top header #auth-nav .auth-nav-shell:hover .auth-nav-menu,
    .sticky-top header #auth-nav .auth-nav-shell:focus-within .auth-nav-menu,
    .sticky-top header #auth-nav .auth-nav-shell.is-open .auth-nav-menu {
        transform: translate(-50%, 0);
    }
    
    body > nav ul {
        justify-content: flex-start;
    }

    /* Product Grid: 2 Columns */
    main section > ul > li {
        flex: 0 1 calc((100% - 20px) / 2);
    }
}

@media (max-width: 480px) {
    /* Product Grid: 1 Column */
    main section > ul > li {
        flex: 0 1 100%;
    }
}

/* =========================================
   Product Detail Page Styles 
   ========================================= */

/* Main Container Layout */
.product-detail {
    background-color: #fff;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center; /* Centers content horizontally */
}

.product-detail > section + section {
    width: 100%;
    max-width: 900px;
}

.product-detail header h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    text-align: center;
}

.product-purchase {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.product-purchase p {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    color: #cf0a2c;
}

.product-purchase form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.product-purchase .qty-control {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.product-purchase label {
    font-size: 0.95rem;
    color: #555;
}

.product-purchase input[type="number"] {
    width: 70px;
    padding: 0.35rem 0.5rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    text-align: center;
    appearance: textfield;
    -moz-appearance: textfield;
}

.product-purchase input[type="number"]::-webkit-outer-spin-button,
.product-purchase input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.product-purchase .qty-dec,
.product-purchase .qty-inc {
    width: 28px;
    height: 28px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #000;
    cursor: pointer;
    position: relative;
}

.product-purchase .qty-dec::before,
.product-purchase .qty-inc::before,
.product-purchase .qty-inc::after {
    content: "";
    position: absolute;
    background: currentColor;
    border-radius: 2px;
}

.product-purchase .qty-dec::before,
.product-purchase .qty-inc::before {
    width: 12px;
    height: 2px;
}

.product-purchase .qty-inc::after {
    width: 2px;
    height: 12px;
}

.product-purchase .qty-dec:hover,
.product-purchase .qty-inc:hover {
    color: #cf0a2c;
}

.product-purchase .add-to-cart-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #cf0a2c;
    color: #cf0a2c;
    background: #fff;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
}

.product-purchase .add-to-cart-btn:hover {
    background-color: #cf0a2c;
    color: #fff;
}

/* Auth Pages */
body.auth-page {
    background: radial-gradient(circle at top left, rgba(207, 10, 44, 0.12), transparent 30%),
                radial-gradient(circle at top right, rgba(51, 51, 51, 0.08), transparent 28%),
                #f4f5f7;
}

body.auth-page .auth-shell {
    width: min(960px, calc(100% - 2rem));
    margin: 2rem auto 3rem;
}

body.auth-page .auth-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem 1.25rem;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.84);
    backdrop-filter: blur(12px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.06);
}

body.auth-page .auth-header h1 {
    margin: 0;
    font-size: 1.6rem;
    color: #cf0a2c;
}

body.auth-page .auth-header a {
    color: inherit;
}

body.auth-page .auth-card {
    width: min(520px, 100%);
    margin: 0 auto;
    padding: 2rem;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.04);
}

body.auth-page .auth-card h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: #222;
}

body.auth-page .auth-card p {
    color: #555;
}

body.auth-page .auth-banner {
    margin: 1rem 0 1.25rem;
    padding: 0.9rem 1rem;
    border-radius: 14px;
    background: rgba(207, 10, 44, 0.08);
    color: #8b0a24;
    font-weight: 600;
}

body.auth-page .auth-form {
    margin-top: 1.5rem;
    display: grid;
    gap: 1rem;
}

body.auth-page .auth-field {
    display: grid;
    gap: 0.45rem;
}

body.auth-page .auth-field label {
    font-weight: 600;
    color: #333;
}

body.auth-page .auth-field input {
    width: 100%;
    border: 1px solid #d4d8de;
    border-radius: 14px;
    padding: 0.9rem 1rem;
    font-size: 1rem;
    background: #fff;
}

body.auth-page .auth-field input:focus {
    outline: none;
    border-color: #cf0a2c;
    box-shadow: 0 0 0 3px rgba(207, 10, 44, 0.12);
}

body.auth-page .auth-row {
    display: grid;
    gap: 1rem;
}

body.auth-page .auth-row.cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

body.auth-page .auth-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

body.auth-page .auth-submit {
    appearance: none;
    border: none;
    border-radius: 999px;
    padding: 0.9rem 1.35rem;
    background: #cf0a2c;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

body.auth-page .auth-submit:hover {
    background: #b10824;
}

body.auth-page .auth-secondary {
    color: #666;
}

body.auth-page .form-msg {
    min-height: 1.4em;
    margin-top: 0.25rem;
    color: #b10824;
    font-weight: 600;
}

body.auth-page .form-msg.success {
    color: #0d7a43;
}

body.auth-page .form-msg.error {
    color: #b10824;
}

body.auth-page .auth-links {
    margin-top: 1rem;
    display: flex;
    gap: 0.9rem;
    flex-wrap: wrap;
}

body.auth-page .auth-links a {
    color: #cf0a2c;
    font-weight: 600;
}

body.auth-page .auth-note {
    margin-top: 1rem;
    color: #666;
    font-size: 0.95rem;
}

body.auth-page .auth-inline-action {
    border: none;
    background: transparent;
    color: #cf0a2c;
    padding: 0;
    font: inherit;
    cursor: pointer;
    font-weight: 600;
}

body.auth-page .auth-inline-action:hover {
    text-decoration: underline;
}

body.auth-page .auth-hidden {
    display: none !important;
}

body.auth-page .auth-panel {
    width: min(980px, calc(100% - 2rem));
    margin: 2rem auto 3rem;
    border-radius: 28px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 22px 55px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

body.auth-page .auth-panel-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.4rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(10px);
}

body.auth-page .auth-panel-top h1 {
    margin: 0;
    font-size: 1.6rem;
    color: #cf0a2c;
}

body.auth-page .auth-panel-top a {
    color: inherit;
}

body.auth-page .auth-panel-body {
    width: min(640px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 1.9rem 0 1.4rem;
    min-height: clamp(24rem, 48vh, 29rem);
    display: flex;
    flex-direction: column;
}

body.auth-page .auth-title {
    margin: 0 0 0.95rem;
    font-size: 2rem;
    font-weight: 600;
    color: #222;
}

body.auth-page .auth-title-center {
    text-align: center;
}

body.auth-page .auth-form {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    margin-top: 1rem;
    gap: 1rem;
}

body.auth-page .auth-actions {
    flex-direction: column;
    align-items: center;
    gap: 0.65rem;
    margin-top: auto;
    padding-top: 0.95rem;
}

body.auth-page .auth-actions-column .auth-secondary {
    margin-top: 0;
}

body.auth-page .auth-banner {
    margin-top: 0.35rem;
    margin-bottom: 0.8rem;
    text-align: center;
}

body.auth-page .auth-panel .form-msg {
    text-align: center;
}

body.auth-page .auth-panel .auth-field input {
    padding: 0.95rem 1rem;
}

body.auth-page .auth-panel .auth-field {
    gap: 0.45rem;
}

body.auth-page .auth-panel .auth-row.cols-2 {
    grid-template-columns: 1fr;
}

body.auth-page .auth-panel #auth-nav {
    justify-content: flex-end;
    color: #333;
    font-weight: 600;
}

body.auth-page .auth-panel #auth-nav .auth-label {
    color: #333;
    font-weight: 600;
}

body.auth-page .auth-panel #auth-nav .auth-nav-shell,
body.auth-page .auth-panel #auth-nav .auth-nav-menu {
    display: none;
}

body.auth-page .auth-panel .auth-secondary {
    color: #666;
}

@media (max-width: 768px) {
    body.auth-page .auth-panel {
        width: min(100%, calc(100% - 1rem));
        margin: 1rem auto 2rem;
    }

    body.auth-page .auth-panel-top {
        padding: 0.9rem 1rem;
    }

    body.auth-page .auth-panel-body {
        width: calc(100% - 1.5rem);
        padding: 1.35rem 0 1.2rem;
        min-height: auto;
    }

    body.auth-page .auth-title {
        font-size: 1.7rem;
        margin-bottom: 0.8rem;
    }
}

.product-detail h3 {
    font-size: 1.1rem;
    margin-bottom: 0.6rem;
}

.product-detail h4 {
    font-size: 1rem;
    margin-top: 1.2rem;
    margin-bottom: 0.6rem;
}

.product-detail p {
    font-size: 1rem;
    color: #444;
    line-height: 1.7;
}

/* Image Carousel Gallery */
.product-gallery {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 3.25rem;
}

/* Carousel Container */
.carousel-container {
    width: 100%;
    max-width: 600px; /* Limit max width for large screens */
    min-height: 420px; /* Fallback if aspect-ratio is unsupported */
    aspect-ratio: 4/3; /* Maintain aspect ratio */
    position: relative;
    overflow: visible;
}

.carousel-viewport {
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 8px;
    background-color: #f9f9f9;
}

/* Inner Slider Track */
.carousel-inner {
    display: flex;
    height: 100%;
    transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    will-change: transform;
}

.carousel-inner .slide {
    flex: 0 0 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-inner .slide img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

/* Navigation Arrows */
.carousel-controls .control-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background-color: #f5f5f5;
    color: rgba(0,0,0,0.58);
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    border-radius: 50%;
    user-select: none;
    transition: background-color 0.2s, color 0.2s;
    z-index: 10;
}

.carousel-controls .control-arrow:hover {
    background-color: rgba(236, 239, 242, 1);
    color: rgba(0,0,0,0.78);
}

.carousel-controls .prev { left: -52px; }
.carousel-controls .next { right: -52px; }

.carousel-dots {
    position: absolute;
    left: 50%;
    bottom: -1.8rem;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.45rem;
    z-index: 11;
}

.carousel-dot {
    width: 9px;
    height: 9px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.25);
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.carousel-dot:hover,
.carousel-dot:focus-visible {
    background: rgba(0, 0, 0, 0.5);
    outline: none;
}

.carousel-dot.is-active {
    background: #cf0a2c;
    transform: scale(1.15);
}

/* JS handles slide switching */

/* Responsive Detail Layout */
@media (min-width: 992px) {
    .product-detail {
        flex-direction: column;
        align-items: center;
        gap: 2rem;
    }
}

@media (max-width: 640px) {
    .product-gallery {
        margin-bottom: 2.85rem;
    }

    .carousel-controls .prev { left: 8px; }
    .carousel-controls .next { right: 8px; }

    .carousel-dots {
        bottom: -1.5rem;
    }
}
