/* File: static/css/style.css (CLEAN VERSION) */

/*
:root
  Defines the color palette for the entire site.
  Based on the dark-mode mockup.
*/
:root {
    --primary-bg: #111111;
    --secondary-bg: #1C1C1C;
    --text-color: #F5F5F7;
    --text-color-muted: #8A8A8E;
    --accent-color: #FFFFFF;
    --border-color: #333333;
    --hover-bg: #2C2C2C;
    --font-sans: 'Helvetica Neue', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
    background-color: var(--primary-bg);
    color: var(--text-color);
    font-family: var(--font-sans);
    line-height: 1.6;
    padding-bottom: 60px; /* For mobile nav */
}

a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--text-color-muted);
}

.container {
    max-width: 1320px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 20px;
    padding-right: 20px;
}

.main {
    padding-top: 3rem;
    padding-bottom: 3rem;
}


img {
    max-width: 100%;
    height: auto;
}

/* =================================== */
/* Header & Navigation */
/* =================================== */

.header {
    background-color: var(--primary-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: transform 0.3s ease-in-out;
}
.header.hidden {
    transform: translateY(-100%);
}
.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo img {
    width: 30px;
    height: 30px;
}
.desktop-nav .nav-links {
    display: flex;
    gap: 2.5rem;
    list-style: none;
}
.desktop-nav .nav-links a {
    font-weight: 500;
    font-size: 0.9rem;
}
.header-icons {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    font-size: 1.25rem;
}
.cart-icon {
    position: relative;
}
.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: var(--accent-color);
    color: var(--primary-bg);
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.7rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}
.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--secondary-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--text-color);
    font-size: 0.8rem;
    border: 1px solid var(--border-color);
}

/* =================================== */
/* Main Content & Buttons */
/* =================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}
.btn-primary {
    background-color: var(--accent-color);
    color: var(--primary-bg);
    width: 100%;
}
.btn-primary:hover {
    background-color: #CCCCCC;
}
.btn-secondary {
    background-color: var(--hover-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover {
    background-color: var(--border-color);
}

/* =================================== */
/* Collection (Shop) Page */
/* =================================== */

.collection-header {
    text-align: center;
    margin-bottom: 2.5rem;
}
.collection-header h1 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.collection-header p {
    font-size: 1.1rem;
    color: var(--text-color-muted);
}
.collection-filters {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.category-filters {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}
.filter-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--secondary-bg);
    color: var(--text-color-muted);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
}
.filter-btn:hover {
    background-color: var(--hover-bg);
    color: var(--text-color);
}
.filter-btn.active {
    background-color: var(--accent-color);
    color: var(--primary-bg);
    border-color: var(--accent-color);
}
.sort-dropdown select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--secondary-bg);
    color: var(--text-color);
    font-size: 0.9rem;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%238A8A8E' stroke-width='2'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}
.product-grid {
    display: grid;
    grid-template-columns: 1fr; /* Mobile-first: 1 column */
    gap: 1.5rem;
}
.product-card {
    text-decoration: none;
    color: var(--text-color);
    transition: opacity 0.2s ease;
    background-color: var(--secondary-bg); /* Card has background */
    border-radius: 8px;
    overflow: hidden;
}
.discover-brand .product-card {
    background-color: transparent;
}
.product-card:hover {
    opacity: 0.8;
}
.product-image-wrapper {
    overflow: hidden;
    padding: 1.5rem; /* Adds "margin" inside the card */
    aspect-ratio: 1 / 1.1;
    margin-bottom: 0;
    border-radius: 8px; /* This ensures the wrapper itself is rounded */
}
.product-image {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Fits image inside padding */
    object-position: center; /* Center the image */
}
.product-info {
    padding: 0 1.5rem 1.5rem 1.5rem; /* Padding for text */
}
.discover-brand .product-info {
    padding: 0; /* Remove padding */
    text-align: center; /* Center text */
    margin-top: 1rem; /* Add space above text */
}
.product-info .product-title {
    font-size: 1rem;
    font-weight: 500;
}
.product-info .product-price {
    font-size: 1rem;
    color: var(--text-color-muted);
    margin-top: 0.25rem;
}
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 3rem;
    flex-wrap: wrap;
}
.page-link {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-color-muted);
    transition: all 0.2s;
}
.page-link:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}
.page-link.active {
    background-color: var(--accent-color);
    color: var(--primary-bg);
    border-color: var(--accent-color);
}

