/* ===== Admin Dashboard Styles ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ===== ANIMATIONS ===== */
@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg-dark: #09090b;
    --bg-card: #18181b;
    --bg-elevated: #27272a;
    --bg-input: #09090b;
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --accent: #8b5cf6;
    --accent-hover: #7c3aed;
    --accent-glow: rgba(139, 92, 246, 0.15);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --success: #22c55e;
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.15);
    --radius: 0.75rem;
    --radius-lg: 1rem;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    --transition: 150ms ease;
}

[data-theme="light"] {
    --bg-dark: #f5f5f5;
    --bg-card: #ffffff;
    --bg-elevated: #f0f0f0;
    --bg-input: #ffffff;
    --text-primary: #1a1a2e;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --accent: #f0a500;
    --accent-hover: #d4920a;
    --accent-glow: rgba(240, 165, 0, 0.12);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.08);
    --success: #22c55e;
    --border: #e5e5e5;
    --border-hover: #d4d4d4;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

html {
    font-size: 16px;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s, color 0.3s;
}

/* ===== LOGIN PAGE ===== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-dark);
    position: relative;
    overflow: hidden;
}

/* Ambient glow blobs */
.login-wrapper::before {
    content: '';
    position: absolute;
    top: -30%;
    left: -20%;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.12), transparent 70%);
    filter: blur(80px);
    pointer-events: none;
}

.login-wrapper::after {
    content: '';
    position: absolute;
    bottom: -30%;
    right: -20%;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(217, 70, 239, 0.1), transparent 70%);
    filter: blur(80px);
    pointer-events: none;
}

.login-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    padding: 3rem 2.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    text-align: center;
}

.login-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: linear-gradient(135deg, #8b5cf6, #d946ef);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    color: white;
}

.login-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.login-card .subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.login-card .form-group {
    text-align: left;
    margin-bottom: 1.5rem;
}

.login-card .btn-primary {
    width: 100%;
    padding: 0.875rem;
    font-size: 1rem;
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.login-card .btn-primary:hover {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.login-back {
    display: inline-block;
    margin-top: 2rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color var(--transition);
}

.login-back:hover {
    color: var(--text-primary);
}

.error-msg {
    background: var(--danger-bg);
    color: var(--danger);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
}

/* ===== DASHBOARD LAYOUT ===== */
.dashboard {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    padding: 1.5rem;
    z-index: 10;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    margin-bottom: 2rem;
    padding: 0.25rem 0;
}

.brand ion-icon {
    font-size: 1.5rem;
    color: var(--accent);
}

.nav-section-label {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 0.5rem;
    padding-left: 0.75rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: var(--radius);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition);
    margin-bottom: 2px;
}

.nav-link:hover {
    background: var(--accent-glow);
    color: var(--text-primary);
}

.nav-link.active {
    background: var(--accent-glow);
    color: var(--accent);
}

.nav-link ion-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.nav-badge {
    margin-left: auto;
    background: var(--accent);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.nav-link.danger {
    color: var(--danger);
}

.nav-link.danger:hover {
    background: var(--danger-bg);
}

/* Main Content */
.main {
    flex: 1;
    margin-left: 260px;
    padding: 2rem 2.5rem;
    min-height: 100vh;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
}

.page-header .meta {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* ===== CARDS ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

.card-title ion-icon {
    font-size: 1.25rem;
    color: var(--accent);
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 1.25rem;
}

.label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

.input {
    display: block;
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.input::placeholder {
    color: var(--text-muted);
}

.input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.input[type="file"] {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
}

.input[type="file"]::file-selector-button {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border);
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    cursor: pointer;
    margin-right: 0.75rem;
    transition: background var(--transition);
}

.input[type="file"]::file-selector-button:hover {
    background: var(--border-hover);
}

/* Color Scheme for Date Inputs */
input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.875rem;
    font-family: inherit;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.25);
}

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
    font-weight: 500;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

/* ===== CONTENT LAYOUT ===== */
.content-grid {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 2rem;
    align-items: start;
}

/* ===== ITEM GRID ===== */
.item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    max-height: none;
    overflow: visible;
}

@media (min-width: 640px) {
    .item-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

@media (min-width: 1024px) {
    .item-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

.item-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color var(--transition), transform var(--transition);
    position: relative;
}

.item-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.item-card:hover .delete-text {
    display: inline !important;
}

.item-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
    background: #000;
}

/* Mobile: Always show delete button text */
@media (max-width: 768px) {
    .item-card .delete-text {
        display: inline !important;
    }
}

.item-info {
    padding: 0.875rem;
}

.item-name {
    font-weight: 600;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.25rem;
}

.item-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
    text-align: center;
    grid-column: 1 / -1;
}

.empty-state ion-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.empty-state p {
    font-size: 0.9rem;
}

/* ===== MOBILE TOP BAR ===== */
.mobile-topbar {
    display: none;
    /* Hidden on desktop */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3.5rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 0 1rem;
    align-items: center;
    justify-content: space-between;
    z-index: 100;
}

.hamburger {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== THEME TOGGLE BUTTON ===== */
.theme-toggle-admin {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    margin-top: 0.5rem;
    border: 1px solid var(--border);
}

.theme-toggle-admin:hover {
    background: var(--accent-glow);
    color: var(--accent);
    border-color: var(--accent);
}

.theme-toggle-admin ion-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* ===== MOBILE MENU OVERLAY ===== */
.mobile-menu {
    display: none;
    /* Hidden on desktop */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-card);
    z-index: 200;
    flex-direction: column;
    padding: 0;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.mobile-menu.open {
    display: flex;
    transform: translateX(0);
}

.mobile-topbar .brand {
    margin-bottom: 0;
}

.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.mobile-menu-header .brand {
    margin-bottom: 0;
}

.mobile-menu-nav {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.mobile-menu-nav .nav-link {
    font-size: 1rem;
    padding: 0.875rem 1rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .mobile-topbar {
        display: flex;
    }

    .mobile-menu {
        display: flex;
        /* Enables flex but still off-screen via translateX */
    }

    .sidebar {
        display: none;
    }

    .main {
        margin-left: 0;
        padding: 1rem;
        padding-top: 4.5rem;
        /* Space for fixed mobile topbar */
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .page-header h1 {
        font-size: 1.375rem;
    }
}