/* ============================================================
   OBE-ANAS PO Achievement System - Modern UI Stylesheet
   Faculty of Mechanical Engineering (FKM) - UiTM
   ============================================================ */

/* ---- CSS Variables ---- */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #eef2ff;
    --primary-glow: rgba(99, 102, 241, 0.15);
    --secondary: #10b981;
    --secondary-dark: #059669;
    --secondary-light: #d1fae5;
    --accent: #f59e0b;
    --accent-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #0ea5e9;
    --info-light: #e0f2fe;
    --text: #0f172a;
    --text-secondary: #475569;
    --text-light: #94a3b8;
    --bg: #f1f5f9;
    --bg-subtle: #f8fafc;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.08), 0 4px 10px -2px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 40px -5px rgba(0, 0, 0, 0.12);
    --radius: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

::selection { background: var(--primary-light); color: var(--primary-dark); }

/* ---- Typography ---- */
h1, h2, h3, h4 { font-weight: 700; color: var(--text); letter-spacing: -0.02em; line-height: 1.3; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.15rem; }

/* ---- Layout ---- */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---- Header ---- */
.header {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #6366f1 100%);
    color: white;
    padding: 0.875rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 20px rgba(79, 70, 229, 0.25);
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-brand h1 {
    color: white;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.header-brand .subtitle {
    font-size: 0.72rem;
    opacity: 0.8;
    font-weight: 400;
    letter-spacing: 0.02em;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.header-nav a, .header-nav button {
    color: white;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
    font-family: inherit;
    backdrop-filter: blur(8px);
}

.header-nav a:hover, .header-nav button:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: translateY(-1px);
    text-decoration: none;
}

/* ---- Main Content ---- */
.main-content {
    flex: 1;
    padding: 2rem 0;
}

/* ---- Cards ---- */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

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

.card-header h2, .card-header h3 {
    margin: 0;
}

.card-body {
    padding: 1.5rem;
}

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

/* ---- Glass Card (modern) ---- */
.glass-card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

/* ---- Grid ---- */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* ---- Forms ---- */
.form-group {
    margin-bottom: 1.25rem;
}

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

.form-group .hint {
    font-size: 0.74rem;
    color: var(--text-light);
    margin-top: 0.3rem;
    line-height: 1.5;
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="search"],
select,
textarea {
    width: 100%;
    padding: 0.65rem 0.95rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-family: inherit;
    color: var(--text);
    background: white;
    transition: var(--transition-fast);
    outline: none;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

input::placeholder, textarea::placeholder {
    color: var(--text-light);
}

/* ---- File Upload ---- */
.file-upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 2rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-subtle);
    position: relative;
}

.file-upload-area:hover, .file-upload-area.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.file-upload-area .upload-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    filter: grayscale(0.3);
}

.file-upload-area p {
    color: var(--text-secondary);
    font-size: 0.88rem;
}

.file-upload-area .file-name {
    margin-top: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    font-size: 0.88rem;
}

input[type="file"] {
    display: none;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn:hover { text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); box-shadow: var(--shadow-sm); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-primary { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: white; }
.btn-primary:hover { background: linear-gradient(135deg, var(--primary-dark) 0%, #4338ca 100%); }

.btn-secondary { background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-dark) 100%); color: white; }
.btn-secondary:hover { background: linear-gradient(135deg, var(--secondary-dark) 0%, #047857 100%); }

.btn-accent { background: linear-gradient(135deg, var(--accent) 0%, #d97706 100%); color: white; }
.btn-accent:hover { background: linear-gradient(135deg, #d97706 0%, #b45309 100%); }

.btn-danger { background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%); color: white; }
.btn-danger:hover { background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%); }

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-light); }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg); color: var(--text); }

.btn-lg { padding: 0.8rem 2rem; font-size: 0.95rem; border-radius: var(--radius-md); }
.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.78rem; border-radius: var(--radius-xs); }
.btn-block { width: 100%; }

/* ---- Tables ---- */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
}

thead {
    background: linear-gradient(180deg, var(--bg-subtle) 0%, var(--bg) 100%);
}

th {
    padding: 0.8rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
}

tbody tr {
    transition: var(--transition-fast);
}

tbody tr:hover {
    background: var(--primary-light);
}

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

/* ---- Badges ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.18rem 0.6rem;
    border-radius: 50px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.badge-primary { background: var(--primary-light); color: var(--primary-dark); }
.badge-success { background: var(--secondary-light); color: #065f46; }
.badge-warning { background: var(--accent-light); color: #92400e; }
.badge-danger { background: var(--danger-light); color: #991b1b; }
.badge-info { background: var(--info-light); color: #0c4a6e; }

/* ---- Tabs ---- */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border-light);
    gap: 0;
    overflow-x: auto;
    background: var(--bg-subtle);
    padding: 0 0.5rem;
}

