/* --- PUBLIC NAVBAR --- */
.public-navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 5%;
    background-color: rgba(18, 18, 18, 0.95);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--medium-gray);
}

.public-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.public-logo img {
    max-width: 120px;
    height: auto;
}

.public-nav-links {
    display: flex;
    gap: 30px;
    list-style: none;
}

.public-nav-links a {
    color: var(--white);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.3s;
}

.public-nav-links a:hover {
    color: var(--red);
}

.nav-cta {
    background-color: var(--red);
    color: var(--white);
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: bold;
    transition: background 0.3s, transform 0.2s;
}

.nav-cta:hover {
    background-color: var(--bright-red);
    transform: translateY(-2px);
}

/* --- HERO SECTION --- */
.hero-section {
    position: relative;
    padding: 120px 5%;
    text-align: center;
    background: radial-gradient(circle at center, #1a1a1a 0%, var(--black) 100%);
    border-bottom: 1px solid var(--medium-gray);
    overflow: hidden;
}

.hero-section::before {
    content: "";
    position: absolute;
    top: -50%;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 600px;
    background: var(--red);
    filter: blur(250px);
    opacity: 0.15;
    z-index: 0;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    margin: 0 auto;
}

.hero-content h1 {
    font-size: 48px;
    font-weight: 900;
    line-height: 1.2;
    margin-bottom: 20px;
    letter-spacing: -1px;
}

.hero-content h1 span {
    color: var(--red);
}

.hero-content p {
    color: var(--text-muted);
    font-size: 18px;
    margin-bottom: 40px;
    line-height: 1.6;
}

.hero-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.btn-primary, .btn-secondary {
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--red);
    color: var(--white);
    border: 2px solid var(--red);
}

.btn-primary:hover {
    background-color: var(--bright-red);
    border-color: var(--bright-red);
    box-shadow: 0 10px 20px rgba(211, 47, 47, 0.3);
}

.btn-secondary {
    background-color: transparent;
    color: var(--white);
    border: 2px solid var(--medium-gray);
}

.btn-secondary:hover {
    border-color: var(--white);
    background-color: rgba(255, 255, 255, 0.05);
}

/* --- SECTION HEADERS --- */
.section-container {
    padding: 80px 5%;
}

.section-title {
    text-align: center;
    margin-bottom: 50px;
}

.section-title h2 {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 10px;
}

.section-title p {
    color: var(--red);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* --- PRODUCT GRID --- */
.public-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 30px;
}

.public-product-card {
    background: var(--dark-gray);
    border-radius: 12px;
    border: 1px solid var(--medium-gray);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
}

.public-product-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.6);
    border-color: #333;
}

.card-img-wrapper {
    height: 200px;
    background: #0a0a0a;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-bottom: 1px solid var(--medium-gray);
}

.card-img-wrapper img {
    max-width: 80%;
    max-height: 80%;
    object-fit: contain;
    transition: transform 0.5s;
}

.public-product-card:hover .card-img-wrapper img {
    transform: scale(1.1);
}

.card-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card-brand {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--white);
    margin-bottom: 15px;
    line-height: 1.3;
}

.card-footer {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.card-price {
    font-size: 20px;
    font-weight: 900;
    color: var(--red);
}

.view-btn {
    background: rgba(211, 47, 47, 0.1);
    color: var(--red);
    border: 1px solid var(--red);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    text-decoration: none;
    transition: 0.3s;
}

.view-btn:hover {
    background: var(--red);
    color: var(--white);
}

/* Responsive */
@media (max-width: 768px) {
    .public-nav-links {
        display: none; /* Hide main links on mobile for simplicity, or implement a hamburger */
    }
    .hero-content h1 {
        font-size: 36px;
    }
    .hero-buttons {
        flex-direction: column;
    }
}

/* Dashboard Specific Layout */
body {
    background-color: var(--black);
    color: var(--white);
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    overflow-y: auto; /* Override login page overflow */
    padding: 0; /* Override login page padding */
}

/* --- SIDEBAR --- */
.sidebar {
    width: 260px;
    height: 100vh;
    background-color: var(--dark-gray);
    border-right: 1px solid var(--medium-gray);
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-logo {
    padding: 25px 20px;
    font-size: 24px;
    font-weight: 900;
    letter-spacing: -1px;
    color: var(--red);
    border-bottom: 1px solid var(--medium-gray);
    text-align: center;
}

.sidebar-logo span {
    color: var(--white);
}

.nav-links {
    list-style: none;
    padding: 20px 0;
    flex: 1;
}

.nav-links li {
    padding: 5px 20px;
}

.nav-links a {
    display: block;
    padding: 12px 20px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.nav-links a:hover, .nav-links a.active {
    background-color: var(--red);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(211, 47, 47, 0.3);
}

/* --- MAIN WRAPPER --- */
.main-wrapper {
    margin-left: 260px;
    width: calc(100% - 260px);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --- HEADER --- */
.top-header {
    height: 75px;
    background-color: var(--dark-gray);
    border-bottom: 1px solid var(--medium-gray);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 98; /* Lowered slightly to 98 so sidebar can cover it */
}

/* Hamburger Menu & Overlay */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--white);
    font-size: 24px;
    cursor: pointer;
    margin-right: 15px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    z-index: 99;
}

.header-title {
    display: flex;
    align-items: center;
}

.header-title h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--white);
}

/* Account Menu */
.account-menu {
    position: relative;
    display: flex;
    align-items: center;
    gap: 15px;
}