/* =================================== */
/* Product Detail Page */
/* =================================== */

.breadcrumbs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    font-size: 0.875rem;
    color: var(--text-color-muted);
    flex-wrap: wrap;
}
.breadcrumbs a {
    color: var(--text-color-muted);
    text-decoration: underline;
}
.breadcrumbs a:hover {
    color: var(--text-color);
}
.product-detail-layout {
    display: grid;
    grid-template-columns: 1fr; /* Mobile-first */
    gap: 2rem;
}
.product-images {
    width: 100%;
}
.main-image {
    width: 100%;
    aspect-ratio: 1 / 1; /* Make the box square */
    object-fit: contain; /* This fits the image *inside* the box */
    object-position: center; /* Center it */
    background-color: var(--secondary-bg);
    margin-bottom: 1rem;
    border-radius: 8px;
    padding: 3rem; /* This creates the space *inside* the box, as you drew */
}
.thumbnail-list {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}
.thumbnail {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: contain; /* Match the main image */
    object-position: center;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border 0.2s;
    background-color: var(--secondary-bg);
    padding: 0.5rem; /* Add padding to thumbnails too */
}
.thumbnail:hover,
.thumbnail.active {
    border-color: var(--accent-color);
}
.product-details {
    width: 100%;
    position: sticky; /* Makes it stick on scroll on desktop */
    top: 100px;
    align-self: start;
}
.product-title {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.product-price {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-color);
}

/*
  BASE FORM STYLES
  These are the default styles for form elements
*/
.form-group {
    margin-bottom: 1rem;
}
.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-color-muted);
}
.form-select,
.quantity-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--secondary-bg);
    color: var(--text-color);
    font-size: 1rem;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}
.form-select {
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%238A8A8E' stroke-width='2'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}
.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--secondary-bg);
    color: var(--text-color);
    font-size: 1rem;
    font-family: var(--font-sans); /* Ensure font is inherited */
}
textarea.form-input {
    line-height: 1.6;
    min-height: 120px;
    resize: vertical; /* Allow vertical resizing */
}
/*
  END BASE FORM STYLES
*/


.quantity-selector {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    width: fit-content;
}
.quantity-btn,
.quantity-input {
    border: none;
    background-color: var(--secondary-bg);
    color: var(--text-color);
    height: 48px;
    text-align: center;
}
.quantity-btn {
    width: 40px;
    cursor: pointer;
    font-size: 1.5rem;
    transition: background-color 0.2s;
}
.quantity-btn:hover {
    background-color: var(--hover-bg);
}
.quantity-input {
    width: 50px;
    font-size: 1rem;
    font-weight: 500;
    -moz-appearance: textfield; /* Firefox */
}
.quantity-input::-webkit-outer-spin-button,
.quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
#add-to-cart-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
#cart-message {
    margin-top: 1rem;
}
.accordion-item {
    border-top: 1px solid var(--border-color);
}
.accordion-item:last-child {
    border-bottom: 1px solid var(--border-color);
}
.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 0;
    cursor: pointer;
    font-weight: 500;
    font-size: 1rem;
}
.accordion-toggle {
    font-size: 1.25rem;
    transition: transform 0.3s ease;
}
.accordion-header.active .accordion-toggle {
    transform: rotate(45deg);
}
.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-color-muted);
}
.accordion-content.show {
    max-height: 500px;
    padding-bottom: 1.5rem;
}

