/* --- ADMIN CONTROLS DESIGN SYSTEM --- */
:root {
    --admin-primary: #2563eb;
    --admin-primary-dark: #1d4ed8;
    --admin-dark: #0f172a;
    --admin-bg: #f8fafc;
    --admin-sidebar: #0f172a;
    --admin-card-bg: #ffffff;
    --admin-text: #1e293b;
    --admin-border: #e2e8f0;
    --ease-modern: cubic-bezier(0.22, 1, 0.36, 1);
    --admin-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --admin-shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] {
    --admin-bg: #050505;
    --admin-sidebar: #09090b;
    --admin-card-bg: #121214;
    --admin-text: #f8fafc;
    --admin-border: rgba(255, 255, 255, 0.1);
    --admin-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --admin-shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.8);
}

body.admin-body {
    font-family: 'Inter', sans-serif;
    background-color: var(--admin-bg);
    color: var(--admin-text);
    margin: 0;
    padding: 0;
    transition: background-color 0.3s var(--ease-modern);
    -webkit-font-smoothing: antialiased;
}

/* --- LOGIN SCREEN --- */
.login-container {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #1e3a8a, #020617);
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 3rem 2.5rem;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    color: #ffffff;
    text-align: center;
}

.login-logo {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--admin-primary);
    margin-bottom: 0.5rem;
}

.login-subtitle {
    font-size: 0.85rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 2rem;
}

.login-card label {
    display: block;
    text-align: left;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #cbd5e1;
}

.login-card input {
    width: 100%;
    padding: 0.85rem 1rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(15, 23, 42, 0.5);
    color: #ffffff;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    transition: all 0.3s;
}

.login-card input:focus {
    outline: none;
    border-color: var(--admin-primary);
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

.login-btn {
    width: 100%;
    padding: 0.85rem;
    background: linear-gradient(135deg, var(--admin-primary), #0ea5e9);
    border: none;
    color: #ffffff;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1rem;
    transition: all 0.25s var(--ease-modern);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.2);
    cursor: pointer;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4);
}

.login-btn:active {
    transform: scale(0.98);
}

/* --- DASHBOARD LAYOUT --- */
.admin-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    background: var(--admin-sidebar);
    color: #94a3b8;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    border-right: 1px solid var(--admin-border);
}

.sidebar-header {
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 1.5rem;
}

.sidebar-title {
    font-family: 'Outfit', sans-serif;
    color: #ffffff;
    font-size: 1.3rem;
    font-weight: 800;
}

