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

:root {
    --primary: #1d76e2;
    --primary-hover: #0b5ec4;
    --primary-light: #e8f2fe;
    --secondary: #0b4293;
    --dark: #0f172a;
    --slate-700: #334155;
    --slate-600: #475569;
    --slate-500: #64748b;
    --slate-100: #f1f5f9;
    --light: #f8fafc;
    --border: #e2e8f0;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --danger-light: #fef2f2;
    --success: #22c55e;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
    --shadow-lg: 0 20px 25px -5px rgba(29, 118, 226, 0.08), 0 10px 10px -5px rgba(29, 118, 226, 0.04);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

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

body {
    font-family: var(--font-body);
    background-color: var(--slate-100);
    color: var(--slate-700);
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--dark);
    font-weight: 700;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

/* --- Login Split Screen Layout --- */
.login-wrapper {
    display: flex;
    min-height: 100vh;
}

.login-left {
    flex: 1.1;
    background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    color: #ffffff;
}

@media (max-width: 992px) {
    .login-left {
        display: none; /* Hide on tablet/mobile like screenshot */
    }
}

.login-left-content {
    max-width: 480px;
}

.login-left-icon {
    width: 68px;
    height: 68px;
    background-color: rgba(255, 255, 255, 0.15);
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
    backdrop-filter: blur(4px);
}

.login-left-icon svg {
    width: 32px;
    height: 32px;
    fill: #ffffff;
}

.login-left-content h2 {
    font-size: 2.25rem;
    color: #ffffff;
    margin-bottom: 1rem;
    font-weight: 800;
}

.login-left-content p {
    font-size: 1.05rem;
    line-height: 1.7;
    opacity: 0.9;
}

.login-right {
    flex: 0.9;
    background-color: var(--light);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-card {
    background-color: #ffffff;
    border-radius: 20px;
    padding: 3rem 2.5rem;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
    border: 1px solid var(--border);
    text-align: center;
}

.login-logo {
    width: 52px;
    height: 52px;
    background-color: var(--primary);
    color: #ffffff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem auto;
    box-shadow: 0 4px 10px rgba(29, 118, 226, 0.3);
}

.login-logo svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.login-card h3 {
    font-size: 1.4rem;
    margin-bottom: 0.25rem;
}

.login-card span {
    font-size: 0.85rem;
    color: var(--slate-500);
    display: block;
    margin-bottom: 2.5rem;
}

.login-alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    text-align: left;
}

.login-alert-danger {
    background-color: var(--danger-light);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.form-group {
    margin-bottom: 1.25rem;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--slate-600);
    margin-bottom: 0.5rem;
}

.input-icon-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--slate-400);
    display: flex;
    align-items: center;
}

.login-input {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.75rem;
    border-radius: 8px;
    border: 1.5px solid var(--border);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
    background-color: #f8fafc;
}

.login-input:focus {
    border-color: var(--primary);
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(29, 118, 226, 0.1);
}

.btn-login {
    width: 100%;
    background-color: var(--primary);
    color: #ffffff;
    border: none;
    padding: 0.85rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 10px rgba(29, 118, 226, 0.25);
    margin-top: 2rem;
    transition: var(--transition);
}

.btn-login:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(29, 118, 226, 0.35);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 500;
    margin-top: 2rem;
}

.back-link:hover {
    color: var(--primary-hover);
}

/* --- Admin Panel Dashboard Shell --- */
.admin-shell {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.admin-sidebar {
    width: 260px;
    background-color: #ffffff;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: var(--transition);
    z-index: 100;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-logo {
    width: 32px;
    height: 32px;
    background-color: var(--primary);
    color: #ffffff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-logo svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.sidebar-header h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--dark);
    line-height: 1.2;
}

.sidebar-header h2 span {
    font-size: 0.7rem;
    color: var(--slate-500);
    display: block;
}

.sidebar-menu {
    list-style: none;
    padding: 1rem 0;
    overflow-y: auto;
    flex-grow: 1;
}

.sidebar-menu-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--slate-400);
    padding: 0.75rem 1.5rem 0.25rem 1.5rem;
    font-weight: 700;
}

.menu-item a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--slate-600);
    border-left: 3px solid transparent;
}

.menu-item a:hover {
    color: var(--primary);
    background-color: var(--light);
}

.menu-item.active a {
    color: var(--primary);
    background-color: var(--primary-light);
    border-left-color: var(--primary);
    font-weight: 600;
}

