/* ============================================
   ADMIN DASHBOARD STYLES
   ============================================ */

/* ============================================
   RESET & BASE STYLES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    background: #F4F5F7;
    color: #172B4D;
    line-height: 1.5;
}

html {
    scroll-behavior: smooth;
}

/* ============================================
   HEADER STYLES
   ============================================ */
.header {
    background: white;
    border-bottom: 1px solid #DFE1E6;
    padding: 16px 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo h1 {
    color: #0052CC;
    font-size: 24px;
    font-weight: 600;
}

.admin-badge {
    background: linear-gradient(135deg, #FF6B35, #FF8A65);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.admin-user-details {
    text-align: right;
}

.welcome-text {
    color: #172B4D;
    font-size: 14px;
    font-weight: 600;
}

.session-info {
    color: #36B37E;
    font-size: 12px;
    font-weight: 500;
}

.session-warning {
    color: #DE350B !important;
    font-weight: 600;
}

.logout-btn {
    background: #F4F5F7;
    color: #42526E;
    border: 1px solid #DFE1E6;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background: #EBECF0;
    border-color: #C1C7D0;
}

/* ============================================
   AUTHENTICATION MODAL
   ============================================ */
.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.auth-modal-content {
    background: white;
    border-radius: 12px;
    padding: 32px;
    max-width: 450px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.auth-error-icon {
    font-size: 48px;
    color: #DE350B;
    margin-bottom: 16px;
}

.auth-error {
    color: #DE350B;
    margin-bottom: 16px;
    font-weight: 600;
    font-size: 18px;
}

.auth-description {
    color: #6B778C;
    margin-bottom: 24px;
    line-height: 1.6;
}

.auth-redirect-btn {
    background: linear-gradient(135deg, #0052CC, #0065FF);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.auth-redirect-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 82, 204, 0.4);
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    position: relative;
    min-height: 100vh;
}

/* ============================================
   CONTROLS & FILTERS
   ============================================ */
.controls {
    background: white;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.controls-row {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.search-input {
    flex: 1;
    min-width: 300px;
    padding: 10px 16px;
    border: 2px solid #DFE1E6;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: #0052CC;
    box-shadow: 0 0 0 3px rgba(0, 82, 204, 0.1);
}

.filter-select {
    padding: 10px 16px;
    border: 2px solid #DFE1E6;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

.stats-bar {
    display: flex;
    gap: 16px;
    align-items: center;
    color: #6B778C;
    font-size: 14px;
}

.stat-item {
    background: #F4F5F7;
    padding: 8px 12px;
    border-radius: 4px;
    font-weight: 500;
}

.stat-attention {
    background: #FFEBE6;
    color: #DE350B;
}

.stat-admin {
    background: #E3F2FD;
    color: #1976D2;
}

/* ============================================
   STUDENT CARDS GRID
   ============================================ */
.students-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
    position: relative;
}

.student-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.5s ease forwards;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 300px;
}

.student-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.student-card.attention {
    border-left: 4px solid #DE350B;
}

.student-card.normal {
    border-left: 4px solid #36B37E;
}

.card-main-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.student-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.student-name {
    font-size: 18px;
    font-weight: 600;
    color: #172B4D;
    margin-bottom: 4px;
    line-height: 1.3;
}

.student-passport {
    font-size: 14px;
    color: #6B778C;
    font-family: 'Monaco', 'Consolas', monospace;
}

.attention-badge {
    background: #DE350B;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.normal-badge {
    background: #36B37E;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.student-details {
    flex: 1;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.detail-label {
    color: #6B778C;
    font-weight: 500;
    flex-shrink: 0;
}

.detail-value {
    color: #172B4D;
    font-weight: 400;
    text-align: right;
    max-width: 60%;
    word-break: break-word;
}

.agent-info {
    background: #E3F2FD;
    color: #1976D2;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    margin: 8px 0;
}

.record-id {
    background: #F4F5F7;
    color: #6B778C;
    padding: 10px 16px;
    font-size: 11px;
    font-family: 'Monaco', 'Consolas', monospace;
    text-align: center;
    border-top: 1px solid #EBECF0;
    font-weight: 500;
}

/* ============================================
   LOADING STATES
   ============================================ */
.loading-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 48px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #F4F5F7;
    border-top: 4px solid #0052CC;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.load-more-container {
    display: flex;
    justify-content: center;
    padding: 32px;
    background: rgba(244, 245, 247, 0.8);
    border-radius: 8px;
    margin: 24px 0;
}

.load-more-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #F4F5F7;
    border-top: 3px solid #0052CC;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 64px 24px;
    color: #6B778C;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin: 24px 0;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: linear-gradient(135deg, #0052CC, #0065FF);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 36px;
}

.empty-state h3 {
    font-size: 24px;
    margin-bottom: 12px;
    color: #172B4D;
    font-weight: 600;
}

.empty-state-description {
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 32px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.empty-state-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.empty-state-btn {
    background: #0052CC;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.empty-state-btn:hover {
    background: #0043A3;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 82, 204, 0.3);
}

.empty-state-btn.secondary {
    background: #F4F5F7;
    color: #42526E;
    border: 1px solid #DFE1E6;
}

.empty-state-btn.secondary:hover {
    background: #EBECF0;
    border-color: #C1C7D0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.refresh-icon {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.empty-state-btn.secondary:hover .refresh-icon {
    transform: rotate(180deg);
}

/* ============================================
   ERROR MESSAGE
   ============================================ */
.error-message {
    background: #FFEBE6;
    color: #DE350B;
    padding: 16px;
    border-radius: 6px;
    margin-bottom: 24px;
    text-align: center;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================
   RESPONSIVE DESIGN - MOBILE
   ============================================ */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    .controls-row {
        flex-direction: column;
        align-items: stretch;
    }

    .search-input {
        min-width: auto;
    }

    .students-grid {
        grid-template-columns: 1fr;
    }

    .main-content {
        padding: 16px;
    }

    .detail-row {
        flex-direction: column;
        gap: 4px;
    }

    .detail-value {
        text-align: left;
        max-width: 100%;
    }

    .empty-state {
        padding: 48px 16px;
    }
    
    .empty-state-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .empty-state-btn {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }

    .admin-user-details {
        text-align: left;
    }
}