/* ==========================================================================
   BMI Tanlash Tizimi - Asosiy Dizayn Tizimi (Pure Vanilla CSS)
   Zamonaviy, toza va professional interfeys
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --primary-border: #bfdbfe;
    
    --success: #10b981;
    --success-light: #ecfdf5;
    --success-border: #a7f3d0;
    
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --warning-border: #fde68a;
    
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --danger-light: #fef2f2;
    --danger-border: #fecaca;

    --dark: #0f172a;
    --slate: #1e293b;
    --muted: #64748b;
    --border: #e2e8f0;
    --bg: #f8fafc;
    --card-bg: #ffffff;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.06);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.05);
    
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg);
    color: var(--slate);
    line-height: 1.5;
    font-size: 14.5px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   Typography & Umumiy elementlar
   ========================================================================== */
h1, h2, h3, h4, h5, h6 {
    color: var(--dark);
    font-weight: 700;
    line-height: 1.25;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }

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

a:hover {
    color: var(--primary-hover);
}

/* ==========================================================================
   Navigatsiya (Navbar)
   ========================================================================== */
.navbar {
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    padding: 0.85rem 1.5rem;
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-weight: 800;
    font-size: 1.15rem;
    color: var(--dark);
}

.brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), #3b82f6);
    color: #ffffff;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: bold;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-link {
    color: var(--slate);
    font-weight: 600;
    padding: 0.5rem 0.85rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.nav-link:hover, .nav-link.active {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: 1rem;
    padding-left: 1rem;
    border-left: 1px solid var(--border);
}

.user-badge {
    display: flex;
    flex-direction: column;
    text-align: right;
}

.user-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--dark);
}