.menu-item.logout-item a {
    color: var(--danger);
}

.menu-item.logout-item a:hover {
    background-color: var(--danger-light);
}

/* Sidebar Icon representation */
.menu-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Main Container Area */
.admin-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Prevents flex children blowout */
}

/* Topbar Header */
.admin-topbar {
    background-color: #ffffff;
    height: 64px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar-toggle {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--slate-600);
    cursor: pointer;
    display: none;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    background-color: var(--light);
    border: 1px solid var(--border);
    cursor: pointer;
}

.user-avatar {
    width: 26px;
    height: 26px;
    background-color: var(--primary);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.8rem;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
}

/* Content Pane */
.admin-content {
    padding: 2rem;
    flex-grow: 1;
    overflow-y: auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-title h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark);
}

.page-title p {
    font-size: 0.85rem;
    color: var(--slate-500);
}

/* Flash alerts in admin */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.alert-success {
    background-color: #f0fdf4;
    color: #16a34a;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.alert-error {
    background-color: var(--danger-light);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-close {
    background: none;
    border: none;
    color: inherit;
    font-weight: bold;
    cursor: pointer;
    font-size: 1rem;
}

/* Stats Cards Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: #ffffff;
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.stat-info h3 {
    font-size: 1.8rem;
    font-weight: 800;
}

.stat-info p {
    font-size: 0.85rem;
    color: var(--slate-500);
    font-weight: 500;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon-blue { background-color: #e0f2fe; color: #0284c7; }
.stat-icon-green { background-color: #dcfce7; color: #15803d; }
.stat-icon-amber { background-color: #fef3c7; color: #b45309; }
.stat-icon-purple { background-color: #f3e8ff; color: #7e22ce; }

/* Dashboard welcome panel */
.welcome-banner {
    background-color: #e0f2fe;
    border: 1px solid #bae6fd;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.welcome-banner h3 {
    font-size: 1.15rem;
    color: #0369a1;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.welcome-banner p {
    font-size: 0.9rem;
    color: #0c4a6e;
    line-height: 1.5;
}

/* Buttons in admin */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.55rem 1.15rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: var(--transition);
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-danger {
    background-color: var(--danger);
    color: #ffffff;
}

.btn-danger:hover {
    background-color: var(--danger-hover);
}

.btn-secondary {
    background-color: #ffffff;
    border-color: var(--border);
    color: var(--slate-700);
}

.btn-secondary:hover {
    background-color: var(--slate-100);
}

/* Data Table Panel */
.table-panel {
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}

.table-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-header h3 {
    font-size: 1.05rem;
}

.table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.data-table th {
    background-color: var(--light);
    padding: 0.85rem 1.5rem;
    font-weight: 600;
    color: var(--slate-600);
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
    text-transform: uppercase;
}

.badge-success { background-color: #dcfce7; color: #16a34a; }
.badge-danger { background-color: var(--danger-light); color: var(--danger); }
.badge-info { background-color: var(--primary-light); color: var(--primary); }

.action-btns {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    cursor: pointer;
    background: #ffffff;
    transition: var(--transition);
}

.btn-icon-edit:hover {
    border-color: var(--primary);
    color: var(--primary);
    background-color: var(--primary-light);
}

.btn-icon-delete:hover {
    border-color: var(--danger);
    color: var(--danger);
    background-color: var(--danger-light);
}

/* CRUD Form Panel */
.form-panel {
    background-color: #ffffff;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    padding: 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.form-title {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.75rem;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.form-col-span-2 {
    grid-column: 1 / -1;
}

.admin-input, .admin-select, .admin-textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border-radius: 6px;
    border: 1.5px solid var(--border);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition);
}

.admin-input:focus, .admin-select:focus, .admin-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(29, 118, 226, 0.1);
}

.admin-textarea {
    resize: vertical;
    min-height: 120px;
}

.img-preview {
    width: 120px;
    height: 120px;
    border-radius: 8px;
    border: 1.5px dashed var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-top: 0.5rem;
    background-color: var(--light);
}

.img-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Responsive queries */
@media (max-width: 768px) {
    .admin-sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        bottom: 0;
        height: 100vh;
    }

    .admin-sidebar.active {
        left: 0;
    }

    .topbar-toggle {
        display: block;
    }

    .admin-topbar {
        padding: 0 1rem;
    }

    .admin-content {
        padding: 1rem;
    }

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