/* App Styles - ExamWeb Dashboard (Admin, Guru, Student) */

:root {
    /* Primary - Midnight Blue */
    --primary: #1e3a5f;
    --primary-light: #2d5a8a;
    --primary-dark: #0f1f33;
    --primary-subtle: #e8eef5;

    /* Accent - Orange */
    --accent: #f97316;
    --accent-hover: #ea580c;
    --accent-light: #fff7ed;

    /* Semantic */
    --success: #10b981;
    --success-subtle: #d1fae5;
    --warning: #f59e0b;
    --warning-subtle: #fef3c7;
    --danger: #ef4444;
    --danger-subtle: #fee2e2;
    --info: #0ea5e9;
    --info-subtle: #e0f2fe;

    /* Neutrals */
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #1e3a5f;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --text-white: #ffffff;
    --border: #e5e7eb;
    --border-light: #f3f4f6;

    /* Typography */
    --font-heading: "Plus Jakarta Sans", sans-serif;
    --font-body: "Inter", sans-serif;

    /* Spacing */
    --sidebar-width: 260px;
    --navbar-height: 64px;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    color: var(--text-primary);
    background-color: var(--bg-main);
    line-height: 1.6;
    margin: 0;
    min-height: 100vh;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.2;
    margin-top: 0;
    margin-bottom: 0.5rem;
}

h1 {
    font-size: 2rem;
}
h2 {
    font-size: 1.75rem;
}
h3 {
    font-size: 1.5rem;
}
h4 {
    font-size: 1.25rem;
}
h5 {
    font-size: 1.1rem;
}
h6 {
    font-size: 1rem;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-light);
}

/* ==================== Layout ==================== */

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: var(--text-white);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand .brand-icon {
    width: 40px;
    height: 40px;
    background: var(--accent);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.sidebar-brand .brand-text {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.25rem;
    color: white;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
}

.sidebar-section {
    padding: 0 16px;
    margin-bottom: 24px;
}

.sidebar-section-title {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.4);
    padding: 0 12px;
    margin-bottom: 8px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-md);
    margin: 0 8px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.sidebar-link i {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.sidebar-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-left: 3px solid var(--accent);
    margin-left: 5px;
}

.sidebar-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 16px 24px;
}

