:root {
    /* Color Palette */
    --primary-gradient: linear-gradient(135deg, #34d399 0%, #10b981 100%);
    --primary-color: #10B981;
    --primary-hover: #059669;

    --secondary-color: #1e293b;
    /* Dark Slate */
    --text-color: #334155;
    /* Slate 700 */
    --label-color: #475569;
    /* Slate 600 */

    --danger-color: #ef4444;
    --danger-gradient: linear-gradient(135deg, #f87171 0%, #ef4444 100%);

    /* Glassmorphism Variables */
    --glass-bg: rgba(255, 255, 255, 0.4);
    --glass-border: 1px solid rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
    --backdrop-blur: blur(12px);

    /* Layout */
    --sidebar-width: 260px;
    --header-height: 70px;
    --border-radius: 20px;

    /* Compatibility */
    --border-color: rgba(255, 255, 255, 0.3);
}

/* Base colour behind the page, so a page change never shows bare white. */
html {
    background-color: #f3f4f6;
}

/* Moving between sections: a short crossfade instead of a hard reload. The sidebar and
   top bar keep their place. Browsers without cross-document view transitions just
   navigate normally. */
@media (prefers-reduced-motion: no-preference) {
    @view-transition {
        navigation: auto;
    }

    .sidebar {
        view-transition-name: admin-sidebar;
    }

    .top-bar {
        view-transition-name: admin-topbar;
    }

    ::view-transition-old(root),
    ::view-transition-new(root) {
        animation-duration: 180ms;
    }
}

/* Badge Styles */
.badge-active {
    background: rgba(16, 185, 129, 0.2);
    color: #065f46;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-inactive {
    background: rgba(239, 68, 68, 0.2);
    color: #991b1b;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Edit Button Style */
.btn-edit {
    background: rgba(255, 255, 255, 0.6) !important;
    color: var(--text-color) !important;
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    margin-right: 8px;
}

.btn-edit:hover {
    background: rgba(255, 255, 255, 0.9) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    /* Mesh Gradient Background */
    background: radial-gradient(at 0% 0%, hsla(253, 16%, 7%, 1) 0, transparent 50%),
        radial-gradient(at 50% 0%, hsla(225, 39%, 30%, 1) 0, transparent 50%),
        radial-gradient(at 100% 0%, hsla(339, 49%, 30%, 1) 0, transparent 50%);
    background: linear-gradient(120deg, #e0c3fc 0%, #8ec5fc 100%);
    /* Fallback / Lighter option */
    background: radial-gradient(circle at top left, #a78bfa, transparent 50%),
        radial-gradient(circle at top right, #34d399, transparent 50%),
        radial-gradient(circle at bottom right, #f472b6, transparent 50%),
        radial-gradient(circle at bottom left, #60a5fa, transparent 50%);
    background-color: #f3f4f6;
    /* Base color */
    background-attachment: fixed;
    background-size: cover;

    color: var(--text-color);
    margin: 0;
    padding: 0;
    display: flex;
    min-height: 100vh;
}

/* Glass Panel Utility */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: var(--border-radius);
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    position: fixed;
    left: 20px;
    top: 20px;
    bottom: 20px;
    z-index: 100;

    /* Glass Style */
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
    border-radius: var(--border-radius);

    display: flex;
    flex-direction: column;
    padding: 10px 0;
    box-sizing: border-box;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 32px;
    margin-bottom: 20px;
    /* No border for cleaner look */
}

.logo {
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--secondary-color);
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-links {
    flex: 1;
    padding: 0 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    color: var(--text-color);
    text-decoration: none;
    font-weight: 600;
    border-radius: 14px;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.5);
    color: var(--primary-color);
    transform: translateX(4px);
}

.nav-item.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

/* Main Content */
.main-content {
    margin-left: calc(var(--sidebar-width) + 40px);
    /* Sidebar width + gaps */
    margin-right: 20px;
    padding-top: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.top-bar {
    height: var(--header-height);
    /* Floating Glass Header */
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--border-radius);
    margin-bottom: 30px;

    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 32px;
    gap: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.user-info {
    font-weight: 600;
    color: var(--secondary-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 38px;
    height: 38px;
    background: var(--primary-gradient);
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 15px;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
}

.logout-btn {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--danger-color);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    padding: 10px 20px;
    border-radius: 10px;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    transform: translateY(-1px);
}

.content-wrapper {
    /* No padding here, we use the gaps defined in main-content */
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
}

/* Cards (Glass Panels) */
.card {
    background: var(--glass-bg);
    backdrop-filter: var(--backdrop-blur);
    -webkit-backdrop-filter: var(--backdrop-blur);
    border: var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: var(--border-radius);
    padding: 40px;
    margin-bottom: 30px;
}

h2 {
    color: var(--secondary-color);
    font-size: 1.5rem;
    margin-top: 0;
    margin-bottom: 30px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.full-width {
    grid-column: span 2;
}

.form-group {
    margin-bottom: 0;
    /* Handled by grid gap */
}

label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--secondary-color);
    font-size: 0.9rem;
    letter-spacing: 0.01em;
}

input,
select,
textarea {
    width: 100%;
    padding: 14px 18px;
    /* Glass Input */
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    box-sizing: border-box;
    font-size: 0.95rem;
    color: var(--secondary-color);
    transition: all 0.2s;
    font-family: inherit;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.03);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.8);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

/* Toggle Switch */
.toggle-switch {
    display: flex;
    align-items: center;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.4);
    padding: 8px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    width: fit-content;
}

.toggle-switch input {
    display: none;
}

.toggle-slider {
    width: 48px;
    height: 26px;
    background-color: #cbd5e1;
    border-radius: 24px;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    margin-right: 12px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-slider::before {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked+.toggle-slider {
    background: var(--primary-gradient);
}

input:checked+.toggle-slider::before {
    transform: translateX(22px);
}

.toggle-label {
    font-weight: 600;
    color: var(--secondary-color);
}

/* Image Preview */
.image-input-wrapper {
    display: flex;
    gap: 20px;
    align-items: center;
}

.image-preview {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    background-color: rgba(255, 255, 255, 0.5);
    border: 1px dashed var(--label-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

/* Buttons */
.btn {
    background: var(--primary-gradient);
    color: white;
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    width: auto;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.6);
    color: var(--secondary-color);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.9);
    transform: translateY(-1px);
}

.delete-btn {
    background: rgba(254, 226, 226, 0.5) !important;
    color: var(--danger-color) !important;
    border: 1px solid rgba(239, 68, 68, 0.2) !important;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.delete-btn:hover {
    background: rgba(239, 68, 68, 0.1) !important;
}

/* Lists */
.product-item {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 12px;
    display: flex;
    /* Assuming it was flex, or adding it for better layout */
    justify-content: space-between;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: transform 0.2s;
}

.product-item:hover {
    transform: scale(1.01);
    background: rgba(255, 255, 255, 0.7);
}

.product-info h3 {
    color: var(--secondary-color);
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 6px;
    margin-top: 0;
}

.product-info p {
    color: var(--label-color);
    font-size: 0.95rem;
    margin: 4px 0;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--secondary-color);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    margin-right: 16px;
}

/* Responsive */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-120%);
        transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
        box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
        /* Stronger shadow when active */
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 20px;
        margin-right: 20px;
    }

    .top-bar {
        padding: 0 20px;
        justify-content: space-between;
        /* To space menu button and user info */
    }

    .mobile-menu-btn {
        display: block;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .full-width {
        grid-column: auto;
    }

    /* Adjust specific elements for mobile */
    .product-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .product-item>div:last-child {
        width: 100%;
        display: flex;
        justify-content: flex-end;
    }

    h2 {
        font-size: 1.25rem;
    }

    .card {
        padding: 20px;
    }

    /* Stack the search bar area */
    .card>div[style*="justify-content: space-between"] {
        flex-direction: column;
        align-items: stretch !important;
        gap: 16px;
    }

    .card>div>input[type="text"] {
        width: 100% !important;
    }
}