/* Custom Premium CSS for Lisa Ocenki Grading System */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --accent-color: #6366f1;
    --accent-hover: #4f46e5;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --success-color: #10b981;
    --danger-color: #ef4444;
    --border-color: rgba(0, 0, 0, 0.08);
    --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.08);
    --border-radius: 16px;
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
    background-color: #f8fafc;
    background-image: radial-gradient(rgba(99, 102, 241, 0.06) 1.2px, transparent 1.2px), radial-gradient(rgba(99, 102, 241, 0.06) 1.2px, #f8fafc 1.2px);
    background-size: 24px 24px;
    background-position: 0 0, 12px 12px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    padding-bottom: 40px;
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Base Layout Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header & Navigation */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
}

.logo-container h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.logo-container p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.nav-link:hover {
    color: var(--text-primary);
    background-color: rgba(0, 0, 0, 0.04);
}

.nav-link.active {
    color: var(--accent-color);
    background-color: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

/* Custom Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    outline: none;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: var(--bg-tertiary);
}

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

.btn-danger:hover {
    opacity: 0.9;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 1rem;
    transition: all 0.2s;
    outline: none;
}

.form-control:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Dropdown/Select wrapper styling */
select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
    padding-right: 40px;
}

/* Premium Glass Cards */
.card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--card-shadow);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Class Grading Page Grid Layout */
.grading-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.grading-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

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

.student-row {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    transition: all 0.2s;
}

.student-row:hover {
    border-color: rgba(99, 102, 241, 0.4);
    transform: translateX(4px);
}

.student-name-section {
    flex-grow: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.student-name {
    font-weight: 700;
    font-size: 1.2rem;
}

.student-controls-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* GPA Desktop vs Mobile display styles */
.gpa-desktop {
    display: inline-flex;
}

.gpa-mobile {
    display: none;
}

/* Grade Entry Custom Options Dropdown */
.grade-select {
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    padding: 8px 12px;
    font-weight: 600;
    font-size: 1rem;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
    text-align: center;
    width: 70px;
}

.grade-select:focus {
    border-color: var(--accent-color);
}

/* Save / Ajax status feedback button */
.btn-save {
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 8px;
    background-color: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-save:hover {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}

.btn-save.success {
    background-color: var(--success-color) !important;
    border-color: var(--success-color) !important;
    color: white;
}

/* Modal Popup Window */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    max-width: 550px;
    width: 100%;
    box-shadow: var(--card-shadow);
    padding: 24px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 1.3rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

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

/* Grade Distribution Card Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-color);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.gpa-card {
    grid-column: span 2;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(168, 85, 247, 0.1) 100%);
    border-color: rgba(99, 102, 241, 0.2);
}

.gpa-card .stat-value {
    font-size: 2rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.grades-distribution {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 20px;
    background-color: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: 10px;
}

.dist-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.dist-num {
    font-weight: 600;
    font-size: 0.9rem;
}

.dist-count {
    color: var(--accent-color);
    font-weight: 700;
    margin-top: 4px;
}

.dist-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Modal Grades Table List */
.modal-table {
    width: 100%;
    border-collapse: collapse;
}

.modal-table th, .modal-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.modal-table th {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
}

.modal-table td {
    font-size: 0.95rem;
}

.modal-table .grade-badge {
    background-color: var(--bg-tertiary);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.modal-table .grade-badge.empty {
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 0.8rem;
}

/* Admin Dashboard Table Matrix style */
.admin-grid-container {
    overflow-x: auto;
    margin-bottom: 30px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background-color: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
}

.matrix-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.matrix-table th, .matrix-table td {
    padding: 6px 10px;
    text-align: center;
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.matrix-table th {
    background-color: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-secondary);
}

.matrix-table th.sticky-col, .matrix-table td.sticky-col {
    position: sticky;
    left: 0;
    background-color: #f8fafc;
    z-index: 10;
    text-align: left;
    font-weight: 600;
}

.matrix-table td.grade-cell {
    font-weight: 700;
}

.matrix-table td.empty-cell {
    color: rgba(255, 255, 255, 0.15);
    font-weight: 400;
}

/* Grid Layout for Admin Forms */
.admin-management-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

@media(min-width: 768px) {
    .admin-management-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.admin-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background-color: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
}

/* Login Glassmorphism Card alignment */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}

.login-card {
    max-width: 400px;
    width: 100%;
}

/* Tabs Styling */
.tab-container {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: white;
    background: var(--accent-gradient);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Mobile Responsiveness adjustments */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
    
    .grading-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 12px;
    }
    
    .student-row {
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 20px !important;
        gap: 14px !important;
    }

    .student-name-section {
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        width: 100% !important;
    }
    
    .student-controls-section {
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100% !important;
        gap: 12px !important;
    }

    .student-controls-section .btn-view-all {
        width: 100% !important;
        order: 3; /* Push down on mobile */
        padding: 12px !important;
    }

    .student-controls-section .grade-select {
        width: 100% !important;
        height: 48px !important;
    }

    .student-controls-section .btn-save {
        width: 100% !important;
        height: 48px !important;
    }

    .table-columns-header {
        display: none !important;
    }

    .col-teacher {
        display: none !important;
    }

    .modal-close {
        font-size: 2.2rem !important;
        color: var(--text-primary) !important;
        background-color: rgba(255, 255, 255, 0.08) !important;
        border-radius: 50% !important;
        width: 44px !important;
        height: 44px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        transition: all 0.2s ease !important;
        margin-top: -10px;
        margin-right: -10px;
    }
    
    .modal-close:active {
        background-color: rgba(255, 255, 255, 0.15) !important;
        transform: scale(0.95);
    }
}

/* GPA Border Rotation Animation */
@keyframes borderGlowRotation {
    0% {
        box-shadow: 0 0 10px rgba(99, 102, 241, 0.6), inset 0 0 5px rgba(99, 102, 241, 0.4);
        border-color: #6366f1;
    }
    33% {
        box-shadow: 0 0 10px rgba(168, 85, 247, 0.6), inset 0 0 5px rgba(168, 85, 247, 0.4);
        border-color: #a855f7;
    }
    66% {
        box-shadow: 0 0 10px rgba(16, 185, 129, 0.6), inset 0 0 5px rgba(16, 185, 129, 0.4);
        border-color: #10b981;
    }
    100% {
        box-shadow: 0 0 10px rgba(99, 102, 241, 0.6), inset 0 0 5px rgba(99, 102, 241, 0.4);
        border-color: #6366f1;
    }
}

.gpa-animated-badge {
    background-color: #ffffff;
    border: 2px solid #6366f1;
    border-radius: 50px;
    padding: 6px 16px;
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    animation: borderGlowRotation 4s linear infinite;
}

/* View All Grades Button Premium Style */
.btn-view-all {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(168, 85, 247, 0.15) 100%);
    border: 1px solid rgba(168, 85, 247, 0.35);
    color: #f8fafc;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-view-all:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.3) 0%, rgba(168, 85, 247, 0.3) 100%);
    border-color: #a855f7;
    box-shadow: 0 0 12px rgba(168, 85, 247, 0.2);
}

