:root {
    --primary-color: #1a5276;
    --secondary-color: #2980b9;
    --bs-link-decoration: none;
    --bs-link-hover-decoration: none;
}

body {
    background-color: #f8f9fa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

a,
a:hover,
a:focus,
a:active,
a:visited,
.breadcrumb a,
.breadcrumb-item a {
    text-decoration: none !important;
}

.navbar-brand img {
    max-height: 40px;
}

.login-card {
    max-width: 450px;
    margin: 0 auto;
}

.card {
    border: none;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    border-radius: 12px;
}

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

.btn-primary:hover {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

.table th {
    background-color: #f1f3f5;
    font-weight: 600;
    font-size: 0.875rem;
}

.student-avatar {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid #dee2e6;
}

.student-avatar-placeholder {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background-color: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: #adb5bd;
    border: 3px solid #dee2e6;
}

.student-row {
    cursor: pointer;
    transition: background-color 0.15s;
}

.student-row:hover {
    background-color: #f0f7ff !important;
}

.student-name-link,
.student-name-link:hover,
.student-name-link:focus,
.student-name-link:active,
.student-name-link:visited,
.table .student-name-link,
.student-row .student-name-link {
    color: var(--primary-color) !important;
    text-decoration: none !important;
    text-decoration-line: none !important;
    font-weight: 600;
}

.student-name-link:hover,
.student-name-link:focus,
.table .student-name-link:hover,
.student-row .student-name-link:hover {
    color: var(--secondary-color) !important;
    text-decoration: none !important;
    text-decoration-line: none !important;
}

.fee-card {
    border-left: 4px solid var(--primary-color);
}

.student-form-row {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    position: relative;
}

.student-form-row .remove-student {
    position: absolute;
    top: 10px;
    right: 10px;
}

.filter-section {
    background: #fff;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.nav-link.active {
    color: var(--primary-color) !important;
}

.app-navbar {
    background: linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);
    box-shadow: 0 1px 0 #e8eef3, 0 4px 20px rgba(26, 82, 118, 0.06);
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.app-navbar .navbar-brand img {
    transition: transform 0.2s ease;
}

.app-navbar .navbar-brand:hover img {
    transform: scale(1.03);
}

.desktop-nav {
    align-items: center;
    gap: 1.5rem;
}

.desktop-nav-list {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.625rem;
}

.desktop-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.6875rem 1rem !important;
    border-radius: 12px;
    color: #374151 !important;
    font-size: 0.9375rem;
    font-weight: 500;
    white-space: nowrap;
    border: 1px solid transparent;
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.desktop-nav-link:hover,
.desktop-nav-link:focus {
    color: var(--primary-color) !important;
    background: #f4f8fb;
    border-color: #e3eef5;
    box-shadow: 0 2px 10px rgba(26, 82, 118, 0.08);
    transform: translateY(-1px);
}

.desktop-nav-link.active {
    color: var(--primary-color) !important;
    font-weight: 600;
    background: linear-gradient(135deg, #eef6fc 0%, #e3f0fa 100%);
    border-color: #c5dff0;
    box-shadow: inset 0 -3px 0 var(--primary-color), 0 2px 10px rgba(26, 82, 118, 0.1);
}

.desktop-nav-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: #f1f5f9;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    color: var(--primary-color);
    flex-shrink: 0;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.desktop-nav-link:hover .desktop-nav-icon,
.desktop-nav-link:focus .desktop-nav-icon {
    background: #e3f0fa;
}

.desktop-nav-link.active .desktop-nav-icon {
    background: var(--primary-color);
    color: #ffffff;
}

.desktop-nav-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
    padding-left: 1rem;
    border-left: 1px solid #e8eef3;
}

.desktop-nav-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.875rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.desktop-nav-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.page-header {
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #212529;
}

.stat-card {
    text-align: center;
    padding: 1.25rem;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
}

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

.mobile-nav-drawer {
    width: min(320px, 88vw);
    border: none;
    box-shadow: 8px 0 40px rgba(26, 82, 118, 0.12);
}

.mobile-nav-header {
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, #ffffff 0%, #f4f8fb 100%);
    border-bottom: 1px solid #e8eef3 !important;
}

.mobile-nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.125rem;
    font-weight: 700;
    color: #1f2937;
}

.mobile-nav-brand img {
    border-radius: 8px;
}

.mobile-nav-close {
    padding: 0.625rem;
    border-radius: 10px;
    opacity: 0.55;
    transition: opacity 0.2s ease, background-color 0.2s ease;
}

.mobile-nav-close:hover {
    opacity: 1;
    background-color: rgba(26, 82, 118, 0.08);
}

.mobile-nav-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    background: #fafbfc;
}

.mobile-nav-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.125rem !important;
    border-radius: 14px;
    color: #374151 !important;
    font-size: 1rem;
    font-weight: 500;
    background: #ffffff;
    border: 1px solid #eef2f6;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.mobile-nav-link:hover,
.mobile-nav-link:focus {
    color: var(--primary-color) !important;
    border-color: #d6e8f5;
    box-shadow: 0 4px 14px rgba(26, 82, 118, 0.08);
    transform: translateX(2px);
}