.tab-btn {
    padding: 0.8rem 1.25rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    font-family: inherit;
    position: relative;
}

.tab-btn:hover { color: var(--primary); }

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content { display: none; padding: 1.5rem 0; }
.tab-content.active { display: block; }

/* ---- Stats ---- */
.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    border: 1px solid var(--border);
    text-align: center;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    opacity: 0;
    transition: var(--transition);
}

.stat-card:hover::before { opacity: 1; }
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat-card .stat-value {
    font-size: 2.2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-card .stat-label {
    font-size: 0.72rem;
    color: var(--text-light);
    margin-top: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

/* ---- PO Score Bar ---- */
.po-bar-container {
    margin-bottom: 0.75rem;
}

.po-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--text-secondary);
}

.po-bar {
    height: 8px;
    background: var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.po-bar-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    background-image: linear-gradient(90deg, currentColor, currentColor);
}

/* ---- Landing Page ---- */
.hero {
    text-align: center;
    padding: 4rem 0 3rem;
}

.hero h1 {
    font-size: 2.8rem;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 40%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.03em;
}

.hero p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 2.5rem;
    line-height: 1.7;
}

.role-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    max-width: 1000px;
    margin: 0 auto;
}

.role-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
    text-align: center;
    border: 2px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.role-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transform: scaleX(0);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: left center;
}

.role-card:hover::before { transform: scaleX(1); }

.role-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-xl);
    transform: translateY(-6px);
}

.role-card .role-icon {
    font-size: 3.5rem;
    margin-bottom: 1.25rem;
    display: block;
}

.role-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.role-card p {
    color: var(--text-light);
    font-size: 0.88rem;
    line-height: 1.6;
}

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

.modal-overlay.active { display: flex; }

.modal {
    background: var(--card-bg);
    border-radius: var(--radius);
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-xl);
    animation: modalIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border);
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.92) translateY(15px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    padding: 1.5rem 1.5rem 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 { font-size: 1.3rem; }

.modal-close {
    background: var(--bg);
    border: 1px solid var(--border);
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-light);
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-xs);
    transition: var(--transition-fast);
}

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

.modal-body { padding: 1.5rem; }
.modal-footer {
    padding: 0 1.5rem 1.5rem;
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* ---- Toast ---- */
#toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.25rem;
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--primary);
    font-size: 0.84rem;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 400px;
    font-weight: 500;
}

.toast-show { opacity: 1; transform: translateX(0); }
.toast-success { border-left-color: var(--secondary); }
.toast-error { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--accent); }
.toast-icon { font-size: 1.1rem; }

/* ---- Loading Overlay ---- */
#loading-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.88);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

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

.spinner {
    width: 44px;
    height: 44px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto 1rem;
}

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

#loading-message {
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 500;
}

/* ---- Chart Container ---- */
.chart-container {
    position: relative;
    max-width: 500px;
    margin: 0 auto;
    padding: 1rem;
}

.chart-container-lg {
    max-width: 600px;
}

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-light);
}

.empty-state .empty-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}