/* Global Font Size Increase for Better Readability */
body, input, select, button, textarea {
    font-size: 1.08rem !important; /* Scaled up from 1rem */
}

.student-name {
    font-size: 1.25rem !important;
}

h1 {
    font-size: 1.85rem !important;
}

h2 {
    font-size: 1.65rem !important;
}

.card-title {
    font-size: 1.35rem !important;
}

/* Sidebar Layout for Admin Dashboard */
.admin-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 24px;
    align-items: start;
}

.sidebar {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    list-style: none;
}

.sidebar-btn {
    width: 100%;
    text-align: left;
    padding: 12px 16px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 1.05rem;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.2s;
}

.sidebar-btn:hover {
    color: var(--text-primary);
    background-color: rgba(0, 0, 0, 0.04);
}

.sidebar-btn.active {
    color: white;
    background: var(--accent-gradient);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

@media (max-width: 768px) {
    .admin-layout {
        grid-template-columns: 1fr;
    }
    
    .sidebar-menu {
        flex-direction: row;
        overflow-x: auto;
        padding-bottom: 8px;
    }
    
    .sidebar-btn {
        white-space: nowrap;
        text-align: center;
        padding: 10px 16px;
    }
}

/* Color-coded grades for Matrix and other views */
.grade-5 {
    background-color: rgba(16, 185, 129, 0.2) !important;
    color: #10b981 !important;
}
.grade-4 {
    background-color: rgba(6, 182, 212, 0.2) !important;
    color: #06b6d4 !important;
}
.grade-3 {
    background-color: rgba(245, 158, 11, 0.2) !important;
    color: #f59e0b !important;
}
.grade-2 {
    background-color: rgba(249, 115, 22, 0.2) !important;
    color: #f97316 !important;
}
.grade-1 {
    background-color: rgba(239, 68, 68, 0.2) !important;
    color: #ef4444 !important;
}

/* Student Row Grading Animation & Filtering styles */
.student-row {
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.student-row.has-grade {
    opacity: 0.75;
    border-color: rgba(0, 0, 0, 0.04);
}

.student-row.row-highlight-active {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(99, 102, 241, 0.15) 100%) !important;
    border-color: var(--success-color) !important;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
    opacity: 1 !important;
    transform: scale(1.02);
}


