/* Admin Dashboard Styles */
:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #818cf8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.5;
}

.hidden { display: none !important; }

/* Login Screen */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.logo-icon {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 16px;
}

.login-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.login-header p {
    color: var(--gray-500);
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.error-message {
    color: var(--danger);
    font-size: 14px;
    margin-bottom: 16px;
    min-height: 20px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-700);
}

.btn-secondary:hover {
    background: var(--gray-300);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: var(--gray-500);
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--gray-200);
    color: var(--gray-700);
}

/* App Layout */
.app {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--gray-900);
    color: white;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 600;
    border-bottom: 1px solid var(--gray-700);
}

.sidebar-header i {
    font-size: 24px;
    color: var(--primary-light);
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-section {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gray-500);
    padding: 16px 12px 8px;
    margin-top: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--gray-400);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 14px;
}

.nav-item:hover {
    background: var(--gray-800);
    color: white;
}

.nav-item.active {
    background: var(--primary);
    color: white;
}

.nav-item i {
    width: 20px;
    text-align: center;
}

.badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--gray-700);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.user-info i {
    font-size: 24px;
    color: var(--gray-500);
}

.sidebar-footer .btn-icon {
    color: var(--gray-400);
}

.sidebar-footer .btn-icon:hover {
    background: var(--gray-800);
    color: white;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

.top-bar {
    height: var(--topbar-height);
    background: white;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.top-bar h1 {
    font-size: 20px;
    font-weight: 600;
    flex: 1;
}

.top-bar-actions {
    display: flex;
    gap: 12px;
}

.mobile-menu { display: none; }

.content-area {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

/* Dashboard */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    color: white;
    border-radius: 12px;
    font-size: 20px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
}

.stat-label {
    font-size: 14px;
    color: var(--gray-500);
}

.dashboard-panels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.panel {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel-header h3 {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-header h3 i {
    color: var(--primary);
}

.link {
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
}

.link:hover {
    text-decoration: underline;
}

.panel-content {
    padding: 16px 20px;
}

.empty-state {
    color: var(--gray-400);
    font-size: 14px;
    text-align: center;
    padding: 20px;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.quick-btn {
    padding: 16px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.quick-btn:hover {
    background: var(--gray-100);
    border-color: var(--primary);
}

.quick-btn i {
    font-size: 24px;
    color: var(--primary);
}

.quick-btn span {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
}

/* Forms */
.form-page {
    max-width: 800px;
    margin: 0 auto;
}

.entry-form {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
}

.form-section {
    margin-bottom: 28px;
}

.form-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--gray-200);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.radio-group {
    display: flex;
    gap: 20px;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    cursor: pointer;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid var(--gray-200);
}

/* Media Type Selector */
.media-type-selector {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.type-option {
    flex: 1;
    min-width: 100px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.type-option input {
    display: none;
}

.type-option.selected,
.type-option:has(input:checked) {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.05);
}

.type-option i {
    font-size: 24px;
    color: var(--gray-400);
}

.type-option.selected i,
.type-option:has(input:checked) i {
    color: var(--primary);
}

.type-option span {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-600);
}

/* Toolbar */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 16px;
}

.filter-group {
    display: flex;
    gap: 12px;
}

.filter-group select,
.filter-group input {
    padding: 8px 14px;
    font-size: 14px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    background: white;
}

/* Queue */
.queue-list {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.queue-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.queue-item:last-child {
    border-bottom: none;
}

.queue-item-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    border-radius: 8px;
    color: var(--gray-500);
}

.queue-item-info {
    flex: 1;
}

.queue-item-title {
    font-weight: 500;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.queue-item-meta {
    font-size: 13px;
    color: var(--gray-500);
}

.queue-item-actions {
    display: flex;
    gap: 8px;
}

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 12px;
}

.status-badge.pending {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.approved {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.rejected {
    background: #fee2e2;
    color: #991b1b;
}

/* Bulk Import */
.import-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 12px 24px;
    background: var(--gray-200);
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-600);
}

.tab-btn:first-child {
    border-radius: var(--radius) 0 0 var(--radius);
}

.tab-btn:last-child {
    border-radius: 0 var(--radius) var(--radius) 0;
}

.tab-btn.active {
    background: var(--primary);
    color: white;
}

.tab-content {
    display: none;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
}

.tab-content.active {
    display: block;
}

.template-downloads {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.template-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.template-link:hover {
    text-decoration: underline;
}

.upload-zone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.upload-zone:hover {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.02);
}

.upload-zone i {
    font-size: 48px;
    color: var(--gray-400);
    margin-bottom: 12px;
}

.upload-zone p {
    color: var(--gray-500);
    font-size: 14px;
}

.upload-zone input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.import-preview {
    margin-top: 20px;
}

.preview-table-wrap {
    max-height: 300px;
    overflow: auto;
    margin-bottom: 16px;
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.preview-table th,
.preview-table td {
    padding: 8px 12px;
    border: 1px solid var(--gray-200);
    text-align: left;
}

.preview-table th {
    background: var(--gray-100);
    font-weight: 600;
}

.import-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Browse */
.browse-results {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.browse-item {
    padding: 14px 20px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.browse-item:hover {
    background: var(--gray-50);
}

.browse-item:last-child {
    border-bottom: none;
}

.browse-item-info {
    flex: 1;
}

.browse-item-title {
    font-weight: 500;
    color: var(--gray-900);
}

.browse-item-meta {
    font-size: 13px;
    color: var(--gray-500);
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.page-btn {
    padding: 8px 14px;
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.page-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Users */
.users-list {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.user-row {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-row:last-child {
    border-bottom: none;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--primary-light);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 600;
}

.user-info {
    flex: 1;
}

.user-name {
    font-weight: 500;
    color: var(--gray-900);
}

.user-meta {
    font-size: 13px;
    color: var(--gray-500);
}

.role-badge {
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 12px;
}

.role-badge.admin {
    background: #dbeafe;
    color: #1e40af;
}

.role-badge.editor {
    background: #dcfce7;
    color: #166534;
}

.role-badge.scholar {
    background: #f3e8ff;
    color: #6b21a8;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal {
    background: white;
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-body {
    padding: 20px;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    background: var(--gray-800);
    color: white;
    border-radius: 6px;
    font-size: 14px;
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--gray-500);
}

.loading i {
    margin-right: 8px;
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .mobile-menu {
        display: flex;
    }
}

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .quick-actions {
        grid-template-columns: 1fr;
    }
}