.mobile-nav-link.active {
    color: var(--primary-color) !important;
    font-weight: 600;
    background: linear-gradient(135deg, #eef6fc 0%, #e3f0fa 100%);
    border-color: #c5dff0;
    box-shadow: inset 4px 0 0 var(--primary-color), 0 4px 14px rgba(26, 82, 118, 0.1);
}

.mobile-nav-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    color: var(--primary-color);
    flex-shrink: 0;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.mobile-nav-link:hover .mobile-nav-icon,
.mobile-nav-link:focus .mobile-nav-icon {
    background: #e3f0fa;
}

.mobile-nav-link.active .mobile-nav-icon {
    background: var(--primary-color);
    color: #ffffff;
}

.mobile-nav-text {
    line-height: 1.3;
}

.mobile-nav-actions {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e8eef3;
}

.mobile-nav-action-btn {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    justify-content: flex-start;
    padding: 0.9375rem 1.125rem;
    border-radius: 14px;
    font-weight: 500;
    font-size: 0.9375rem;
    text-align: left;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.mobile-nav-action-btn i {
    font-size: 1.25rem;
}

.mobile-nav-action-btn:hover {
    transform: translateX(2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.offcanvas-backdrop.show {
    opacity: 0.35;
}

.attendance-page-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.attendance-page-toolbar .page-header {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
}

.attendance-page-toolbar .attendance-fs-btn {
    margin-left: auto;
    flex-shrink: 0;
}

.attendance-fs-brand {
    display: none;
}

html.attendance-fullscreen .attendance-fs-brand {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    padding-bottom: 0.75rem;
    margin-bottom: 0.25rem;
    border-bottom: 1px solid #e8eef3;
}

html.attendance-fullscreen .attendance-fs-brand img {
    max-height: 48px;
    width: auto;
}

/* Attendance fullscreen (no navbar/footer) */
html.attendance-fullscreen {
    overflow: hidden;
    width: 100%;
    height: 100%;
}

html.attendance-fullscreen body {
    overflow: hidden !important;
    width: 100%;
    height: var(--attendance-vh, 100dvh);
    min-height: var(--attendance-vh, 100dvh) !important;
    max-height: var(--attendance-vh, 100dvh);
}

html.attendance-fullscreen .app-navbar,
html.attendance-fullscreen footer {
    display: none !important;
}

html.attendance-fullscreen main {
    overflow: hidden;
    width: 100%;
    height: var(--attendance-vh, 100dvh);
    min-height: var(--attendance-vh, 100dvh);
    max-height: var(--attendance-vh, 100dvh);
    flex: none;
    display: block;
}

html.attendance-fullscreen .attendance-page {
    position: fixed;
    inset: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    width: var(--attendance-vw, 100vw);
    height: var(--attendance-vh, 100dvh);
    max-width: var(--attendance-vw, 100vw);
    max-height: var(--attendance-vh, 100dvh);
    overflow: hidden;
    padding:
        max(0.75rem, env(safe-area-inset-top))
        max(0.75rem, env(safe-area-inset-right))
        max(0.75rem, env(safe-area-inset-bottom))
        max(0.75rem, env(safe-area-inset-left));
    background: #f8f9fa;
    box-sizing: border-box;
}

html.attendance-fullscreen .attendance-page > .container {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    overflow: hidden;
    padding-top: 0;
    padding-bottom: 0;
    margin: 0;
}

html.attendance-fullscreen .attendance-page-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
    flex-shrink: 0;
}

html.attendance-fullscreen .attendance-page-toolbar .page-header {
    margin-bottom: 0;
    flex: 1;
    min-width: 0;
}

html.attendance-fullscreen .attendance-page-toolbar .page-header h1 {
    font-size: 1.25rem;
    margin-bottom: 0;
}

html.attendance-fullscreen .attendance-page-toolbar .page-header p {
    display: none;
}

html.attendance-fullscreen .attendance-page-toolbar .attendance-fs-btn {
    margin-left: auto;
}

html.attendance-fullscreen .attendance-content {
    flex: 1;
    min-height: 0;
    width: 100%;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

html.attendance-fullscreen .attendance-content > .row {
    height: auto;
    min-height: 100%;
    margin: 0;
}

html.attendance-fullscreen #resultArea .card-body {
    padding: 1.25rem;
}

.attendance-fs-btn .label-exit {
    display: none;
}

.attendance-fs-btn.active .label-enter {
    display: none;
}

.attendance-fs-btn.active .label-exit {
    display: inline;
}

@media (min-width: 992px) {
    html.attendance-fullscreen #barcodeInput {
        font-size: 1.25rem;
    }
}

@media (max-width: 991.98px) {
    html.attendance-fullscreen .attendance-content > .row > .col-lg-4 {
        margin-bottom: 1rem;
    }
}

@media (max-width: 768px) {
    .student-avatar, .student-avatar-placeholder {
        width: 80px;
        height: 80px;
        font-size: 2rem;
    }
}