/* Reviews Section */
.reviews-section,
.you-might-also-like {
    margin-top: 4rem;
    padding-top: 3rem;
    border-top: 1px solid var(--border-color);
}
.reviews-section h2,
.you-might-also-like h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 2rem;
}
.rating-summary {
    display: flex;
    flex-direction: column;
    align-items: start;
    gap: 0.5rem;
    margin-bottom: 2rem;
}
.rating-summary-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.rating-value {
    font-size: 2.5rem;
    font-weight: 600;
}
.rating-stars .star {
    color: gold;
    font-size: 1.25rem;
}
.rating-summary p {
    color: var(--text-color-muted);
}
.rating-distribution {
    max-width: 400px;
    margin-bottom: 3rem;
}
.rating-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}
.rating-label {
    width: 50px;
    color: var(--text-color-muted);
}
.rating-progress {
    flex: 1;
    height: 6px;
    background-color: var(--secondary-bg);
    border-radius: 3px;
    overflow: hidden;
}
.rating-progress-inner {
    height: 100%;
    background-color: var(--accent-color);
}
.rating-percent {
    width: 30px;
    text-align: right;
    color: var(--text-color-muted);
    font-size: 0.8rem;
}
.review-item {
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 0;
}
.review-rating {
    margin-bottom: 0.5rem;
}
.review-rating .star {
    color: gold;
}
.review-title {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}
.review-meta {
    font-size: 0.875rem;
    color: var(--text-color-muted);
    margin-bottom: 0.5rem;
}
.review-text {
    color: var(--text-color);
    line-height: 1.7;
}
.review-form-container {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}
.review-form-container h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}
.review-form-container .btn-primary {
    width: auto; /* Overrides the default 100% width */
}

/* Footer */
.footer {
    background-color: var(--secondary-bg);
    border-top: 1px solid var(--border-color);
    padding: 3rem 0;
    margin-top: 4rem;
}
.footer-columns {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    margin-bottom: 2rem;
}
.footer-column h3 {
    margin-bottom: 1rem;
    font-size: 1rem;
    font-weight: 500;
}
.footer-column ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.footer-column a {
    color: var(--text-color-muted);
    font-size: 0.9rem;
}
.footer-column a:hover {
    color: var(--text-color);
}
.social-icons {
    display: flex;
    gap: 1rem;
    font-size: 1.25rem;
}
.copyright {
    text-align: center;
    color: var(--text-color-muted);
    font-size: 0.8rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}


.hidden {
    display: none !important;
}

.input-error {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
}


/* Mobile & Responsive */
.desktop-nav {
    display: none;
}
.mobile-nav {
    display: block;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--primary-bg);
    border-top: 1px solid var(--border-color);
    z-index: 1001;
}
.mobile-nav .nav-links {
    display: flex;
    justify-content: space-around;
    list-style: none;
    padding: 0.5rem 0;
}
.mobile-nav .nav-links a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    color: var(--text-color-muted);
}
.mobile-nav .nav-links a i {
    font-size: 1.25rem;
}
.mobile-nav .nav-links a.active,
.mobile-nav .nav-links a:hover {
    color: var(--accent-color);
}

/* --- Hero Carousel Styles --- */
.hero-carousel {
    position: relative;
    width: 100%;
    height: 60vh; /* 60% of viewport height */
    overflow: hidden;
    background-color: var(--secondary-bg);
    margin-bottom: 3rem; /* <-- THIS IS YOUR NEW MARGIN */
}
.carousel-slides {
    width: 100%;
    height: 100%;
}
.hero-slide {
    display: none;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    position: relative;
}
.hero-slide.active {
    display: block;
    animation: fade 1.5s ease;
}
@keyframes fade {
    from { opacity: 0.4 }
    to { opacity: 1 }
}
.hero-slide::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
}
.hero-content {
    position: relative;
    z-index: 2;
    color: var(--accent-color);
    text-align: center;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}
.hero-content h1 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
}
.hero-content p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    max-width: 600px;
}
.hero-content .btn-primary {
    width: auto;
    padding: 1rem 2rem;
}
.carousel-control {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    margin-top: -22px;
    padding: 16px;
    color: white;
    font-weight: bold;
    font-size: 24px;
    transition: 0.6s ease;
    border-radius: 0 3px 3px 0;
    user-select: none;
    background-color: rgba(0, 0, 0, 0.3);
    border: none;
}
.carousel-control.next {
    right: 0;
    border-radius: 3px 0 0 3px;
}
.carousel-control.prev {
    left: 0;
    border-radius: 0 3px 3px 0;
}
.carousel-control:hover {
    background-color: rgba(0, 0, 0, 0.8);
}
.carousel-dots {
    text-align: center;
    position: absolute;
    bottom: 20px;
    width: 100%;
}
.dot {
    cursor: pointer;
    height: 12px;
    width: 12px;
    margin: 0 5px;
    background-color: #717171;
    border-radius: 50%;
    display: inline-block;
    transition: background-color 0.6s ease;
}
.dot.active, .dot:hover {
    background-color: var(--accent-color);
}
/* --- END HERO CAROUSEL --- */


