/* ============================================
   DASHBOARD STYLES
   Optimized CSS for analytics dashboard
   ============================================ */

/* Dashboard-specific overrides */
body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
    min-height: 100vh;
}

/* Dashboard Container */
.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* Dashboard Header */
.dashboard-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 3px solid var(--teal);
}

.dashboard-header h1 {
    color: var(--primary-dark);
    margin-bottom: 10px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* Stat Cards */
.stat-card {
    background: linear-gradient(135deg, rgba(0, 167, 157, 0.1), rgba(123, 104, 238, 0.1));
    border-radius: 12px;
    padding: 20px;
    border-left: 4px solid var(--teal);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 167, 157, 0.2);
}

.stat-card h3 {
    color: var(--teal);
    font-size: 0.9rem;
    margin-bottom: 10px;
    text-transform: uppercase;
}

.stat-card .stat-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary-dark);
    margin-bottom: 5px;
}

.stat-card .stat-label {
    color: #666;
    font-size: 0.85rem;
}

/* Section Containers */
.section {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
}

.section h2 {
    color: var(--primary-dark);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Access Table */
.access-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.access-table caption {
    padding: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--primary-dark);
    text-align: left;
    caption-side: top;
}

.access-table thead {
    background: linear-gradient(135deg, var(--teal), var(--purple));
    color: white;
}

.access-table th,
.access-table td {
    padding: 12px;
    text-align: left;
}

.access-table tbody tr:nth-child(even) {
    background: #f8f9fa;
}

.access-table tbody tr:hover {
    background: rgba(0, 167, 157, 0.1);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-teacher {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #333;
}

.badge-student {
    background: linear-gradient(135deg, var(--teal), var(--purple));
    color: white;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--teal), var(--purple));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 167, 157, 0.3);
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

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

.btn-logout {
    background: #ff6b6b;
    color: white;
    border: 2px solid #ff5252;
}

.btn-logout:hover {
    background: #ff5252;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 82, 82, 0.3);
}

/* Chart Container */
.chart-container {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #999;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.3;
}

/* ============================================
   AUTHENTICATION MODAL
   ============================================ */

.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.auth-modal-content {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h2 {
    color: var(--primary-dark);
    margin: 15px 0 10px;
    font-size: 1.8rem;
}

.auth-header p {
    color: #666;
    font-size: 0.95rem;
}

.auth-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: var(--primary-dark);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-input {
    padding: 14px 16px;
    padding-right: 50px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: inherit;
    width: 100%;
}

.auth-input:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(0, 167, 157, 0.1);
}

.toggle-password {
    position: absolute;
    right: 10px;
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 8px 12px;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-password:hover {
    color: var(--teal);
    transform: scale(1.1);
}

.toggle-password:active {
    transform: scale(0.95);
}

.auth-error {
    background: rgba(220, 53, 69, 0.1);
    border: 2px solid #dc3545;
    border-radius: 10px;
    padding: 12px 16px;
    color: #dc3545;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-auth {
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--teal), var(--purple));
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-auth:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 167, 157, 0.3);
}

.btn-auth:active {
    transform: translateY(0);
}

.btn-cancel {
    padding: 12px 24px;
    background: transparent;
    color: #666;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-cancel:hover {
    background: #f8f9fa;
    border-color: #999;
    color: #333;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

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

    .access-table {
        font-size: 0.85rem;
    }

    .access-table th,
    .access-table td {
        padding: 8px;
    }

    .dashboard-container {
        padding: 20px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }
}
