@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #22c55e;
    --danger-color: #ef4444;
    --background-color: #f8fafc;
    --sidebar-bg: #1e293b;
    --sidebar-text: #f8fafc;
    --sidebar-active: #334155;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --border-color: #e2e8f0;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.5;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Sidebar Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1050; /* Ensure sidebar is above overlay and top-bar */
    transition: transform 0.3s ease-in-out;
}

.main-content {
    flex: 1;
    margin-left: 260px;
    overflow-y: auto;
    background-color: var(--background-color);
    display: flex;
    flex-direction: column;
}

.top-bar {
    height: 60px;
    background-color: #fff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.user-profile-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.user-profile {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.4rem 0.75rem;
    border-radius: 2rem;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.user-profile:hover {
    background-color: #f1f5f9;
    border-color: var(--border-color);
}

.user-avatar {
    width: 32px;
    height: 32px;
    background-color: var(--primary-color);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1rem;
}

.user-name {
    font-weight: 500;
    font-size: 0.9rem;
    color: #1e293b;
}

.profile-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    width: 200px;
    background-color: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.user-profile.active .profile-dropdown {
    display: flex;
}

.dropdown-item {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    color: #475569;
    text-decoration: none;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dropdown-item:hover {
    background-color: #f8fafc;
    color: var(--primary-color);
}

.dropdown-item.logout {
    border-top: 1px solid #e2e8f0;
    color: var(--danger-color);
}

.sidebar-brand {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Sidebar Toggle and Overlay */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: #1e293b;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}


.sidebar-brand h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 0;
}

.nav-section {
    margin-bottom: 0.5rem;
}

.nav-section-header {
    padding: 0.5rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.nav-section-header:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.nav-section-title {
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    display: block;
}

.section-arrow {
    font-size: 0.7rem;
    transition: transform 0.3s;
    color: #94a3b8;
}

.nav-section-content {
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    max-height: 500px;
    /* Large enough for content */
}

.nav-section.collapsed .nav-section-content {
    max-height: 0;
}

.nav-section.collapsed .section-arrow {
    transform: rotate(-90deg);
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.75rem;
    color: #cbd5e1;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.95rem;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background-color: var(--sidebar-active);
    color: white;
}

.nav-item.active {
    background-color: var(--sidebar-active);
    color: white;
    border-left-color: var(--primary-color);
}

.nav-icon {
    margin-right: 0.75rem;
    font-size: 1.1rem;
}

/* Sidebar Footer removed - Account moved to top bar */

/* Auth Pages */
.auth-wrapper {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #447ce4 0%, #8550be 100%);
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
}

.auth-wrapper::before,
.auth-wrapper::after {
    display: none;
}

.auth-card {
    background: #f1f2f6;
    padding: 3rem 2.5rem;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    width: 90%;
    max-width: 380px;
    text-align: center;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    animation: zoomIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes zoomIn {
    from { 
        opacity: 0; 
        transform: scale(0.6); 
    }
    to { 
        opacity: 1; 
        transform: scale(1); 
    }
}

.auth-brand {
    display: none;
    /* Remove branding as per image */
}

.auth-title {
    margin-bottom: 4rem;
    color: #000;
    font-weight: 700;
    font-size: 1.8rem;
}

/* Forms */
.form-group {
    margin-bottom: 2.5rem;
    position: relative;
}

label {
    display: none;
    /* Using placeholders/modern layout */
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 0.5rem 0;
    background: transparent;
    border: none;
    border-bottom: 2px solid #b6b6b6;
    border-radius: 0;
    font-size: 1rem;
    transition: border-color 0.3s;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 0.5rem 0;
    background: transparent;
    border: none;
    border-bottom: 2px solid #b6b6b6;
    border-radius: 0;
    font-size: 1rem;
    color: #4a5568;
    transition: border-color 0.3s;
}

input:focus {
    outline: none;
    border-bottom-color: #4299e1;
    box-shadow: none;
}

.form-group input:focus {
    outline: none;
    border-bottom-color: #4299e1;
}

input::placeholder {
    color: #a0aec0;
}

.form-group input::placeholder {
    color: #a0aec0;
    font-weight: 400;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    border: none;
    transition: background-color 0.2s;
    text-decoration: none;
    width: auto;
    min-width: 100px;
}

.btn-primary {
    background: linear-gradient(to right, #4088db, #944cb9);
    color: white;
    font-size: 1.05rem;
    padding: 0.9rem;
    border-radius: 0;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: opacity 0.3s;
    width: auto;
}

.auth-card .btn-primary {
    width: 100%;
    margin-top: 2.5rem;
    margin-bottom: 2.5rem;
    padding: 1rem;
    border-radius: 4px;
}

.auth-footer-links {
    margin-top: 1.5rem;
    font-size: 0.85rem;
    color: #7a828f;
}

.auth-footer-links p {
    margin-bottom: 0.85rem;
}

.auth-footer-links a {
    color: #3168b0;
    text-decoration: none;
    font-weight: 600;
}

.btn-primary:hover {
    opacity: 0.9;
}

.auth-footer {
    font-size: 1rem;
    color: #718096;
}

.auth-footer p {
    margin-bottom: 0.75rem;
}

.auth-footer a {
    color: #2b6cb0;
    text-decoration: none;
    font-weight: 600;
}

.auth-helper {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px dotted #cbd5e1;
    font-size: 0.8rem;
    color: #a0aec0;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

/* Dashboard */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.search-container {
    margin-bottom: 1.5rem;
    position: relative;
    max-width: 400px;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 0.95rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 0.75rem center;
    background-size: 1.1rem;
    transition: all 0.2s;
    background-color: #fff;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

input.sidebar-search-input {
    width: 100%;
    padding: 0.6rem 0.75rem 0.6rem 2.25rem;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.5rem;
    color: white !important;
    font-size: 0.9rem;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 0.6rem center;
    background-size: 1rem;
    transition: all 0.2s;
}

.sidebar-search-input:focus {
    outline: none;
    background-color: rgba(255, 255, 255, 0.15);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.3);
}

.sidebar-search-input::placeholder {
    color: #94a3b8;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
    transition: transform 0.2s;
}

.card:hover {
    transform: translateY(-2px);
}

.card h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    margin-top: 1rem;
    background: var(--card-bg);
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

th {
    background-color: #f1f5f9;
    font-weight: 600;
}

/* Oral Session */
.student-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--card-bg);
}

.status-toggle {
    display: flex;
    gap: 0.5rem;
}

.status-btn {
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    background: white;
    cursor: pointer;
}

.status-btn.active.success {
    background-color: var(--success-color);
    color: white;
    border-color: var(--success-color);
}

.status-btn.active.danger {
    background-color: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
}

/* Exam Interface */
.exam-container {
    max-width: 600px;
    margin: 0 auto;
}

.timer-sticky {
    position: sticky;
    top: 0;
    background: white;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 100;
    text-align: center;
    font-weight: 700;
    color: var(--danger-color);
    font-size: 1.25rem;
    border-radius: 0 0 0.5rem 0.5rem;
}

/* Attendance Status Highlights (Removed custom rendering to use native radio buttons) */

.question-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 0.75rem;
    margin-top: 1.5rem;
    box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
}

.question-text {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.options-grid {
    display: grid;
    gap: 1rem;
}

.option-label {
    display: flex;
    align-items: center;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.option-label:hover {
    background-color: #f1f5f9;
}

.option-label input[type="radio"] {
    width: auto;
    margin-right: 1rem;
}

.option-label.selected {
    border-color: var(--primary-color);
    background-color: #eff6ff;
}

.navigation-btns {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
}

/* Responsive */
/* Responsive & Mobile Optimizations */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
        max-width: 100%;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        text-align: center;
    }

    .dashboard-header .btn {
        width: 100%;
    }

    .card-grid {
        grid-template-columns: 1fr;
        /* Stack cards on mobile */
    }

    .table-responsive {
        border: 1px solid var(--border-color);
    }

    /* Optimize font sizes for mobile to prevent overflow */
    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    /* Better touch targets for inputs and buttons */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    select,
    textarea,
    .btn {
        min-height: 48px;
        /* Standard touch target size */
        font-size: 16px;
        /* Stop iOS zoom on focus */
    }

    /* Stack form groups visually if needed, though they are block already */

    /* Student list specific mobile tweaks */
    td,
    th {
        padding: 0.75rem 0.5rem;
        font-size: 0.9rem;
    }

    /* Action buttons in tables should stack or be larger */
    td .btn {
        margin-bottom: 0.25rem;
        display: block;
        width: 100%;
        text-align: center;
    }

    /* Flex containers in tables that hold buttons */
    td[style*="display: flex"] {
        flex-direction: column;
    }

    /* Navigation/Auth adjustments */
    .auth-card {
        padding: 1.5rem;
    }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar-toggle {
        display: block;
        margin-right: auto; /* Pushes the profile to the right */
    }

    .top-bar {
        justify-content: space-between;
        padding: 0 1rem;
    }

    .main-content {
        margin-left: 0;
    }

    .app-layout {
        flex-direction: column;
    }
}