.sidebar-user {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-user-avatar {
    width: 40px;
    height: 40px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

.sidebar-user-dropdown {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.sidebar-user-dropdown:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

/* Top Navbar */
.top-navbar {
    height: var(--navbar-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.navbar-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.navbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.navbar-breadcrumb a {
    color: var(--text-muted);
}

.navbar-breadcrumb a:hover {
    color: var(--primary);
}

.navbar-breadcrumb .separator {
    color: var(--text-muted);
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.navbar-icon-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--bg-main);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.navbar-icon-btn:hover {
    background: var(--primary-subtle);
    color: var(--primary);
}

.navbar-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
}

.navbar-plan-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* Page Content */
.page-content {
    padding: 24px;
}

.page-header {
    margin-bottom: 24px;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ==================== Components ==================== */

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}

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

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-main);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Stat Cards */
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.primary {
    background: var(--primary-subtle);
    color: var(--primary);
}

.stat-icon.success {
    background: var(--success-subtle);
    color: var(--success);
}

.stat-icon.warning {
    background: var(--warning-subtle);
    color: var(--warning);
}

.stat-icon.info {
    background: var(--info-subtle);
    color: var(--info);
}

.stat-icon.danger {
    background: var(--danger-subtle);
    color: var(--danger);
}

.stat-icon.orange {
    background: var(--accent-light);
    color: var(--accent);
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.stat-change {
    font-size: 0.8rem;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-change.positive {
    color: var(--success);
}

.stat-change.negative {
    color: var(--danger);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn i {
    font-size: 1.1rem;
}

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

.btn-primary:hover {
    background: var(--primary-light);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.btn-accent:hover {
    background: var(--accent-hover);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

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

.btn-success:hover {
    background: #059669;
    color: white;
}

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

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

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

.btn-warning:hover {
    background: #d97706;
    color: white;
}

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

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

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

.btn-outline-secondary {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text-secondary);
}

.btn-outline-secondary:hover {
    background: var(--bg-main);
    color: var(--text-primary);
}

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

.btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-md);
}

.btn-icon.btn-sm {
    width: 32px;
    height: 32px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    font-size: 0.95rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-subtle);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control:disabled {
    background: var(--bg-main);
    cursor: not-allowed;
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

select.form-control {
    cursor: pointer;
}

.form-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 6px;
}

.form-error {
    font-size: 0.8rem;
    color: var(--danger);
    margin-top: 6px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-check-input {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.form-check-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
}

/* Tables */
.table-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.table {
    width: 100%;
    margin: 0;
}

.table thead th {
    background: var(--bg-main);
    padding: 14px 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
    text-align: left;
}

.table tbody td {
    padding: 16px 20px;
    font-size: 0.9rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

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

.table tbody tr:hover {
    background: var(--bg-main);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 20px;
}

.badge-primary {
    background: var(--primary-subtle);
    color: var(--primary);
}

.badge-success {
    background: var(--success-subtle);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-subtle);
    color: #b45309;
}

.badge-danger {
    background: var(--danger-subtle);
    color: var(--danger);
}

.badge-info {
    background: var(--info-subtle);
    color: var(--info);
}

.badge-orange {
    background: var(--accent-light);
    color: var(--accent);
}

/* Alerts */
.alert {
    padding: 16px 20px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 20px;
}

.alert i {
    font-size: 1.25rem;
    margin-top: 2px;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.alert-message {
    font-size: 0.9rem;
    opacity: 0.9;
}

.alert-primary {
    background: var(--primary-subtle);
    color: var(--primary);
}

.alert-success {
    background: var(--success-subtle);
    color: #065f46;
}

.alert-warning {
    background: var(--warning-subtle);
    color: #92400e;
}

.alert-danger {
    background: var(--danger-subtle);
    color: #991b1b;
}

/* Dropdown */
.dropdown-menu {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 8px;
    min-width: 200px;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    font-size: 0.9rem;
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.dropdown-item i {
    color: var(--text-muted);
    font-size: 1rem;
    width: 20px;
}

.dropdown-item:hover {
    background: var(--bg-main);
    color: var(--primary);
}

.dropdown-item:hover i {
    color: var(--primary);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-light);
    margin: 8px 0;
}

/* Modal */
.modal-backdrop {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
}

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

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-main);
}

/* Pagination */
.pagination {
    display: flex;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.page-item .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.page-item .page-link:hover {
    background: var(--bg-main);
    color: var(--primary);
    border-color: var(--primary);
}

.page-item.active .page-link {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.page-item.disabled .page-link {
    background: var(--bg-main);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* ==================== Utility Classes ==================== */

.text-primary {
    color: var(--primary) !important;
}
.text-secondary {
    color: var(--text-secondary) !important;
}
.text-muted {
    color: var(--text-muted) !important;
}
.text-success {
    color: var(--success) !important;
}
.text-warning {
    color: var(--warning) !important;
}
.text-danger {
    color: var(--danger) !important;
}
.text-white {
    color: white !important;
}
.text-orange {
    color: var(--accent) !important;
}

.bg-primary {
    background-color: var(--primary) !important;
}
.bg-success {
    background-color: var(--success) !important;
}
.bg-warning {
    background-color: var(--warning) !important;
}
.bg-danger {
    background-color: var(--danger) !important;
}

.fw-bold {
    font-weight: 700;
}
.fw-semibold {
    font-weight: 600;
}
.fw-medium {
    font-weight: 500;
}

.mb-0 {
    margin-bottom: 0;
}
.mb-1 {
    margin-bottom: 0.25rem;
}
.mb-2 {
    margin-bottom: 0.5rem;
}
.mb-3 {
    margin-bottom: 1rem;
}
.mb-4 {
    margin-bottom: 1.5rem;
}
.mb-5 {
    margin-bottom: 3rem;
}

.mt-0 {
    margin-top: 0;
}
.mt-1 {
    margin-top: 0.25rem;
}
.mt-2 {
    margin-top: 0.5rem;
}
.mt-3 {
    margin-top: 1rem;
}
.mt-4 {
    margin-top: 1.5rem;
}
.mt-5 {
    margin-top: 3rem;
}

.me-1 {
    margin-right: 0.25rem;
}
.me-2 {
    margin-right: 0.5rem;
}
.me-3 {
    margin-right: 1rem;
}
.ms-1 {
    margin-left: 0.25rem;
}
.ms-2 {
    margin-left: 0.5rem;
}
.ms-3 {
    margin-left: 1rem;
}

.pb-0 {
    padding-bottom: 0;
}
.p-4 {
    padding: 1.5rem;
}

.d-flex {
    display: flex;
}
.d-inline-flex {
    display: inline-flex;
}
.d-block {
    display: block;
}
.d-none {
    display: none;
}
.d-grid {
    display: grid;
}

.flex-wrap {
    flex-wrap: wrap;
}
.flex-column {
    flex-direction: column;
}
.align-items-center {
    align-items: center;
}
.align-items-start {
    align-items: flex-start;
}
.justify-content-between {
    justify-content: space-between;
}
.justify-content-center {
    justify-content: center;
}
.gap-2 {
    gap: 0.5rem;
}
.gap-3 {
    gap: 1rem;
}
.gap-4 {
    gap: 1.5rem;
}

.w-100 {
    width: 100%;
}
.h-100 {
    height: 100%;
}

.overflow-hidden {
    overflow: hidden;
}
.overflow-auto {
    overflow: auto;
}

.rounded {
    border-radius: var(--radius-md);
}
.rounded-lg {
    border-radius: var(--radius-lg);
}
.rounded-xl {
    border-radius: var(--radius-xl);
}
.rounded-0 {
    border-radius: 0;
}

.shadow {
    box-shadow: var(--shadow);
}
.shadow-sm {
    box-shadow: var(--shadow-sm);
}
.shadow-md {
    box-shadow: var(--shadow-md);
}
.shadow-lg {
    box-shadow: var(--shadow-lg);
}

/* ==================== Responsive ==================== */

@media (max-width: 991px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

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

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

    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .sidebar-overlay.show {
        display: block;
    }
}

/* ==================== Auth Pages ==================== */

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(
        135deg,
        var(--primary) 0%,
        var(--primary-dark) 100%
    );
}

.auth-card {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    padding: 24px;
    width: 100%;
    /* max-width: 440px; */
}

.auth-card-wide {
    max-width: 800px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo .logo-icon {
    width: 72px;
    height: 72px;
    background: var(--accent);
    border-radius: var(--radius-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    margin-bottom: 16px;
}

.auth-logo .logo-text {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.75rem;
    color: var(--primary);
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 8px;
}

.auth-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ==================== Student Dashboard Overrides ==================== */

body.student-layout .sidebar {
    --sidebar-width: 220px;
}

/* ==================== Result Page ==================== */

.icon-success {
    font-size: 4rem;
}

.leaderboard-th-rank {
    width: 60px;
}

.progress-sm {
    height: 20px;
}

.progress-sm .progress-bar {
    font-size: 0.75rem;
}