.empty-state h3 {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.empty-state p {
    color: var(--text-light);
    font-size: 0.88rem;
}

/* ---- Alert ---- */
.alert {
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.alert-info { background: var(--info-light); color: #0c4a6e; border: 1px solid #bae6fd; }
.alert-success { background: var(--secondary-light); color: #065f46; border: 1px solid #a7f3d0; }
.alert-warning { background: var(--accent-light); color: #92400e; border: 1px solid #fde68a; }
.alert-danger { background: var(--danger-light); color: #991b1b; border: 1px solid #fca5a5; }

/* ---- Student Info Card ---- */
.student-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--primary-light) 0%, #ede9fe 50%, #fae8ff 100%);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    border: 1px solid rgba(99, 102, 241, 0.15);
}

.student-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.student-details h2 {
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
}

.student-details p {
    color: var(--text-secondary);
    font-size: 0.84rem;
}

/* ---- PO Summary Grid ---- */
.po-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
    gap: 0.65rem;
}

.po-summary-item {
    text-align: center;
    padding: 0.7rem 0.4rem;
    border-radius: var(--radius-sm);
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    transition: var(--transition-fast);
}

.po-summary-item:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.po-summary-item .po-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.po-summary-item .po-score {
    font-size: 1.25rem;
    font-weight: 800;
    margin: 0.2rem 0;
}

.po-summary-item .po-grade {
    font-size: 0.62rem;
    font-weight: 600;
}

/* ---- Upload Log Table ---- */
.log-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
    background: var(--card-bg);
    transition: var(--transition-fast);
}

.log-row:hover { box-shadow: var(--shadow); }

.log-meta {
    flex: 1;
    min-width: 0;
}

.log-meta .log-course {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text);
}

.log-meta .log-info {
    font-size: 0.78rem;
    color: var(--text-light);
    margin-top: 0.2rem;
}

.log-meta .log-remark {
    font-size: 0.78rem;
    color: var(--accent);
    font-style: italic;
    margin-top: 0.2rem;
}

.log-actions {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}

/* ---- Footer ---- */
.footer {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: rgba(255, 255, 255, 0.6);
    padding: 1.5rem 0;
    text-align: center;
    font-size: 0.78rem;
    margin-top: auto;
    letter-spacing: 0.01em;
}

.footer a { color: rgba(255, 255, 255, 0.85); }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .header .container { flex-direction: column; text-align: center; }
    .hero h1 { font-size: 2rem; }
    .hero p { font-size: 0.95rem; }
    .role-cards { grid-template-columns: 1fr; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .student-info { flex-direction: column; text-align: center; }
    .tabs { gap: 0; }
    .tab-btn { padding: 0.6rem 0.9rem; font-size: 0.78rem; }
    .container { padding: 0 1rem; }
    
    /* Mobile chart improvements */
    .chart-container, .chart-container-lg {
        max-width: 100%;
        padding: 0.5rem;
        margin-left: auto;
        margin-right: auto;
    }
    .chart-container canvas, .chart-container-lg canvas {
        margin: 0 auto;
        display: block;
    }
    
    /* Mobile comparison table */
    .compare-table { font-size: 0.7rem; }
    .compare-table th, .compare-table td { padding: 0.35rem 0.25rem; }
    .compare-table thead th:first-child { min-width: 80px; }
    
    .compare-panel { padding: 0.75rem; }
    .compare-search-row { flex-direction: column; }
    .compare-chips { gap: 0.35rem; }
    .compare-chip { font-size: 0.72rem; padding: 0.25rem 0.5rem; }

    /* Card spacing */
    .card-header { padding: 1rem; flex-wrap: wrap; }
    .card-body { padding: 1rem; }
    
    /* Better mobile form */
    .form-group label { font-size: 0.82rem; }
    input, select, textarea { font-size: 0.86rem; }
    
    /* Subject breakdown mobile */
    .subject-po-bars { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .card-body { padding: 0.75rem; }
    .hero { padding: 2rem 0; }
    .hero h1 { font-size: 1.6rem; }
    .main-content { padding: 1rem 0; }
    
    /* Very small screen chart */
    .chart-container canvas { max-height: 280px; }
    
    .po-summary-grid { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 0.4rem; }
    .po-summary-item { padding: 0.5rem 0.3rem; }
    .po-summary-item .po-score { font-size: 1rem; }
    .po-summary-item .po-label { font-size: 0.6rem; }
}

/* ---- Print ---- */
@media print {
    .header, .footer, .header-nav, .btn, .tabs { display: none !important; }
    .card { box-shadow: none; border: 1px solid #ccc; }
    body { background: white; }
}

/* ---- Utility Classes ---- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-light); }
.text-primary { color: var(--primary); }
.text-success { color: var(--secondary); }
.text-danger { color: var(--danger); }
.text-sm { font-size: 0.78rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.hidden { display: none !important; }

/* ---- Fade In Animation ---- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ---- Pulse Animation for stat values ---- */
@keyframes countUp {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

.stat-animate {
    animation: countUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ---- Remark Tag ---- */
.remark-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-xs);
    background: var(--accent-light);
    color: #92400e;
    font-size: 0.72rem;
    font-weight: 500;
    font-style: italic;
}

/* ---- Action Confirm ---- */
.confirm-banner {
    background: var(--danger-light);
    border: 1px solid #fca5a5;
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.confirm-banner p {
    color: #991b1b;
    font-size: 0.84rem;
    font-weight: 500;
}

/* ---- AI Analysis Card ---- */
.ai-card {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 40%, #f0fdf4 100%);
    border: 1px solid #bae6fd;
    border-radius: var(--radius);
    overflow: hidden;
}

.ai-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #bae6fd;
    background: rgba(255,255,255,0.5);
}

.ai-header .ai-icon {
    font-size: 2rem;
}

.ai-header .ai-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

.ai-header .ai-subtitle {
    font-size: 0.78rem;
    color: var(--text-light);
}

.ai-body {
    padding: 1.25rem 1.5rem;
}

.ai-overall {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1rem;
    background: var(--card-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    margin-bottom: 1.25rem;
}

.ai-overall-score {
    min-width: 80px;
    text-align: center;
}

.ai-overall-score .big-score {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
}

.ai-overall-score .score-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 0.25rem;
}

.ai-overall-text {
    flex: 1;
    font-size: 0.86rem;
    color: var(--text-secondary);
    line-height: 1.65;
}

.ai-bands {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.ai-band {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    border: 1px solid;
}

.ai-band.excellent { background: #dcfce7; color: #15803d; border-color: #bbf7d0; }
.ai-band.good { background: #dbeafe; color: #1d4ed8; border-color: #bfdbfe; }
.ai-band.satisfactory { background: #fef3c7; color: #b45309; border-color: #fde68a; }
.ai-band.moderate { background: #ffedd5; color: #c2410c; border-color: #fed7aa; }
.ai-band.weak { background: #fee2e2; color: #dc2626; border-color: #fecaca; }

.ai-reco {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
    font-size: 0.84rem;
    line-height: 1.6;
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.ai-reco.critical { background: #fee2e2; border-left: 3px solid #ef4444; }
.ai-reco.warning { background: #fef3c7; border-left: 3px solid #f59e0b; }
.ai-reco.success { background: #dcfce7; border-left: 3px solid #10b981; }
.ai-reco.info { background: #e0f2fe; border-left: 3px solid #0ea5e9; }

.ai-reco-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.ai-reco-content {
    flex: 1;
}

.ai-reco-title {
    font-weight: 700;
    margin-bottom: 0.15rem;
    color: var(--text);
}

.ai-balance {
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ai-balance-level {
    font-weight: 700;
    font-size: 0.9rem;
}

.ai-balance-text {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

/* ---- Performance Band Legend ---- */
.band-legend {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-subtle);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.band-legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    font-weight: 500;
}

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

/* ---- Batch Access Control ---- */
.batch-access-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    background: var(--card-bg);
}

.batch-access-row .batch-label {
    font-weight: 700;
    min-width: 90px;
}

.batch-access-row .batch-status {
    flex: 1;
    font-size: 0.82rem;
    color: var(--text-light);
}

/* ---- Password Prompt Overlay ---- */
.pw-prompt-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.7);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(12px);
}

.pw-prompt-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 2rem;
    width: 100%;
    max-width: 380px;
    text-align: center;
    box-shadow: var(--shadow-xl);
    animation: modalIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.pw-prompt-card .pw-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
}

.pw-prompt-card h3 {
    margin-bottom: 0.5rem;
}

.pw-prompt-card p {
    font-size: 0.84rem;
    color: var(--text-light);
    margin-bottom: 1.25rem;
}

/* ---- Modern Compact View Toggle ---- */
.view-switch {
    display: inline-flex;
    background: var(--bg);
    border-radius: 8px;
    padding: 3px;
    border: 1px solid var(--border);
}

.view-switch button {
    padding: 0.35rem 0.75rem;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-light);
    border-radius: 6px;
    transition: all 0.2s;
    font-family: inherit;
}

.view-switch button.active {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

/* ---- Search Input Enhanced ---- */
.search-input-wrapper {
    position: relative;
    max-width: 500px;
    margin: 0 auto;
}

.search-input-wrapper input {
    padding-left: 2.5rem;
    border-radius: 50px;
    border: 2px solid var(--border);
    background: var(--card-bg);
    font-size: 0.92rem;
    height: 48px;
}

.search-input-wrapper input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.search-input-wrapper .search-icon-abs {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
    color: var(--text-light);
    pointer-events: none;
}

/* ---- Student Name Search in Admin ---- */
.admin-search-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.admin-search-bar input {
    flex: 1;
    min-width: 200px;
}

.admin-search-bar .search-results-inline {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    max-height: 250px;
    overflow-y: auto;
    z-index: 20;
    box-shadow: var(--shadow-lg);
    display: none;
}

.admin-search-bar .search-results-inline.active {
    display: block;
}

/* Mobile-friendly improvements */
@media (max-width: 768px) {
    .ai-overall { flex-direction: column; text-align: center; }
    .ai-overall-score { min-width: auto; }
    .ai-bands { justify-content: center; }
    .ai-body { padding: 1rem; }
    .ai-header { padding: 1rem; }
    .batch-access-row { flex-direction: column; align-items: flex-start; gap: 0.4rem; }
    .admin-search-bar { flex-direction: column; }
    .admin-search-bar input { min-width: 100%; }
}