@media (max-width: 767px) {
    .main {
        padding-top: 1.5rem;
        padding-bottom: 1.5rem;
    }
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    .discover-brand .product-card .product-image-wrapper {
        padding-left: 15%;
        padding-right: 15%;
    }
    
    /* --- THIS IS THE 50% HEIGHT --- */
    .hero-carousel {
        height: 50vh; /* 50% of viewport height on mobile */
    }
    .hero-content h1 {
        font-size: 1.8rem;
    }
    .hero-content p {
        font-size: 1rem;
    }
    /* --- END 50% HEIGHT --- */
}

@media (min-width: 640px) {
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .discover-brand .product-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .discover-brand .product-card .product-image-wrapper {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
    .footer-columns {
        grid-template-columns: repeat(4, 1fr);
    }
}
@media (min-width: 768px) {
    body {
        padding-bottom: 0; /* No mobile nav */
    }
    .desktop-nav {
        display: block; /* Show desktop nav */
    }
    .mobile-nav {
        display: none; /* Hide mobile nav */
    }
    .collection-filters {
        flex-direction: row;
    }
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .discover-brand .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .product-detail-layout {
        grid-template-columns: 1fr 1fr;
        gap: 3rem;
    }
}
@media (min-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .discover-brand .product-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .product-detail-layout {
        grid-template-columns: 0.7fr 1fr;
        gap: 3rem;
    }
    .you-might-also-like .product-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Account Page (Profile) */
.account-header {
    text-align: center;
    margin-bottom: 3rem;
}
.account-header h1 {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.account-header p {
    font-size: 1.1rem;
    color: var(--text-color-muted);
}
.account-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}
.account-nav ul {
    list-style: none;
    display: flex;
    flex-direction: row;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}
.account-nav li {
    white-space: nowrap;
}
.account-nav a {
    display: block;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    color: var(--text-color-muted);
    transition: all 0.2s ease;
    font-size: 0.9rem;
}
.account-nav a:hover {
    background-color: var(--hover-bg);
    color: var(--text-color);
}
.account-nav a.active {
    background-color: var(--secondary-bg);
    color: var(--accent-color);
}
.account-panel {
    display: none;
    background-color: var(--secondary-bg);
    border-radius: 8px;
    padding: 1.5rem;
}
.account-panel.active {
    display: block;
}
.account-panel h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.account-panel p {
    color: var(--text-color-muted);
    margin-bottom: 2rem;
}
.profile-form h3 {
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
}
.profile-form .form-group {
    margin-bottom: 1.5rem;
}
.profile-form .form-input,
.profile-form .form-select {
    background-color: var(--primary-bg);
}
.profile-form .form-divider {
    font-size: 1.25rem;
    font-weight: 500;
    margin-top: 2.5rem;
    border-top: 1px solid var(--border-color);
    padding-top: 2.5rem;
    margin-bottom: 1.5rem;
}
.profile-form .form-actions {
    margin-top: 2rem;
}
.order-list .accordion-item {
    background-color: var(--primary-bg);
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}
.order-list .accordion-header {
    padding: 1rem 1.5rem;
    font-weight: 500;
}
.order-list .accordion-header .accordion-toggle {
    font-size: 1.5rem;
}
.order-list .accordion-content {
    padding: 0 1.5rem 1.5rem 1.5rem;
    color: var(--text-color-muted);
    line-height: 1.7;
}
.order-list .accordion-content p {
    margin-bottom: 0.5rem;
}
.order-list .accordion-content p strong {
    color: var(--text-color);
}
.order-list .order-items-title {
    color: var(--text-color);
    font-weight: 500;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
}
.order-list .order-item-list {
    list-style: disc;
    padding-left: 1.5rem;
}
.order-list .order-item-list li {
    margin-bottom: 0.25rem;
}
.order-status-desktop {
    display: none;
    color: var(--text-color-muted);
    font-size: 0.9rem;
}
.order-date-mobile {
    display: inline;
    color: var(--text-color-muted);
    font-size: 0.9rem;
}

@media (min-width: 768px) {
    .account-layout {
        grid-template-columns: 240px 1fr;
        gap: 3rem;
    }
    .account-nav ul {
        flex-direction: column;
        border-bottom: none;
        padding-bottom: 0;
        position: sticky;
        top: 100px;
    }
    .account-panel {
        padding: 2rem;
    }
    .order-status-desktop {
        display: inline-block;
    }
    .order-date-mobile {
        display: none;
    }
}

/* Profile Form Fields */
.form-input[disabled],
input[disabled].form-input {
    background-color: var(--hover-bg);
    color: var(--text-color-muted);
    cursor: not-allowed;
    opacity: 0.7;
}
.profile-form .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-color-muted);
}
.profile-form .form-group .errorlist {
    color: #ff4d4d;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    list-style: none;
}

