/* ============================================
   ÜHÜAM — Üniversite Hastaneleri Üstün Akreditasyon Modeli
   Ana Stil Dosyası v1.0
   ============================================ */

/* CSS Variables */
:root {
    --primary: #1a5276;
    --primary-light: #2980b9;
    --primary-dark: #0e2f44;
    --secondary: #2c3e50;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --info: #3498db;
    --light: #ecf0f1;
    --dark: #2c3e50;
    --white: #ffffff;
    --gray-50: #f8f9fa;
    --gray-100: #f1f3f5;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #868e96;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --header-height: 60px;
    --border-radius: 8px;
    --shadow: 0 2px 10px rgba(0,0,0,0.08);
    --shadow-lg: 0 5px 25px rgba(0,0,0,0.12);
    --transition: all 0.3s ease;
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ============================================
   LOGIN SCREEN
   ============================================ */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    padding: 20px;
}

.login-container {
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    padding: 40px;
    animation: fadeInUp 0.5s ease;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    box-shadow: 0 4px 15px rgba(26, 82, 118, 0.3);
}

.login-logo i {
    font-size: 36px;
    color: var(--white);
}

.login-header h1 {
    font-size: 2rem;
    color: var(--primary);
    font-weight: 700;
    letter-spacing: 2px;
}

.login-header p {
    color: var(--gray-600);
    font-size: 0.85rem;
    margin-top: 4px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.login-form label i {
    margin-right: 6px;
    color: var(--primary-light);
}

.login-form input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
    outline: none;
}

.login-form input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(41, 128, 185, 0.15);
}

.error-message {
    background: #fdecea;
    color: var(--danger);
    padding: 10px 14px;
    border-radius: var(--border-radius);
    font-size: 0.85rem;
    margin-bottom: 16px;
    border-left: 4px solid var(--danger);
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    color: var(--gray-500);
    font-size: 0.8rem;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1.4;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(26, 82, 118, 0.3);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-success:hover {
    background: #219a52;
}

.btn-secondary {
    background: var(--gray-500);
    color: var(--white);
}

.btn-secondary:hover {
    background: var(--gray-600);
}

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

.btn-danger:hover {
    background: #c0392b;
}

.btn-block {
    display: flex;
    width: 100%;
    justify-content: center;
    padding: 14px;
    font-size: 1rem;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--gray-600);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: var(--transition);
    position: relative;
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-xs {
    padding: 4px 8px;
    font-size: 0.75rem;
}

/* ============================================
   APP CONTAINER
   ============================================ */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--secondary) 100%);
    color: var(--white);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.sidebar-logo i {
    font-size: 1.5rem;
    color: var(--warning);
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
    opacity: 0.7;
    transition: var(--transition);
}

.sidebar-toggle:hover {
    opacity: 1;
}

.sidebar-menu {
    list-style: none;
    padding: 12px 0;
    flex: 1;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 24px;
    cursor: pointer;
    transition: var(--transition);
    border-left: 3px solid transparent;
    font-size: 0.95rem;
    color: rgba(255,255,255,0.75);
}

.menu-item:hover {
    background: rgba(255,255,255,0.08);
    color: var(--white);
}

.menu-item.active {
    background: rgba(255,255,255,0.12);
    color: var(--white);
    border-left-color: var(--warning);
}

.menu-item i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.8);
}

.user-info i {
    font-size: 1.3rem;
}

.btn-logout {
    background: none;
    border: none;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    transition: var(--transition);
}

.btn-logout:hover {
    color: var(--danger);
    background: rgba(231,76,60,0.15);
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: var(--transition);
}

/* ============================================
   HEADER
   ============================================ */
.main-header {
    height: var(--header-height);
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-left h2 {
    font-size: 1.2rem;
    color: var(--gray-800);
    font-weight: 600;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--gray-700);
    cursor: pointer;
}

.header-right {
    display: flex;
    align-items: center;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: var(--danger);
    color: var(--white);
    font-size: 0.65rem;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--gray-700);
}