.user-role {
    font-size: 0.75rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ==========================================================================
   Asosiy konteyner va struktura
   ========================================================================== */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

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

.page-title {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.page-title p {
    color: var(--muted);
    font-size: 0.9rem;
}

/* ==========================================================================
   Tugmalar (Buttons)
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.6rem 1.15rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

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

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

.btn-success {
    background: var(--success);
    color: #ffffff;
}
.btn-success:hover {
    background: #059669;
    color: #ffffff;
}

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

.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    border-radius: var(--radius-lg);
}

/* ==========================================================================
   Statistika kartalari (Stat Cards)
   ========================================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.stat-card.clickable {
    cursor: pointer;
    user-select: none;
}

.stat-card.clickable:hover {
    border-color: var(--primary-border);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.stat-card.clickable.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    background: #fcfdff;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
}

.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.amber { background: var(--warning-light); color: var(--warning); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }

.stat-info .stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--dark);
    line-height: 1.1;
}

.stat-info .stat-label {
    font-size: 0.825rem;
    color: var(--muted);
    font-weight: 500;
}

/* ==========================================================================
   Kartalar va Qutilar (Cards & Panels)
   ========================================================================== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.card-header {
    padding: 1.15rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    background: #ffffff;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: #fafafa;
}

/* ==========================================================================
   Jadvallar (Tables)
   ========================================================================== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

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

th {
    background: #f8fafc;
    color: var(--muted);
    font-size: 0.775rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--slate);
    vertical-align: middle;
}

tr:hover td {
    background: #fbfdff;
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.65rem;
    border-radius: 9999px;
    text-transform: capitalize;
}

.badge-success { background: var(--success-light); color: #047857; border: 1px solid var(--success-border); }
.badge-warning { background: var(--warning-light); color: #b45309; border: 1px solid var(--warning-border); }
.badge-danger { background: var(--danger-light); color: #b91c1c; border: 1px solid var(--danger-border); }
.badge-info { background: var(--primary-light); color: var(--primary); border: 1px solid var(--primary-border); }
.badge-secondary { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }

/* ==========================================================================
   Formalar (Forms & Inputs)
   ========================================================================== */
.form-group {
    margin-bottom: 1.15rem;
}

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

.form-control, .form-select {
    width: 100%;
    padding: 0.65rem 0.9rem;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--dark);
    background-color: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-text {
    font-size: 0.775rem;
    color: var(--muted);
    margin-top: 0.35rem;
}

/* File Upload drag-drop area */
.file-upload-box {
    border: 2px dashed var(--primary-border);
    background: var(--primary-light);
    border-radius: var(--radius-lg);
    padding: 2rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.file-upload-box:hover {
    border-color: var(--primary);
    background: #e0f2fe;
}

.file-upload-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    display: inline-block;
}

/* ==========================================================================
   Filtrlar va Qidiruv (Filters & Search)
   ========================================================================== */
.filters-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
    background: #ffffff;
    padding: 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.search-input-wrap {
    flex: 1;
    min-width: 240px;
    position: relative;
}

.search-input-wrap input {
    padding-left: 2.2rem;
}

.search-icon {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
}

/* ==========================================================================
   Modallar (Modal Dialogs)
   ========================================================================== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
    padding: 1rem;
}

.modal-backdrop.show {
    opacity: 1;
    visibility: visible;
}

.modal-dialog {
    background: #ffffff;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 580px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px) scale(0.97);
    transition: all 0.25s ease;
}

.modal-backdrop.show .modal-dialog {
    transform: translateY(0) scale(1);
}

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

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.4rem;
    color: var(--muted);
    cursor: pointer;
    line-height: 1;
    padding: 0.25rem;
}
.modal-close:hover { color: var(--danger); }

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    background: #fafafa;
}

/* ==========================================================================
   Alertlar (Notifications & Flash)
   ========================================================================== */
.alert {
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
}

.alert-success { background: var(--success-light); border: 1px solid var(--success-border); color: #065f46; }
.alert-danger { background: var(--danger-light); border: 1px solid var(--danger-border); color: #991b1b; }
.alert-warning { background: var(--warning-light); border: 1px solid var(--warning-border); color: #92400e; }
.alert-info { background: var(--primary-light); border: 1px solid var(--primary-border); color: #1e40af; }

/* ==========================================================================
   Autentifikatsiya (Login sahifasi)
   ========================================================================== */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f0f4f8 0%, #e2e8f0 100%);
}

.auth-card {
    background: #ffffff;
    width: 100%;
    max-width: 440px;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    overflow: hidden;
    border: 1px solid var(--border);
}

.auth-header {
    background: linear-gradient(135deg, var(--dark) 0%, var(--slate) 100%);
    color: #ffffff;
    padding: 2rem 1.5rem;
    text-align: center;
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    background: var(--primary);
    border-radius: var(--radius);
    font-size: 1.6rem;
    margin-bottom: 0.75rem;
}

.auth-body {
    padding: 2rem 1.75rem;
}

.tab-nav {
    display: flex;
    background: #f1f5f9;
    padding: 0.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
}

.tab-btn {
    flex: 1;
    text-align: center;
    padding: 0.55rem;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: none;
    background: transparent;
    transition: var(--transition);
}

.tab-btn.active {
    background: #ffffff;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   BMI Mavzular ro'yxati (Talaba ko'rinishi)
   ========================================================================== */
.topic-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.topic-card:hover {
    border-color: var(--primary-border);
    box-shadow: var(--shadow);
}

.topic-card.taken {
    background: #fafafa;
    border-color: #e2e8f0;
    opacity: 0.85;
}

.topic-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.topic-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--dark);
}

.topic-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.topic-desc {
    font-size: 0.875rem;
    color: #475569;
    background: #f8fafc;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary);
}

/* Footer */
footer {
    background: #ffffff;
    border-top: 1px solid var(--border);
    padding: 1rem;
    text-align: center;
    color: var(--muted);
    font-size: 0.825rem;
    margin-top: auto;
}

@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    .nav-links {
        justify-content: space-between;
    }
    .nav-user {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        border-top: 1px solid var(--border);
        padding-top: 0.5rem;
        justify-content: space-between;
    }
    .page-header {
        flex-direction: column;
        align-items: stretch;
    }
}