/* =================================== */
/* Account Forms (Login/Register) 
/* THIS IS THE CORRECTED SECTION
/* =================================== */

.form-container {
    max-width: 420px;
    margin: 3rem auto;
    padding: 2rem;
    background-color: var(--secondary-bg);
    border-radius: 8px;
}
.form-container h2 {
    text-align: center;
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 2rem;
}

/* This styles the "Username" and "Password" labels */
.form-container .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-color-muted);
}

/* THIS IS THE KEY FIX:
  It styles the <input> tags directly, since Django doesn't add a class.
*/
.form-container .form-group input[type="text"],
.form-container .form-group input[type="password"] {
    /* These styles are copied from your default .form-input class */
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--secondary-bg); /* Dark background */
    color: var(--text-color); /* Light text */
    font-size: 1rem;
    font-family: var(--font-sans);
}

/* Add a focus style so users know which box they're in */
.form-container .form-group input[type="text"]:focus,
.form-container .form-group input[type="password"]:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
    outline: none;
}

/* Error message styling */
.form-container .errorlist {
    color: #ff4d4d;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    list-style: none;
    padding-left: 0;
}
/* This styles the main "Incorrect username or password" error */
.form-container .errorlist.non-field-errors {
    background-color: rgba(248, 215, 218, 0.1); /* Darker error bg */
    color: #f8d7da;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border: 1px solid #721c24;
}

/* Button and link styling */
.form-actions {
    margin-top: 2rem;
}
.form-subtext {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-color-muted);
    font-size: 0.9rem;
}
.form-subtext a {
    color: var(--accent-color);
    font-weight: 500;
    text-decoration: underline;
}


/* Cart Page */
.cart-empty-panel {
    text-align: center;
    padding: 4rem 1rem;
    background-color: var(--secondary-bg);
    border-radius: 8px;
}
.cart-empty-panel p {
    font-size: 1.1rem;
    color: var(--text-color-muted);
}
.cart-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}
.cart-items-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.cart-item-card {
    display: flex;
    gap: 1rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}
.cart-items-panel .cart-item-card:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.cart-item-image {
    width: 80px;
    height: 100px;
    background-color: var(--secondary-bg);
    border-radius: 8px;
    padding: 0.5rem;
    flex-shrink: 0;
}
.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.cart-item-details {
    flex-grow: 1;
}
.cart-item-details h3 {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}
.cart-item-details p {
    font-size: 0.9rem;
    color: var(--text-color-muted);
    margin-bottom: 0.5rem;
}
.cart-item-price {
    font-weight: 500;
    color: var(--text-color) !important;
}
.cart-item-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1rem;
    flex-shrink: 0;
    text-align: right;
}
.cart-remove-button {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-color-muted);
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: none;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease-in-out;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.cart-remove-button i {
    font-size: 0.9rem;
}
.cart-remove-button:hover {
    color: #ff4d4d;
    background-color: var(--hover-bg);
}
.order-summary-panel {
    background-color: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    position: sticky;
    top: 100px;
    align-self: start;
}
.order-summary-panel h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}
.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-size: 1rem;
}
.summary-row span:first-child {
    color: var(--text-color-muted);
}
.summary-row span:last-child {
    font-weight: 500;
}
.summary-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}
.continue-shopping-link {
    margin-top: 2rem;
    text-align: center;
}
.continue-shopping-link a {
    color: var(--text-color-muted);
    font-size: 0.9rem;
    font-weight: 500;
}
.continue-shopping-link i {
    margin-right: 0.5rem;
}
.continue-shopping-link a:hover {
    color: var(--accent-color);
}

/* Custom Modal Styles (GLOBAL) */
.custom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}
.custom-modal {
    background-color: var(--secondary-bg);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}