.user-btn span {
    font-weight: 600;
}

/* ============================================
   PAGE CONTENT
   ============================================ */
.page-content {
    padding: 24px;
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.page-actions {
    margin-bottom: 20px;
}

/* ============================================
   STAT CARDS
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border-left: 4px solid transparent;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-primary { border-left-color: var(--primary); }
.stat-success { border-left-color: var(--success); }
.stat-warning { border-left-color: var(--warning); }
.stat-info { border-left-color: var(--info); }

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.stat-primary .stat-icon { background: rgba(26,82,118,0.1); color: var(--primary); }
.stat-success .stat-icon { background: rgba(39,174,96,0.1); color: var(--success); }
.stat-warning .stat-icon { background: rgba(243,156,18,0.1); color: var(--warning); }
.stat-info .stat-icon { background: rgba(52,152,219,0.1); color: var(--info); }

.stat-info h3 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--gray-800);
}

.stat-info p {
    font-size: 0.85rem;
    color: var(--gray-600);
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-800);
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.card-tools {
    display: flex;
    gap: 8px;
}

/* ============================================
   DASHBOARD GRID
   ============================================ */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
}

/* ============================================
   TABLES
   ============================================ */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.9rem;
}

.table th {
    background: var(--gray-50);
    font-weight: 600;
    color: var(--gray-700);
    white-space: nowrap;
}

.table tbody tr:hover {
    background: var(--gray-50);
}

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

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    transition: var(--transition);
    outline: none;
    background: var(--white);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(41, 128, 185, 0.12);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-control-sm {
    padding: 8px 12px;
    border: 2px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 0.85rem;
    outline: none;
    transition: var(--transition);
    background: var(--white);
}

.form-control-sm:focus {
    border-color: var(--primary-light);
}

/* ============================================
   BADGES
   ============================================ */
