@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
    /* New Design Tokens */
    --primary: #1173d4;
    --primary-hover: #0f62b5;

    --bg-light: #f6f7f8;
    --bg-dark: #101922;

    --surface-light: #ffffff;
    --surface-dark: #1a2632;

    --text-primary-light: #111418;
    --text-primary-dark: #f0f2f4;

    --text-secondary-light: #617589;
    --text-secondary-dark: #9ba8b8;

    --border-light: #f0f2f4;
    --border-dark: #2a3b4c;

    /* Semantic Aliases (Transitioning) */
    --color-primary: var(--primary);
    --color-bg-body: var(--bg-light);
    --color-bg-surface: var(--surface-light);
    --color-text-main: var(--text-primary-light);
    --color-text-muted: var(--text-secondary-light);
    --color-border: var(--border-light);

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

    /* Radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-full: 9999px;
}

/* Dark Mode Overrides */
html.dark {
    --color-bg-body: var(--bg-dark);
    --color-bg-surface: var(--surface-dark);
    --color-text-main: var(--text-primary-dark);
    --color-text-muted: var(--text-secondary-dark);
    --color-border: var(--border-dark);
}

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

body {
    font-family: 'Manrope', sans-serif;
    background-color: var(--color-bg-body);
    color: var(--color-text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s, color 0.3s;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--color-text-main);
    letter-spacing: -0.02em;
}

a {
    text-decoration: none;
    color: inherit;
    transition: 0.3s;
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
}

/* --- Layout --- */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.main-content {
    min-height: 80vh;
    padding: 2rem 0;
}

/* --- Navigation & Header --- */
.sticky-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: var(--surface-light);
    border-bottom: 1px solid var(--color-border);
    transition: all 0.3s ease;
}

html.dark .sticky-header {
    background-color: rgba(16, 25, 34, 0.8);
}

/* --- Buttons --- */
.btn-premium {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    background-color: var(--primary);
    color: white;
    font-weight: 700;
    border-radius: var(--radius-md);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    cursor: pointer;
    gap: 0.5rem;
}

.btn-premium:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(17, 115, 212, 0.25);
}

.btn-premium:active {
    transform: translateY(0);
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    background-color: transparent;
    color: var(--color-text-main);
    font-weight: 600;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    transition: all 0.2s;
    cursor: pointer;
}

.btn-outline:hover {
    background-color: var(--color-bg-body);
    border-color: var(--color-text-main);
}

/* --- Form Fields --- */
.form-input-premium {
    width: 100%;
    background-color: var(--color-bg-body);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0.625rem 1rem;
    color: var(--color-text-main);
    transition: all 0.2s;
}

.form-input-premium:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(17, 115, 212, 0.1);
}

/* --- Auth Box --- */
.auth-box {
    background-color: var(--color-bg-surface);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 440px;
    border: 1px solid var(--color-border);
}

.auth-links {
    margin-top: 24px;
    font-size: 0.9rem;
}

.auth-links a {
    color: var(--color-primary);
    font-weight: 600;
}

/* --- Product Grid --- */
.section-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 2rem;
    text-align: left;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (min-width: 768px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.5rem;
    }
}

.product-card {
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.product-image-container {
    position: relative;
    aspect-ratio: 3/4;
    overflow: hidden;
    border-radius: var(--radius-md);
    background-color: var(--color-bg-body);
    margin-bottom: 0.75rem;
}

.product-image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.product-overlay-btn {
    position: absolute;
    bottom: 0.75rem;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 1.5rem);
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    color: var(--text-primary-light);
    font-size: 0.875rem;
    font-weight: 700;
    padding: 0.625rem;
    border-radius: var(--radius-md);
    opacity: 0;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
}

html.dark .product-overlay-btn {
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
}

.product-card:hover .product-overlay-btn {
    opacity: 1;
}

.product-info h3 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--color-text-main);
}

.product-price {
    font-size: 0.875rem;
    font-weight: 800;
    color: var(--primary);
}

/* --- Cart Page --- */
.cart-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 32px;
    background: var(--color-bg-surface);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.cart-table th {
    background: var(--color-bg-body);
    padding: 16px 24px;
    text-align: left;
    font-weight: 600;
    color: var(--color-text-muted);
}

.cart-table td {
    padding: 24px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

.cart-product-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.cart-product-info img {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
}

.cart-summary {
    background: var(--color-bg-surface);
    padding: 32px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    max-width: 400px;
    margin-left: auto;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--color-border);
}

.summary-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-dark);
    margin-bottom: 24px;
}

.dropdown-premium {
    background-color: var(--surface-light);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1);
    padding: 0.5rem;
    min-width: 260px;
    margin-top: 0.5rem !important;
    animation: dropdownFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: top right;
}

.dropdown-menu-end.dropdown-premium {
    right: 0 !important;
    left: auto !important;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.dropdown-item-premium {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1rem;
    border-radius: 12px;
    color: var(--color-text-main);
    font-size: 0.9375rem;
    font-weight: 600;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.dropdown-item-premium:hover {
    background-color: var(--bg-light);
    color: var(--primary);
    transform: translateX(4px);
}

.dropdown-item-premium .material-symbols-outlined {
    font-size: 1.25rem;
    color: var(--color-text-muted);
    transition: color 0.2s;
}

.dropdown-item-premium:hover .material-symbols-outlined {
    color: var(--color-text-main);
}

.dropdown-item-premium.text-danger:hover {
    background-color: #fff1f2;
    color: #e11d48;
}

.dropdown-item-premium.text-danger:hover .material-symbols-outlined {
    color: #e11d48;
}

.dropdown-divider-premium {
    height: 1px;
    background-color: var(--color-border);
    margin: 0.625rem 0.5rem;
    opacity: 0.6;
}

.header-user-badge {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.dropdown {
    position: relative;
}

/* --- Social Icons --- */
.social-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: var(--bg-light);
    color: var(--color-text-muted);
    transition: all 0.2s;
}

.social-icon:hover {
    background-color: var(--primary);
    color: white;
    transform: translateY(-2px);
}

/* --- Footer --- */
.main-footer {
    background: var(--color-text-main);
    color: #fff;
    padding: 64px 0 32px;
    margin-top: 80px;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
    margin-bottom: 48px;
}

.footer-col h3 {
    color: #fff;
    margin-bottom: 24px;
    font-size: 1.2rem;
}

.footer-col a {
    display: block;
    color: #b2bec3;
    margin-bottom: 12px;
}

.footer-col a:hover {
    color: var(--color-accent);
    transform: translateX(5px);
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 32px;
    text-align: center;
    color: #636e72;
}

/* Alerts */
.alert {
    padding: 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
}

.alert-danger {
    background: #ffebee;
    color: #c0392b;
    border: 1px solid #ffccd5;
}

.alert-success {
    background: #e8f8f5;
    color: #27ae60;
    border: 1px solid #a3e4d7;
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 16px;
    }

    .main-nav {
        display: none;
    }

    /* Mobile menu needed */
    .cart-table {
        display: block;
        overflow-x: auto;
    }
}