.custom-modal h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-color);
}
.custom-modal p {
    font-size: 1rem;
    color: var(--text-color-muted);
    margin-bottom: 2rem;
}
.custom-modal-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
}
.custom-modal-buttons .btn {
    width: 120px;
    padding: 0.8rem 1.2rem;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s ease-in-out;
}
.custom-modal-buttons .btn-secondary {
    background-color: var(--hover-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}
.custom-modal-buttons .btn-secondary:hover {
    background-color: var(--border-color);
}
.custom-modal-buttons .btn-primary {
    background-color: var(--accent-color);
    color: var(--primary-bg);
    border: 1px solid var(--accent-color);
}
.custom-modal-buttons .btn-primary:hover {
    background-color: #e0e0e0;
}

@media (min-width: 768px) {
    .cart-layout {
        grid-template-columns: 2fr 1fr;
        align-items: flex-start;
    }
    .cart-item-card {
        gap: 1.5rem;
    }
    .cart-item-image {
        width: 120px;
        height: 140px;
    }
    .cart-item-actions {
        flex-direction: row;
        align-items: center;
    }
}


/*
=============================================================
  CHECKOUT STYLES (SCOPED & DARK-MODE)
=============================================================
*/

.checkout-container h1 {
    text-align: center;
    color: var(--text-color);
    font-weight: 600;
    margin-bottom: 2rem;
    font-size: 2.5rem;
}

/* --- Grid Layout --- */
.checkout-container .checkout-grid {
    display: grid;
    grid-template-columns: 1fr; /* Mobile-first */
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* --- Card Styling (Use dark-mode variables) --- */
.checkout-container .checkout-form,
.checkout-container .checkout-summary {
    background-color: var(--secondary-bg);
    border-radius: 8px;
    padding: 1.5rem 2rem;
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

/* --- Titles --- */
.checkout-container .checkout-form h2,
.checkout-container .checkout-summary h3 {
    color: var(--text-color);
    font-weight: 600;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color); /* Match dark theme border */
}

/* --- Form --- */
.checkout-container .checkout-form .form-group {
    margin-bottom: 1.5rem;
}

/* Use existing .form-label styles */
.checkout-container .checkout-form .form-group label {
    color: var(--text-color-muted);
    font-weight: 500;
    margin-bottom: 0.5rem;
    display: block;
}

/* These classes already exist, so we just need to style focus */
.checkout-container .form-input:focus,
.checkout-container .form-select:focus {
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1) !important;
    outline: none;
}

.checkout-container .checkout-form .errorlist {
    color: #ff4d4d;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    list-style: none;
    padding-left: 0;
}
.checkout-container .checkout-form .form-input.input-error,
.checkout-container .checkout-form input.form-input.input-error {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.2) !important;
}

/* --- NEW: Rule to hide the state dropdown --- */
.checkout-container .form-group.hidden {
    display: none;
}

/* --- Order Summary (Left Column) --- */
.checkout-container .checkout-summary .summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}
.checkout-container .checkout-summary .summary-item .item-name {
    color: var(--text-color);
    font-weight: 500;
    font-size: 0.9rem;
}
.checkout-container .checkout-summary .summary-item .item-price {
    color: var(--text-color);
    font-weight: 600;
    font-size: 0.9rem;
}
/* These styles are already covered by .summary-row */
.checkout-container .checkout-summary hr {
      border: 0;
      border-top: 1px solid var(--border-color);
}

/* --- Action Buttons --- */
.checkout-container .checkout-form .form-actions {
    margin-top: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.checkout-container .back-to-cart-link {
    color: var(--text-color-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.2s ease;
}
.checkout-container .back-to-cart-link:hover {
    color: var(--text-color);
}

/* Use the existing .btn-primary style */
.checkout-container #paystack-button.btn-primary {
    flex-grow: 1;
}

/* --- Desktop Layout --- */
@media (min-width: 992px) {
    .checkout-container .checkout-grid {
        grid-template-columns: 4fr 6fr; 
    }
    .checkout-container .checkout-form {
        order: 2; /* Move form to the right */
    }
    .checkout-container .checkout-summary {
        order: 1; /* Move summary to the left */
        position: sticky;
        top: 100px; /* Match header height */
        align-self: start;
    }
}


/* Cart success/error messages */
.cart-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.cart-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}