.badge-info {
    background: var(--info);
    color: var(--white);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: var(--success);
    color: var(--white);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-warning {
    background: var(--warning);
    color: var(--white);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-danger {
    background: var(--danger);
    color: var(--white);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-platin { background: linear-gradient(135deg, #b8860b, #daa520); color: #fff; }
.badge-altin { background: linear-gradient(135deg, #c0392b, #e67e22); color: #fff; }
.badge-gumus { background: linear-gradient(135deg, #7f8c8d, #bdc3c7); color: #fff; }
.badge-bronz { background: linear-gradient(135deg, #8B4513, #cd853f); color: #fff; }
.badge-none { background: var(--gray-400); color: var(--gray-700); }

/* ============================================
   MODAL
   ============================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: var(--white);
    border-radius: 12px;
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-content.modal-lg {
    max-width: 800px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--gray-500);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--danger);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ============================================
   TOAST
   ============================================ */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3000;
    animation: slideInRight 0.3s ease;
}

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

.toast-content {
    background: var(--success);
    color: var(--white);
    padding: 14px 24px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow-lg);
    font-weight: 600;
    font-size: 0.9rem;
}

.toast-content.error {
    background: var(--danger);
}

/* ============================================
   LOADING
   ============================================ */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.85);
    z-index: 5000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--gray-300);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   INDICATOR LIST
   ============================================ */
.indicator-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.indicator-list {
    max-height: 600px;
    overflow-y: auto;
}

.indicator-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    margin-bottom: 8px;
    transition: var(--transition);
    cursor: pointer;
}

.indicator-item:hover {
    background: var(--gray-50);
    border-color: var(--primary-light);
}

.indicator-code {
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 700;
    background: var(--gray-100);
    padding: 2px 8px;
    border-radius: 4px;
    min-width: 150px;
}

.indicator-name {
    flex: 1;
    margin: 0 12px;
    font-size: 0.9rem;
}

.indicator-weight {
    color: var(--gray-600);
    font-size: 0.8rem;
    min-width: 60px;
    text-align: right;
}

.indicator-pillar-badge {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--white);
    margin-left: 8px;
}

.pillar-P1 { background: #e74c3c; }
.pillar-P2 { background: #3498db; }
.pillar-P3 { background: #9b59b6; }
.pillar-P4 { background: #e67e22; }
.pillar-P5 { background: #1abc9c; }
.pillar-P6 { background: #2ecc71; }
.pillar-KP { background: #34495e; }

/* ============================================
   DATA ENTRY
   ============================================ */
.data-entry-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.data-entry-item {
    padding: 16px 20px;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    margin-bottom: 12px;
    background: var(--gray-50);
}

.data-entry-item .indicator-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.data-entry-item .indicator-header code {
    font-family: monospace;
    color: var(--primary);
    font-weight: 700;
    font-size: 0.8rem;
    background: var(--white);
    padding: 2px 6px;
    border-radius: 4px;
}

.data-entry-item .indicator-header strong {
    font-size: 0.9rem;
}

.data-entry-item .indicator-meta {
    display: flex;
    gap: 16px;
    margin-bottom: 10px;
    font-size: 0.8rem;
    color: var(--gray-600);
}

.data-entry-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-items: end;
}

.data-entry-inputs .form-group {
    margin-bottom: 0;
}

.data-entry-inputs input,
.data-entry-inputs select {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition);
}

.data-entry-inputs input:focus,
.data-entry-inputs select:focus {
    border-color: var(--primary-light);
}

/* ============================================
   SCORING
   ============================================ */
.scoring-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.score-summary {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.total-score-card {
    text-align: center;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: var(--white);
    padding: 32px 48px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
}

.total-score-card h4 {
    font-size: 0.9rem;
    opacity: 0.85;
    margin-bottom: 8px;
}

.total-score {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1;
}

.score-max {
    font-size: 1.2rem;
    opacity: 0.7;
    margin-top: 4px;
}

.accreditation-level {
    margin-top: 12px;
    font-size: 1.2rem;
    font-weight: 700;
    padding: 6px 20px;
    border-radius: 20px;
    display: inline-block;
}

/* ============================================
   REPORTS
   ============================================ */
.report-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}

.report-card {
    text-align: center;
    padding: 32px 20px;
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.report-card:hover {
    border-color: var(--primary-light);
    background: var(--gray-50);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.report-card i {
    font-size: 2.5rem;
    color: var(--primary-light);
    margin-bottom: 12px;
}

.report-card h4 {
    font-size: 1rem;
    margin-bottom: 8px;
    color: var(--gray-800);
}

.report-card p {
    font-size: 0.8rem;
    color: var(--gray-600);
}

/* ============================================
   SETTINGS
   ============================================ */
.settings-section {
    margin-bottom: 24px;
}

.settings-section h4 {
    font-size: 1rem;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--gray-200);
    color: var(--primary);
}

.weight-form {
    max-width: 500px;
}

.weight-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.weight-row label {
    flex: 1;
    font-size: 0.9rem;
    color: var(--gray-700);
}

.weight-row input {
    width: 70px;
    text-align: center;
}

.weight-total {
    margin: 16px 0;
    padding: 10px;
    background: var(--gray-100);
    border-radius: var(--border-radius);
    text-align: center;
}

/* ============================================
   ACTIVITY LIST
   ============================================ */
.activity-list {
    max-height: 300px;
    overflow-y: auto;
}

.activity-item {
    display: flex;
    align-items: start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-100);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.activity-text {
    font-size: 0.85rem;
    color: var(--gray-700);
}

.activity-time {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 2px;
}

/* ============================================
   UTILITY
   ============================================ */
.text-muted {
    color: var(--gray-500);
}

.text-center {
    text-align: center;
}

.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }

.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-menu-btn {
        display: block;
    }

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

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

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

    .data-entry-controls {
        flex-direction: column;
    }

    .data-entry-controls select,
    .data-entry-controls .form-control-sm {
        width: 100%;
    }

    .data-entry-inputs {
        grid-template-columns: 1fr;
    }

    .page-content {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .login-container {
        padding: 24px;
    }
}

/* ============================================
   INDICATOR DETAIL IN MODAL
   ============================================ */
.indicator-detail {
    padding: 0;
}

.indicator-detail .detail-row {
    display: flex;
    padding: 10px 0;
    border-bottom: 1px solid var(--gray-100);
}

.indicator-detail .detail-label {
    width: 140px;
    font-weight: 600;
    color: var(--gray-600);
    flex-shrink: 0;
    font-size: 0.85rem;
}

.indicator-detail .detail-value {
    flex: 1;
    font-size: 0.9rem;
}

.scoring-scale {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    margin-top: 8px;
}

.scale-item {
    text-align: center;
    padding: 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.scale-1 { background: #fde8e8; color: #c0392b; }
.scale-2 { background: #fef3e0; color: #e67e22; }
.scale-3 { background: #fef9e7; color: #f1c40f; }
.scale-4 { background: #e8f8f5; color: #27ae60; }
.scale-5 { background: #eafaf1; color: #1e8449; }

/* ============================================
   AI ASSISTANT
   ============================================ */
.ai-container {
    display: flex;
    height: calc(100vh - var(--header-height) - 48px);
    gap: 0;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.ai-sidebar {
    width: 300px;
    background: var(--white);
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
}

.ai-sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.ai-sidebar-header h3 {
    font-size: 0.95rem;
    color: var(--gray-700);
}

.ai-sidebar-body {
    padding: 16px 20px;
    flex: 1;
}

.ai-sidebar-body h4 {
    font-size: 0.85rem;
    color: var(--gray-600);
    margin-bottom: 10px;
}

.ai-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    padding: 8px 12px;
    background: var(--gray-50);
    border-radius: var(--border-radius);
}

.ai-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ai-status-dot.online {
    background: var(--success);
    box-shadow: 0 0 6px rgba(39,174,96,0.5);
}

.ai-status-dot.offline {
    background: var(--gray-400);
}

.ai-quick-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ai-quick-btn {
    width: 100%;
    justify-content: flex-start;
    text-align: left;
}

.ai-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--gray-50);
}

.ai-chat-header {
    padding: 14px 20px;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ai-chat-header h3 {
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ai-message {
    display: flex;
    gap: 12px;
    max-width: 85%;
}

.ai-message.ai-system {
    max-width: 100%;
}

.ai-message.ai-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.ai-message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.ai-system .ai-message-avatar {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--white);
}

.ai-user .ai-message-avatar {
    background: var(--gray-300);
    color: var(--gray-700);
}

.ai-message-content {
    background: var(--white);
    padding: 14px 18px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    font-size: 0.9rem;
    line-height: 1.6;
}

.ai-user .ai-message-content {
    background: var(--primary);
    color: var(--white);
}

.ai-message-content p {
    margin-bottom: 8px;
}

.ai-message-content p:last-child {
    margin-bottom: 0;
}

.ai-message-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.ai-message-content li {
    margin-bottom: 4px;
}

.ai-message-content code {
    background: var(--gray-100);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
}

.ai-user .ai-message-content code {
    background: rgba(255,255,255,0.2);
}

.ai-result-card {
    margin-top: 12px;
    border: 2px solid var(--primary-light);
    border-radius: var(--border-radius);
    overflow: hidden;
}

.ai-result-header {
    background: var(--primary);
    color: var(--white);
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.85rem;
}

.ai-result-body {
    padding: 14px;
    background: var(--gray-50);
}

.ai-result-row {
    display: flex;
    padding: 6px 0;
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.85rem;
}

.ai-result-row:last-child {
    border-bottom: none;
}

.ai-result-label {
    width: 130px;
    font-weight: 600;
    color: var(--gray-600);
    flex-shrink: 0;
}

.ai-result-value {
    flex: 1;
}

.ai-confidence-bar {
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    margin-top: 4px;
    overflow: hidden;
}

.ai-confidence-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.ai-confidence-high { background: var(--success); }
.ai-confidence-medium { background: var(--warning); }
.ai-confidence-low { background: var(--danger); }

.ai-chat-input {
    padding: 16px 20px;
    background: var(--white);
    border-top: 1px solid var(--gray-200);
}

.ai-input-row textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    resize: vertical;
    outline: none;
    transition: var(--transition);
    font-family: inherit;
}

.ai-input-row textarea:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(41,128,185,0.12);
}

.ai-input-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    justify-content: flex-end;
}

.ai-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--gray-500);
    font-size: 0.85rem;
    padding: 10px;
}

.ai-loading .spinner-sm {
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-300);
    border-top: 2px solid var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@media (max-width: 768px) {
    .ai-container {
        flex-direction: column;
        height: auto;
    }
    .ai-sidebar {
        width: 100%;
        max-height: 250px;
    }
}

/* ============================================
   MENU DIVIDER
   ============================================ */
.menu-divider {
    padding: 16px 24px 6px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.35);
    text-transform: uppercase;
    pointer-events: none;
}

/* ============================================
   DOCUMENT VIEWER
   ============================================ */
.doc-container {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.doc-header {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: var(--white);
    padding: 24px 32px;
}

.doc-header h2 {
    font-size: 1.4rem;
    margin-bottom: 6px;
}

.doc-header p {
    opacity: 0.8;
    font-size: 0.9rem;
}

.doc-content {
    padding: 32px;
    max-height: calc(100vh - 240px);
    overflow-y: auto;
    line-height: 1.8;
    font-size: 0.95rem;
}

.doc-content h1 {
    font-size: 1.6rem;
    color: var(--primary-dark);
    margin: 28px 0 12px;
    padding-bottom: 8px;
    border-bottom: 3px solid var(--primary-light);
}

.doc-content h2 {
    font-size: 1.35rem;
    color: var(--primary);
    margin: 24px 0 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--gray-200);
}

.doc-content h3 {
    font-size: 1.15rem;
    color: var(--secondary);
    margin: 20px 0 8px;
}

.doc-content h4 {
    font-size: 1rem;
    color: var(--gray-700);
    margin: 16px 0 6px;
}

.doc-content p {
    margin-bottom: 12px;
}

.doc-content ul, .doc-content ol {
    margin: 8px 0 16px 20px;
}

.doc-content li {
    margin-bottom: 6px;
}

.doc-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 0.85rem;
}

.doc-content table th,
.doc-content table td {
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    text-align: left;
}

.doc-content table th {
    background: var(--primary);
    color: var(--white);
    font-weight: 600;
}

.doc-content table tr:nth-child(even) {
    background: var(--gray-50);
}

.doc-content table tr:hover {
    background: var(--gray-100);
}

.doc-content code {
    background: var(--gray-100);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--danger);
}

.doc-content pre {
    background: var(--gray-800);
    color: var(--gray-100);
    padding: 16px;
    border-radius: var(--border-radius);
    overflow-x: auto;
    margin: 16px 0;
    font-size: 0.85rem;
    line-height: 1.5;
}

.doc-content pre code {
    background: none;
    color: inherit;
    padding: 0;
}

.doc-content blockquote {
    border-left: 4px solid var(--primary-light);
    padding: 12px 20px;
    margin: 16px 0;
    background: var(--gray-50);
    color: var(--gray-700);
    font-style: italic;
}

.doc-content strong {
    color: var(--gray-800);
}

.doc-content hr {
    border: none;
    border-top: 2px solid var(--gray-200);
    margin: 24px 0;
}

/* ============================================
   HEADER LOGOUT BUTTON
   ============================================ */
.header-logout {
    background: none;
    border: 2px solid var(--danger);
    color: var(--danger);
    padding: 6px 12px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
    margin-left: 8px;
}

.header-logout:hover {
    background: var(--danger);
    color: var(--white);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}