.sidebar-subtitle {
    font-size: 0.75rem;
    color: var(--admin-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-grow: 1;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s;
    color: #cbd5e1;
}

.sidebar-menu li a:hover, .sidebar-menu li.active a {
    background: rgba(59, 130, 246, 0.15);
    color: var(--admin-primary);
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 1.5rem;
}

.logout-btn {
    width: 100%;
    padding: 0.75rem;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
    transition: all 0.3s;
}

.logout-btn:hover {
    background: #ef4444;
    color: #ffffff;
}

/* Main Workspace */
.main-content {
    display: flex;
    flex-direction: column;
}

.top-bar {
    height: 70px;
    background: var(--admin-card-bg);
    border-bottom: 1px solid var(--admin-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
}

.top-bar h2 {
    font-size: 1.4rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

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

.content-pane {
    padding: 2.5rem;
    flex-grow: 1;
    overflow-y: auto;
    max-height: calc(100vh - 70px);
}

/* --- STATS GRID --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--admin-card-bg);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--admin-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--admin-shadow);
    transition: transform 0.3s var(--ease-modern), box-shadow 0.3s var(--ease-modern), border-color 0.3s var(--ease-modern);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--admin-shadow-hover);
    border-color: rgba(59, 130, 246, 0.3);
}

.stat-info h3 {
    font-size: 0.85rem;
    color: #64748b;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
    letter-spacing: 0.5px;
}

.stat-info p {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--admin-text);
}

.stat-icon {
    font-size: 1.8rem;
    color: var(--admin-primary);
    opacity: 0.8;
    transition: transform 0.4s var(--ease-modern), opacity 0.4s var(--ease-modern);
}

.stat-card:hover .stat-icon {
    transform: scale(1.15) rotate(5deg);
    opacity: 1;
}

/* --- DATA TABLE / CRUD LIST --- */
.panel {
    background: var(--admin-card-bg);
    border: 1px solid var(--admin-border);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.panel-header h3 {
    font-size: 1.25rem;
}

.admin-table-container {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.admin-table th {
    background: var(--admin-bg);
    padding: 1rem;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: #64748b;
    border-bottom: 2px solid var(--admin-border);
}

.admin-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--admin-border);
    font-size: 0.95rem;
}

.admin-table tr:hover {
    background: rgba(59, 130, 246, 0.03);
}

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

.btn-sm {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.8rem;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s var(--ease-modern);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-sm:active {
    transform: scale(0.95);
}

.btn-edit {
    background: rgba(59, 130, 246, 0.1);
    color: var(--admin-primary);
}

.btn-edit:hover {
    background: var(--admin-primary);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
    transform: translateY(-2px);
}

.btn-delete {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.btn-delete:hover {
    background: #ef4444;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.3);
    transform: translateY(-2px);
}

/* --- FORMS & INPUTS --- */
.admin-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-field label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
}

.form-field input, .form-field select, .form-field textarea {
    padding: 0.85rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--admin-border);
    background: var(--admin-bg);
    color: var(--admin-text);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.25s var(--ease-modern);
}

.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
    outline: none;
    border-color: var(--admin-primary);
    background: var(--admin-card-bg);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
    transform: translateY(-1px);
}

/* Drag and Drop File Upload Area */
.upload-dropzone {
    border: 2px dashed var(--admin-border);
    border-radius: 10px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    background: var(--admin-bg);
    transition: all 0.3s;
}

.upload-dropzone.dragover {
    border-color: var(--admin-primary);
    background: rgba(59, 130, 246, 0.05);
}

.upload-dropzone i {
    font-size: 2rem;
    color: #64748b;
    margin-bottom: 0.75rem;
}

.upload-dropzone p {
    font-size: 0.9rem;
    color: #64748b;
}

.upload-preview {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.upload-preview img {
    max-width: 80px;
    max-height: 80px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--admin-border);
}

/* --- MODAL DIALOGS --- */
.admin-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    transition: opacity 0.3s var(--ease-modern);
}

.admin-modal.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--admin-card-bg);
    border: 1px solid var(--admin-border);
    width: 100%;
    max-width: 650px;
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: var(--admin-shadow-hover);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(20px);
    transition: transform 0.4s var(--ease-modern);
}

.admin-modal.active .modal-content {
    transform: scale(1) translateY(0);
}

.modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: #64748b;
}

.modal-header {
    margin-bottom: 2rem;
}

.modal-header h3 {
    font-size: 1.5rem;
}

/* Alert Message Notification */
.admin-alert {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    top: auto;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    color: #ffffff;
    font-weight: 600;
    box-shadow: var(--admin-shadow-hover);
    z-index: 100000;
    display: none;
    transform: translateX(100%);
    transition: transform 0.4s var(--ease-modern), opacity 0.4s var(--ease-modern);
    opacity: 0;
}

.admin-alert.show {
    display: block;
    transform: translateX(0);
    opacity: 1;
    animation: slideInToast 0.4s var(--ease-modern) forwards;
}

@keyframes slideInToast {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.admin-alert.success {
    background: #10b981;
}

.admin-alert.error {
    background: #ef4444;
}

/* MOCK CHART VISUAL */
.analytics-chart-container {
    height: 250px;
    margin-top: 1.5rem;
    display: flex;
    align-items: flex-end;
    gap: 1.25rem;
    padding: 1.5rem;
    background: var(--admin-bg);
    border-radius: 8px;
    border: 1px solid var(--admin-border);
}

.chart-bar-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}

.chart-bar {
    width: 32px;
    background: linear-gradient(180deg, var(--admin-primary), rgba(59, 130, 246, 0.4));
    border-radius: 4px 4px 0 0;
    height: 0;
    transition: height 1s;
    position: relative;
}

.chart-bar:hover {
    background: #1d4ed8;
}

.chart-bar-val {
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    font-weight: 700;
}

.chart-bar-label {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
}

@media (max-width: 768px) {
    .admin-layout {
        grid-template-columns: 1fr;
    }
    .sidebar {
        display: none; /* simple mobile dashboard hide sidebar, can implement menu */
    }
    .form-row-2 {
        grid-template-columns: 1fr;
        gap: 0;
    }
}