.account-info {
    text-align: right;
    display: flex;
    flex-direction: column;
}

.account-name {
    font-size: 14px;
    font-weight: bold;
    color: var(--white);
}

.account-role {
    font-size: 12px;
    color: var(--red);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.avatar {
    width: 40px;
    height: 40px;
    background-color: var(--medium-gray);
    border: 2px solid var(--red);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--white);
}

.logout-btn-header {
    padding: 8px 15px;
    background-color: transparent;
    border: 1px solid var(--red);
    color: var(--red);
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: 0.3s;
}

.logout-btn-header:hover {
    background-color: var(--red);
    color: var(--white);
}

/* --- CONTENT AREA --- */
.content-area {
    flex: 1;
    padding: 40px;
    background-color: var(--black);
}

.welcome-card {
    background: var(--dark-gray);
    padding: 30px;
    border-radius: 12px;
    border-top: 4px solid var(--red);
    margin-bottom: 30px;
}

.welcome-card h3 {
    margin-bottom: 10px;
    font-size: 24px;
}

.welcome-card p {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
}

/* --- FOOTER --- */
.dashboard-footer {
    text-align: center;
    padding: 20px;
    background-color: var(--dark-gray);
    border-top: 1px solid var(--medium-gray);
    color: var(--text-muted);
    font-size: 13px;
}

/* Responsive Layout for Mobile */
@media (max-width: 768px) {
    .menu-toggle {
        display: block; /* Show hamburger menu on mobile */
    }
    .sidebar {
        width: 260px; /* Keep fixed width */
        height: 100vh;
        position: fixed;
        border-right: 1px solid var(--medium-gray);
        border-bottom: none;
        transform: translateX(-100%); /* Hide completely to the left by default */
        transition: transform 0.3s ease;
        z-index: 100;
    }
    .sidebar.active {
        transform: translateX(0); /* Slide in when active */
    }
    .sidebar-overlay.active {
        display: block; /* Show dark background when active */
    }
    .main-wrapper {
        margin-left: 0;
        width: 100%;
    }
    .top-header {
        padding: 0 15px;
    }
    .content-area {
        padding: 20px;
    }
    .account-info {
        display: none; /* Hide name text on small phones to save space */
    }
}

/* Product Card */

.action-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
    padding: 0 10px;
}

.action-header h3 { 
    font-size: 20px; 
}

/* --- BUTTONS --- */
.add-btn {
    background: var(--red);
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    font-weight: bold;
    transition: 0.3s;
}

.add-btn:hover { 
    background: var(--bright-red); 
}

/* --- PRODUCT GRID --- */
.products-grid {
    display: grid;
    /* repeat(auto-fill, 280px) ensures uniform size and prevents hideous stretching */
    grid-template-columns: repeat(auto-fill, 280px);
    gap: 25px;
    justify-content: center; 
    position: relative;
    min-height: 400px;
}

/* --- PRODUCT CARD --- */
.product-card {
    position: relative; /* Essential for the stretched link */
    cursor: pointer;
    background: var(--dark-gray);
    border-radius: 15px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(255,255,255,0.05);
    display: flex;
    flex-direction: column;
    width: 280px;
    height: 100%;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.4);
    border-color: var(--red);
}

.card-image-wrapper {
    width: 100%;
    height: 220px;
    background: #1a1a1a;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover; 
    transition: transform 0.5s ease;
}

.card-info {
    padding: 20px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* The "Magic" Link that covers the whole card */
.main-card-link::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1; /* Covers everything below it */
}
/* Ensure price/admin rows stay on top of the link if you need buttons there later */
.admin-prices, .add-to-cart-btn {
    position: relative;
    z-index: 2;
}

/* --- TEXT & LABELS --- */
.product-category {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--red);
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.product-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--white);
    margin-bottom: 12px;
    text-decoration: none;
    line-height: 1.4;
    display: block;
    min-height: 45px; /* Ensures alignment even with different title lengths */
}

.product-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

/* --- PRICING --- */
.price-section { 
    margin-top: auto; 
}

.price-label { 
    font-size: 11px; 
    color: var(--text-muted); 
    display: block; 
    margin-bottom: 2px; 
}

.main-price { 
    font-size: 22px; 
    font-weight: 800; 
    color: var(--white); 
}

.admin-prices {
    background: rgba(206, 206, 206, 0.3);
    padding: 10px;
    border-radius: 10px;
    margin-top: 10px;
    font-size: 11px;
}

.admin-price-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.admin-price-row .val { 
    color: var(--white); 
    font-weight: 600; 
}

/* --- UTILITIES --- */
.loading-overlay {
    grid-column: 1 / -1;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 100px 0;
}

.loading-overlay.active { 
    display: flex; 
}

.spinner {
    width: 40px; 
    height: 40px;
    border: 4px solid rgba(211, 47, 47, 0.2);
    border-top: 4px solid var(--red);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { 
    100% { transform: rotate(360deg); } 
}

/* --- RESPONSIVE ADJUSTMENTS --- */
@media (max-width: 768px) {
    .products-grid { 
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); 
        gap: 15px; 
    }
    .product-card { 
        width: 100%; 
    }
    .card-image-wrapper { 
        height: 160px; 
    }
    .product-title { 
        font-size: 14px; 
        min-height: auto; 
    }
    .main-price { 
        font-size: 18px; 
    }
    .action-header { 
        flex-direction: column; 
        align-items: flex-start; 
        gap: 10px; 
    }
}