/* ==========================================
   ADMIN PANEL STYLES (Полная версия)
   ========================================== */

/* ---------- BASE & RESET ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #667eea;
    --primary-dark: #764ba2;
    --secondary: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --gray: #64748b;
    --gray-light: #94a3b8;
    --gray-lighter: #cbd5e1;
    --bg: #f1f5f9;
    --card-bg: #ffffff;
    --text: #334155;
    --text-dark: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --radius: 16px;
    --radius-sm: 8px;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

/* ---------- LAYOUT ---------- */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.main-header {
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo img {
    height: 40px;
    width: auto;
    object-fit: contain;
    background: white;
    padding: 4px;
    border-radius: var(--radius-sm);
}

.school-name {
    font-size: 18px;
    font-weight: 600;
}

/* Navigation */
.main-nav {
    display: flex;
    gap: 12px;
}

.nav-link {
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
}

.nav-link:hover, .nav-link.active {
    background: rgba(255,255,255,0.2);
    color: white;
}

/* User Menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-menu span {
    font-size: 14px;
    font-weight: 500;
}

.btn-logout {
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.3);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* ---------- HERO SECTION ---------- */
.hero-section {
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 2rem;
    color: white;
    margin-bottom: 2rem;
    box-shadow: 0 10px 25px rgba(102,126,234,0.3);
}

.hero-section h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.hero-section p {
    opacity: 0.9;
    margin: 0;
    font-size: 1rem;
}

/* ---------- GRID LAYOUTS ---------- */
.dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.section-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* ---------- CARDS ---------- */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--bg);
    flex-wrap: wrap;
    gap: 1rem;
}

.card-header h2, .card-header h3 {
    font-size: 1.25rem;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

/* ---------- BUTTONS ---------- */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-primary {
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.btn-secondary {
    background: var(--bg);
    color: var(--text-light);
    border: 1px solid var(--gray-lighter);
}

.btn-secondary:hover {
    background: var(--border);
    color: var(--text);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn:disabled, .btn-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ---------- FORMS ---------- */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text);
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-lighter);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: all 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}

/* ---------- TABLES (Admin Specific) ---------- */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: white;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.table-responsive table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

/* Заголовок таблицы */
.table-responsive thead {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
}

.table-responsive th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

/* Строки данных */
.table-responsive tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background-color 0.2s;
}

.table-responsive tbody tr:hover {
    background-color: #f8fafc;
}

.table-responsive tbody tr:nth-child(even) {
    background-color: #f1f5f9;
}

.table-responsive tbody tr:nth-child(even):hover {
    background-color: #e2e8f0;
}

.table-responsive td {
    padding: 14px 16px;
    vertical-align: middle;
    color: var(--text);
}

/* Выравнивание текста */
.text-center { text-align: center; }

/* ---------- FILE TYPE BADGES ---------- */
.file-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: white;
}

.file-badge.mcko_teacher { background: #3b82f6; }
.file-badge.mcko_class { background: #10b981; }
.file-badge.vsoh { background: #f59e0b; }
.file-badge.olympiad, .file-badge.mosh { background: #ec4899; }
.file-badge.exam_ege, .file-badge.ege { background: #8b5cf6; }
.file-badge.exam_oge, .file-badge.oge { background: #f97316; }
.file-badge.courses { background: #06b6d4; }
.file-badge.other { background: #64748b; }

/* Для неопределённых типов */
.file-badge.unknown, .file-badge.undefined, .file-badge[class="file-badge "] {
    background: #9ca3af;
}

/* ---------- STATUS BADGES ---------- */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.status-badge.completed {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.processing {
    background: #fef3c7;
    color: #92400e;
}

.status-badge.error, .status-badge.failed {
    background: #fee2e2;
    color: #991b1b;
}

.status-badge.pending {
    background: #dbeafe;
    color: #1e40af;
}

/* ---------- ROLE BADGES ---------- */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.badge-admin {
    background: #fee2e2;
    color: #991b1b;
}

.badge-methodist {
    background: #dbeafe;
    color: #1e40af;
}

/* ---------- PAGINATION ---------- */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 1rem;
}

.pagination-info {
    color: var(--gray);
    font-size: 14px;
}

.pagination-controls {
    display: flex;
    gap: 5px;
}

.pagination-controls .btn {
    min-width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--gray-lighter);
    background: white;
    color: var(--text);
}

.pagination-controls .btn:hover:not(:disabled) {
    background: var(--bg);
    border-color: var(--primary);
}

.pagination-controls .btn-primary {
    background: var(--primary) !important;
    color: white !important;
    border-color: var(--primary) !important;
}

.pagination-controls .btn-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f3f4f6;
}

/* ---------- SEARCH ---------- */
.search-box {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-light);
    font-size: 14px;
}

.search-box input {
    width: 100%;
    padding: 10px 40px 10px 40px;
    border: 1px solid var(--gray-lighter);
    border-radius: var(--radius-sm);
    font-size: 14px;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}

/* ---------- MODALS ---------- */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-dark);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-light);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.btn-close:hover {
    background: var(--bg);
    color: var(--text);
}

/* ---------- TOASTS ---------- */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
}

.toast {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border-left: 4px solid var(--primary);
    animation: slideIn 0.3s ease-out;
}

.toast.success { border-left-color: var(--secondary); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

.toast-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.toast.success .toast-icon { color: var(--secondary); }
.toast.error .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }

.toast-content {
    flex: 1;
    font-size: 14px;
}

.toast-close {
    background: none;
    border: none;
    color: var(--gray-light);
    cursor: pointer;
    padding: 4px;
}

/* ---------- UTILITIES ---------- */
.mb-3 { margin-bottom: 1.5rem; }

/* ---------- PASSWORD DISPLAY ---------- */
.password-display {
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-left: 4px solid var(--warning);
    padding: 12px;
    border-radius: 8px;
    margin-top: 10px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: #92400e;
}

/* ---------- ANIMATIONS ---------- */
@keyframes modalSlideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 968px) {
    .section-grid {
        grid-template-columns: 1fr;
    }
    
    .main-header {
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .main-nav {
        order: 3;
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .table-responsive th,
    .table-responsive td {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .file-badge, .status-badge, .badge {
        font-size: 10px;
        padding: 3px 8px;
    }
}