:root {
    --primary: #4f46e5;
    --primary-light: #818cf8;
    --primary-dark: #3730a3;
    --secondary: #d946ef;
    --dark: #0f172a;
    --slate: #475569;
    --light: #f8fafc;
    --gray: #94a3b8;
    --white: #ffffff;
    --bg-surface: rgba(255, 255, 255, 0.7);
    --border-subtle: rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

a {
    text-decoration: none;
    color: inherit;
}

body {
    background-color: var(--light);
    color: var(--dark);
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Reference-Inspired Header */
header {
    background: var(--white);
    border-bottom: 2px solid #f8fafc;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

header.scrolled {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
}

.logo {
    font-size: 1.8rem;
    font-weight: 800;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.logo .magic {
    color: #1e3a8a;
    /* Deep Blue */
}

.logo .tech {
    background: linear-gradient(to right, #b8860b, #daa520);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    text-decoration: none;
    color: #1a1a1a;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s;
    padding: 0;
}

.nav-links a:hover,
.nav-links a.active {
    background: none;
    box-shadow: none;
    color: #1e3a8a;
}

.nav-actions {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.auth-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #1a1a1a;
}

.auth-links a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
}

.auth-links a:hover {
    color: #1e3a8a;
}

.auth-separator {
    color: #3b82f6;
    font-weight: 400;
    margin: 0 2px;
}

.action-btn {
    width: auto;
    height: auto;
    background: none;
    border: none;
    color: #1a1a1a;
    font-size: 1.4rem;
    position: relative;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    text-decoration: none;
}

.action-btn:hover {
    background: none;
    box-shadow: none;
    color: #1e3a8a;
    transform: scale(1.1);
}

.badge-count {
    position: absolute;
    top: -2px;
    right: -5px;
    background: #e11d48;
    /* Crimson Red */
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 17px;
    height: 17px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

/* Hero Section */
.hero {
    padding: 6rem 0;
    background: radial-gradient(circle at top right, #e0e7ff 0%, #f8fafc 100%);
    text-align: center;
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 900;
    margin-bottom: 1.5rem;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    font-size: 1.25rem;
    color: var(--gray);
    max-width: 600px;
    margin: 0 auto 2rem;
}

/* Glass Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    display: inline-block;
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--white);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--primary);
}

.btn-outline {
    border: 1px solid var(--primary);
    color: var(--primary);
    background: transparent;
}

.btn-outline:hover {
    background: var(--white);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-danger {
    background: #ef4444;
    color: var(--white);
}

.btn-danger:hover {
    background: var(--white);
    color: #ef4444;
    border: 1px solid #ef4444;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Product Cards */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    padding: 4rem 0;
}

.card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s;
    border: 1px solid #f1f5f9;
}

.card:hover {
    transform: translateY(-10px);
}

.card-img {
    width: 100%;
    height: 200px;
    background: #e2e8f0;
    object-fit: cover;
}

.card-content {
    padding: 1.5rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.card-price {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
}

/* Auth Pages */
.auth-container {
    max-width: 400px;
    margin: 4rem auto;
    padding: 2rem;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    outline: none;
}

.form-group input:focus {
    border-color: var(--primary);
}

/* Footer */
footer {
    background: var(--dark);
    color: var(--white);
    padding: 4rem 0 2rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.footer-col h4 {
    margin-bottom: 1.5rem;
}

.footer-col ul {
    list-style: none;
}

.footer-col ul li {
    margin-bottom: 0.75rem;
}

.footer-col ul a {
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.3s;
}

.footer-col ul a:hover {
    color: var(--white);
}

.footer-bottom {
    border-top: 1px solid #1e293b;
    padding-top: 2rem;
    text-align: center;
    color: #64748b;
}

/* Utilities */
.text-center {
    text-align: center;
}

.mt-2 {
    margin-top: 2rem;
}

.mb-2 {
    margin-bottom: 2rem;
}

/* --- Dashboard Layout --- */
.dashboard-layout {
    display: grid !important;
    grid-template-columns: 280px 1fr !important;
    gap: 2rem !important;
    align-items: start !important;
    margin-top: 2rem;
}

@media (max-width: 992px) {
    .dashboard-layout {
        grid-template-columns: 1fr !important;
    }
}

/* --- User Sidebar Modern Styling --- */
.user-sidebar {
    min-width: 280px;
}

.user-sidebar-inner {
    background: var(--white) !important;
    border-radius: var(--radius) !important;
    padding: 2rem !important;
    box-shadow: var(--shadow-md) !important;
    border: 1px solid #f1f5f9 !important;
    display: block !important;
}

.user-profile-header {
    text-align: center;
    margin-bottom: 2rem;
    display: block !important;
}

.user-avatar {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary), var(--secondary)) !important;
    border-radius: 50% !important;
    margin: 0 auto 1rem !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    color: white !important;
    font-size: 1.75rem !important;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

.user-name {
    font-size: 1.125rem !important;
    color: var(--dark) !important;
    margin-bottom: 0.25rem !important;
    font-weight: 700 !important;
    display: block !important;
}

.user-email {
    color: var(--gray) !important;
    font-size: 0.85rem !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block !important;
}

.user-nav-list {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.user-nav-list li {
    margin-bottom: 0.5rem;
}

.user-nav-list li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.8rem 1rem;
    border-radius: 10px;
    color: var(--slate);
    font-weight: 500;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.user-nav-list li a i {
    width: 20px;
    text-align: center;
    font-size: 1.1rem;
    color: var(--gray);
    transition: color 0.2s;
}

.user-nav-list li.active a {
    background: #f5f3ff;
    color: var(--primary);
}

.user-nav-list li.active a i {
    color: var(--primary);
}

.user-nav-list li a:hover {
    background: #f8fafc;
    color: var(--primary);
    transform: translateX(5px);
}

.user-nav-list li a:hover i {
    color: var(--primary);
}

.user-nav-list li.admin-divider,
.user-nav-list li.logout-divider {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #f1f5f9;
}

.user-nav-list li .admin-link {
    color: var(--primary);
    font-weight: 700;
}

.user-nav-list li .logout-link {
    color: #ef4444;
}

.user-nav-list li .logout-link:hover {
    background: #fef2f2;
    color: #dc2626;
}

.user-nav-list li .logout-link i {
    color: #ef4444;
}

/* --- Mobile Responsiveness --- */

@media (max-width: 1024px) {
    .container {
        padding: 0 1.5rem;
    }
}

/* Mobile Menu Toggle */
.mobile-toggle {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    background: none;
    border: none;
    color: var(--dark);
}

@media (max-width: 768px) {
    .mobile-toggle {
        display: block;
    }

    .nav-links {
        display: none;
        /* Hidden by default on mobile */
        position: absolute;
        top: 80px;
        left: 0;
        width: 100%;
        background: var(--white);
        flex-direction: column;
        padding: 2rem;
        gap: 1.5rem;
        border-bottom: 2px solid #f8fafc;
        box-shadow: var(--shadow-md);
    }

    .nav-links.active {
        display: flex;
    }

    .nav-actions {
        gap: 1rem;
    }

    .auth-links {
        display: none;
        /* Hide login/register text on mobile */
    }

    .hero {
        padding: 3rem 0;
    }

    .hero h1 {
        font-size: 2.25rem;
    }

    .hero p {
        font-size: 1rem;
        padding: 0 1rem;
    }

    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        padding: 2rem 0;
        gap: 1.5rem;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 2.5rem;
    }

    /* Column layouts across different pages */
    .user-layout-grid,
    [style*="grid-template-columns: 250px 1fr"],
    [style*="grid-template-columns: 1fr 350px"],
    [style*="grid-template-columns: 1fr 400px"] {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }

    .checkout-grid {
        grid-template-columns: 1fr !important;
    }

    .dashboard-layout {
        gap: 1.5rem;
    }

    .user-sidebar-inner {
        padding: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr !important;
    }

    h1 {
        font-size: 1.75rem;
    }

    .auth-container {
        margin: 2rem auto;
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr !important;
    }

    .logo {
        font-size: 1.4rem;
    }

    .action-btn {
        font-size: 1.2rem;
    }
}