@import url('futuristic-input.css');
/* CSS Variables */
:root {
    --primary-color: #4f46e5;
    --secondary-color: #06b6d4;
    --accent-color: #f59e0b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --info-color: #3b82f6;
    
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --gradient-4: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    --gradient-5: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    --gradient-6: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    --gradient-7: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    --gradient-8: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
    
    --sidebar-width: 280px;
    --header-height: 48px;
    --footer-height: 36px;
    --border-radius: 12px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --border-color: #e5e7eb;
    --control-height: 44px;
    --button-height: 42px;
    --text-color: #1f2937;
    --background-color: #ffffff;
}

.top-student-green {
    color: var(--success-color);
}

.top-student-pct {
    font-weight: 800;
    font-size: var(--top-students-percentage-font-size, var(--top-students-pct-font-size, inherit));
}

:root {
    --top-students-item-width: clamp(120px, 22vw, 160px);
    --top-students-item-padding: 8px;
    --top-students-item-border: 5px;
    --top-students-item-radius: 18px;
    --top-students-frame-color: #16a34a;
    --top-students-photo-height: clamp(120px, 26vw, 170px);
    --top-students-student-name-font-size: 16px;
    --top-students-rank-font-size: 16px;
    --top-students-percentage-font-size: 16px;
    --top-students-name-font-size: var(--top-students-student-name-font-size);
    --top-students-meta-font-size: 12px;
    --top-students-class-font-size: var(--top-students-rank-font-size);
    --top-students-pct-font-size: var(--top-students-percentage-font-size);
    --top-students-initial-font-size: 40px;
    --top-students-header-min-height: calc(var(--top-students-photo-height) + 104px);
    --top-students-track-gap: 14px;
    --top-students-arrows-padding: 72px;
}

html.device-mobile {
    --top-students-item-width: min(92vw, 520px);
    --top-students-item-padding: 12px;
    --top-students-item-border: 7px;
    --top-students-item-radius: 22px;
    --top-students-photo-height: min(72vw, 440px);
    --top-students-student-name-font-size: 26px;
    --top-students-rank-font-size: 22px;
    --top-students-percentage-font-size: 26px;
    --top-students-name-font-size: var(--top-students-student-name-font-size);
    --top-students-meta-font-size: 20px;
    --top-students-class-font-size: var(--top-students-rank-font-size);
    --top-students-pct-font-size: var(--top-students-percentage-font-size);
    --top-students-initial-font-size: 76px;
    --top-students-header-min-height: calc(var(--top-students-photo-height) + 170px);
    --top-students-track-gap: 18px;
    --top-students-arrows-padding: 92px;
}

.top-students-item {
    width: var(--top-students-item-width);
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 0 0 auto;
    padding: var(--top-students-item-padding);
    border: var(--top-students-item-border) solid var(--top-students-frame-color);
    border-radius: var(--top-students-item-radius);
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 0 1px rgba(22, 163, 74, 0.45), 0 8px 18px rgba(22, 163, 74, 0.18);
    box-sizing: border-box;
}

.top-students-photo {
    width: 100%;
    height: var(--top-students-photo-height);
    border-radius: calc(var(--top-students-item-radius) - 4px);
    object-fit: cover;
    display: block;
    background: rgba(0, 0, 0, 0.08);
}

.top-students-photo-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: var(--top-students-initial-font-size);
    color: var(--text-primary);
}

.top-students-name {
    text-align: left;
    font-weight: 800;
    line-height: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--top-students-name-font-size);
}

.top-students-class {
    text-align: center;
    font-weight: 700;
    line-height: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: var(--top-students-class-font-size, var(--top-students-meta-font-size));
}

.top-students-rank {
    text-align: center;
    font-weight: 700;
    line-height: 1;
    font-size: var(--top-students-rank-font-size, var(--top-students-meta-font-size));
}

.top-students-track > div {
    width: var(--top-students-item-width) !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    flex: 0 0 auto !important;
    padding: var(--top-students-item-padding) !important;
    border: var(--top-students-item-border) solid var(--top-students-frame-color) !important;
    border-radius: var(--top-students-item-radius) !important;
    background: rgba(255, 255, 255, 0.9) !important;
    box-shadow: 0 0 0 1px rgba(22, 163, 74, 0.45), 0 8px 18px rgba(22, 163, 74, 0.18) !important;
    box-sizing: border-box !important;
}

.top-students-track > div > img,
.top-students-track > div > div:first-child {
    width: 100% !important;
    height: var(--top-students-photo-height) !important;
    border-radius: calc(var(--top-students-item-radius) - 4px) !important;
    object-fit: cover !important;
    display: block !important;
}

.top-students-track > div > div:first-child {
    background: rgba(0, 0, 0, 0.08) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: 900 !important;
    font-size: var(--top-students-initial-font-size) !important;
}

.top-students-header {
    height: auto !important;
    min-height: var(--top-students-header-min-height, 160px);
    margin-bottom: 8px;
}

.top-students-header.has-arrows .top-students-marquee {
    padding-left: var(--top-students-arrows-padding) !important;
    padding-right: var(--top-students-arrows-padding) !important;
    box-sizing: border-box;
}

.top-students-header.expanded {
    height: auto !important;
    overflow: visible !important;
}

.top-students-header.expanded .top-students-marquee {
    overflow: visible !important;
}

.top-students-header.expanded .top-students-track {
    animation: none !important;
    transform: none !important;
    width: 100% !important;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
}

.top-students-header.has-arrows {
    position: relative;
    padding-left: 0;
    padding-right: 0;
}

.top-students-header.has-arrows {
    --top-students-arrow-center: calc(12px + var(--top-students-item-border) + var(--top-students-item-padding) + (var(--top-students-photo-height) / 2));
}

.top-students-arrow {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--text-primary);
    box-shadow: none;
    border-radius: 0;
    height: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0;
    cursor: pointer;
    user-select: none;
    outline: none;
    transform: none;
    transition: none;
}

.top-students-arrow,
.top-students-arrow:hover,
.top-students-arrow:focus,
.top-students-arrow:focus-visible,
.top-students-arrow:active {
    border: 0 !important;
    border-image: none !important;
    background: transparent !important;
    box-shadow: none !important;
    outline: none !important;
    transform: none !important;
    transition: none !important;
}

.top-students-arrow::before,
.top-students-arrow::after {
    content: none !important;
}

.top-students-arrow-left {
    position: absolute;
    left: 10px;
    top: var(--top-students-arrow-center);
    transform: translateY(-50%);
    z-index: 2;
    font-size: 44px;
    line-height: 1;
}

.top-students-arrow-right {
    position: absolute;
    right: 10px;
    top: var(--top-students-arrow-center);
    transform: translateY(-50%);
    z-index: 2;
}

.top-students-arrow-label {
    font-weight: 800;
    font-size: 14px;
    color: var(--text-primary);
    white-space: nowrap;
}

.top-students-arrow-icon {
    font-weight: 900;
    font-size: 44px;
    line-height: 1;
}

/* Badge Styles */
.badge {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.375rem;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

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

.badge-secondary {
    background-color: var(--text-secondary);
    color: white;
}

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

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

/* Reset and/* Modern Form Styles */
.modern-form {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 0;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow-x: auto;
    overflow-y: auto;
    margin: 20px 0;
}

.form-header-gradient {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
    padding: 30px;
    text-align: center;
    color: white;
    position: relative;
}

.form-title {
    margin: 0;
    font-size: 2.2em;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.form-icon {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 2em;
    opacity: 0.8;
}

.form-content {
    padding: 30px;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
}

.form-section {
    margin-bottom: 30px;
    padding: 25px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 15px;
    border-left: 5px solid #ff6b6b;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.section-title {
    color: #2c3e50;
    font-size: 1.4em;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title i {
    color: #ff6b6b;
    font-size: 1.2em;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.form-grid > * {
    min-width: 0;
}

.form-grid > :only-child {
    grid-column: 1 / -1;
}

.form-grid > .form-grid-last-full {
    grid-column: 1 / -1;
}

.form-grid > .form-group-textarea-full {
    grid-column: 1 / -1;
}

.form-group {
    position: relative;
    margin-bottom: 20px;
}

.form-group label {
    color: #2c3e50;
    font-weight: 600;
    margin-bottom: 8px;
    display: block;
    font-size: 0.95em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Unified glass form look */
.form-container {
    background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(16,185,129,0.1));
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    margin: 20px 0;
}

.form-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(90deg, var(--primary-color), #0ea5e9);
    color: #fff;
}

.form-title {
    margin: 0;
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: 0.3px;
}

.form-content {
    padding: 20px;
    background: #ffffff;
}

.form-actions {
    padding: 16px 20px;
    text-align: right;
    border-top: 1px solid #e5e7eb;
    background: #ffffff;
}

.form-group {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px 14px;
}

.form-group label::before,
.form-label::before {
    content: "";
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
    background: radial-gradient(circle at 30% 30%, #a78bfa, #7c3aed);
}

.form-control,
.modern-input,
.modern-select,
.form-select,
input[type="text"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="email"],
input[type="password"],
textarea,
select {
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 10px 12px;
    background: #fff;
    min-height: var(--control-height);
    box-sizing: border-box;
}

.form-control:focus,
.modern-input:focus,
.modern-select:focus,
.form-select:focus,
input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.hidden { display: none !important; }

.modern-input, .modern-select {
    width: 100%;
    padding: 15px 45px 15px 15px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 1em;
    transition: all 0.3s ease;
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.modern-input:focus, .modern-select:focus {
    outline: none;
    border-color: #ff6b6b;
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.2);
    transform: translateY(-2px);
}

.input-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    font-size: 1.1em;
    pointer-events: none;
}

/* Toggle Switch Styles */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
    margin-right: 10px;
}

.toggle-input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    transition: 0.4s;
    border-radius: 34px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background: white;
    transition: 0.4s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.toggle-input:checked + .toggle-slider {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
}

.toggle-input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

.toggle-label {
    font-weight: 600;
    color: #2c3e50;
    font-size: 1em;
    vertical-align: middle;
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 34px;
    border: 2px solid transparent;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.slider:before {
    content: "";
    position: absolute;
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: #fff;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.switch input:checked + .slider {
    background-color: var(--success-color);
    border-color: var(--success-color);
}

.switch input:checked + .slider:before {
    transform: translateX(26px);
}

html[dir="rtl"] .switch input:checked + .slider:before {
    transform: translateX(26px);
}

/* Profile Section */
.profile-section {
    text-align: center;
    margin-bottom: 30px;
}

.profile-image-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.profile-image-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    transition: transform 0.3s ease;
}

.profile-image-wrapper:hover {
    transform: scale(1.05);
}

.profile-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 3em;
}

.profile-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.profile-image-wrapper:hover .profile-overlay {
    opacity: 1;
}

.profile-upload-btn {
    color: white;
    font-size: 1.5em;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.profile-upload-btn:hover {
    transform: scale(1.1);
}

.employee-toggle-container {
    display: flex;
    align-items: center;
    gap: 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 15px 25px;
    border-radius: 25px;
    border: 2px solid #dee2e6;
}

/* Student Assignment */
.student-assignment-container {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 15px;
    padding: 20px;
    border: 2px solid #e9ecef;
}

.student-search-box {
    position: relative;
    margin-bottom: 20px;
}

.btn-modern {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.9em;
}

.btn-search {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    padding: 8px 16px;
    border-radius: 20px;
}

.btn-search:hover {
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

.student-results, .selected-students-container {
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
    border: 1px solid #dee2e6;
}

.student-list, .selected-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.student-item {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.student-item button {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
}

/* Salary Configuration */
.salary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.salary-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.salary-option {
    display: flex;
    align-items: center;
    gap: 15px;
    background: white;
    padding: 15px;
    border-radius: 10px;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.salary-option:hover {
    border-color: #ff6b6b;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.salary-amount {
    margin-left: auto;
    max-width: 120px;
}

/* Permissions */
.permission-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    padding: 25px;
    border-radius: 15px;
    border: 2px solid #e9ecef;
}

.permission-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: white;
    border-radius: 10px;
    border: 1px solid #dee2e6;
    transition: all 0.3s ease;
}

.permission-item:hover {
    border-color: #ff6b6b;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.permission-checkbox {
    position: relative;
    width: 20px;
    height: 20px;
}

.permission-input {
    opacity: 0;
    width: 0;
    height: 0;
}

.permission-checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 20px;
    width: 20px;
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.permission-input:checked + .permission-checkmark {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    border-color: #4CAF50;
}

.permission-checkmark:after {
    content: "";
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 12px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.permission-input:checked + .permission-checkmark:after {
    display: block;
}

.permission-label {
    font-weight: 500;
    color: #2c3e50;
    font-size: 0.9em;
    flex: 1;
}

.permission-icon {
    color: #6c757d;
    font-size: 1.1em;
}

/* Credentials Section */
.credentials-section {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border-left-color: #f39c12;
}

.credentials-toggle {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 10px;
    border: 2px solid #f39c12;
}

.credentials-fields {
    background: white;
    padding: 20px;
    border-radius: 10px;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.credentials-fields.hidden {
    display: none;
}

.btn-generate, .btn-password {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: 10px;
}

.btn-generate:hover, .btn-password:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.password-actions {
    display: flex;
    gap: 5px;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    height: auto;
    align-items: center;
}

/* Ensure consistent input field heights and widths */
.form-group {
    position: relative;
    width: 100%;
}

.form-group .modern-input {
    width: 100%;
    padding-right: 80px; /* Make space for action buttons */
    height: 45px; /* Consistent height */
    box-sizing: border-box;
}

/* Modern Action Buttons */
.modern-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    padding: 25px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 0 0 20px 20px;
    border-top: 2px solid #dee2e6;
}

.btn-modern {
    padding: 15px 30px;
    border: none;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.9em;
    min-width: 120px;
    justify-content: center;
}

.btn-submit {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
}

.btn-submit:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(76, 175, 80, 0.4);
}

.btn-cancel {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
    color: white;
}

.btn-cancel:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(244, 67, 54, 0.4);
}

.btn-reset {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
}

.btn-reset:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(255, 152, 0, 0.4);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--gradient-1);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
    max-width: 100vw;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Keyframe Animations */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modern Results Entry Form Styles */
.results-entry-form {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 30px;
    margin: 20px 0;
    animation: slideUp 0.5s ease-out;
}

.form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.form-header h3 {
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.exam-info {
    display: flex;
    align-items: center;
}

.exam-type {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.exam-type.final-exam {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    color: #d63384;
    box-shadow: 0 4px 8px rgba(214, 51, 132, 0.2);
}

.exam-type.regular-exam {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    color: #0ea5e9;
    box-shadow: 0 4px 8px rgba(14, 165, 233, 0.2);
}

.modern-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 20px 0;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.modern-table th {
    background: var(--gradient-1);
    color: white;
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modern-table th:first-child {
    border-top-left-radius: var(--border-radius);
}

.modern-table th:last-child {
    border-top-right-radius: var(--border-radius);
}

.modern-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
    transition: background-color 0.3s ease;
}

.modern-table tr:hover td {
    background: var(--bg-tertiary);
}

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

.mark-input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border-color) !important;
    border-radius: 8px !important;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s ease;
    background: var(--bg-primary) !important;
    box-shadow: none !important;
}

.mark-input:focus {
    outline: none;
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1) !important;
    transform: translateY(-1px);
}

.mark-edit-input,
.edit-input,
input.mark-input[type="number"],
input.mark-edit-input[type="number"],
input.edit-input[type="number"] {
    border: 2px solid var(--border-color) !important;
    background: var(--bg-primary) !important;
    border-radius: 8px !important;
    box-shadow: none !important;
}

.mark-edit-input:focus,
.edit-input:focus,
input.mark-input[type="number"]:focus,
input.mark-edit-input[type="number"]:focus,
input.edit-input[type="number"]:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1) !important;
}

.mark-input.subject-mark {
    border-color: #3b82f6 !important;
}

.mark-input.subject-mark:focus {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2) !important;
}

.mark-input.activity-mark {
    border-color: #10b981 !important;
}

.mark-input.activity-mark:focus {
    border-color: #059669 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2) !important;
}

.mark-input.attendance-mark {
    border-color: #f59e0b !important;
}

.mark-input.attendance-mark:focus {
    border-color: #d97706 !important;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2) !important;
}

.total-mark {
    font-weight: 700;
    font-size: 1.1rem;
    text-align: center;
    padding: 10px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.total-mark.excellent {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    color: white;
    box-shadow: 0 4px 8px rgba(67, 233, 123, 0.3);
}

.total-mark.good {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    box-shadow: 0 4px 8px rgba(79, 172, 254, 0.3);
}

.total-mark.average {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: white;
    box-shadow: 0 4px 8px rgba(250, 112, 154, 0.3);
}

.total-mark.poor {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    color: #d63384;
    box-shadow: 0 4px 8px rgba(255, 154, 158, 0.3);
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}

button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    width: auto;
    opacity: 1;
    visibility: visible;
    color: var(--text-primary);
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    min-height: var(--button-height);
    white-space: nowrap;
    width: auto;
    opacity: 1;
    visibility: visible;
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(16, 185, 129, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
    box-shadow: 0 4px 8px rgba(107, 114, 128, 0.3);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(107, 114, 128, 0.4);
}

@media (max-width: 1024px) {
    .form-control,
    .modern-input,
    .modern-select,
    .form-select,
    input[type="text"],
    input[type="number"],
    input[type="date"],
    input[type="time"],
    input[type="email"],
    input[type="password"],
    textarea,
    select {
        padding: 9px 12px;
        font-size: 0.95rem;
    }
    .btn,
    .btn-modern,
    .login-btn,
    .btn-primary {
        padding: 10px 20px;
        font-size: 0.95rem;
    }
    .section-title {
        font-size: 1.25rem;
    }
    .form-title {
        font-size: 1.15rem;
    }
}

@media (max-width: 768px) {
    .mobile-bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 64px;
        background: var(--bg-primary);
        border-top: 1px solid var(--border-color);
        box-shadow: 0 -4px 12px rgba(0,0,0,0.08);
        display: flex;
        align-items: center;
        justify-content: space-around;
        z-index: 1002;
    }
    .mobile-bottom-nav .nav-item {
        flex: 1;
        text-align: center;
    }
    .mobile-bottom-nav .nav-btn {
        background: transparent;
        border: none;
        color: var(--text-primary);
        font-size: 0.85rem;
        font-weight: 600;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 100%;
        padding: 8px 0;
        cursor: pointer;
    }
    .mobile-bottom-nav .nav-btn .icon {
        font-size: 1.2rem;
        margin-bottom: 4px;
        line-height: 1;
    }
    .mobile-bottom-nav .nav-btn.active {
        color: var(--primary-color);
    }
    .main-content {
        padding-bottom: 72px;
    }
    .results-entry-form {
        padding: 20px;
        margin: 10px 0;
    }
    
    .form-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .modern-table {
        font-size: 0.9rem;
    }
    
    .modern-table th,
    .modern-table td {
        padding: 10px 8px;
    }
    
    .mark-input {
        padding: 6px 10px;
        font-size: 0.85rem;
    }
    .form-control,
    .modern-input,
    .modern-select,
    .form-select,
    input[type="text"],
    input[type="number"],
    input[type="date"],
    input[type="time"],
    input[type="email"],
    input[type="password"],
    textarea,
    select {
        padding: 6px 10px;
        font-size: 0.85rem;
    }
    .btn,
    .btn-modern,
    .login-btn,
    .btn-primary {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
    .section-title {
        font-size: 1.15rem;
    }
    .form-title {
        font-size: 1.05rem;
    }
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
        margin-bottom: 10px;
    }
    .stat-number {
        font-size: 1.6rem;
    }
    .quick-action-card {
        padding: 16px;
    }
    .quick-action-icon {
        width: 48px;
        height: 48px;
        font-size: 1.4rem;
        margin-bottom: 10px;
    }
    .quick-action-title {
        font-size: 1rem;
    }
    .quick-action-desc {
        font-size: 0.85rem;
    }
    .form-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .btn {
        justify-content: center;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes bellRing {
    0%, 50%, 100% { transform: rotate(0deg); }
    10%, 30% { transform: rotate(-10deg); }
    20%, 40% { transform: rotate(10deg); }
}

@keyframes shine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

@keyframes expandWidth {
    from { width: 0; }
    to { width: 100%; }
}

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

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Login Page Styles */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 20px;
    background: var(--gradient-1);
    animation: fadeIn 1s ease-out;
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 450px;
    text-align: center;
    animation: slideUp 0.8s ease-out;
}

.login-logo {
    width: 80px;
    height: 80px;
    background: var(--gradient-2);
    border-radius: 50%;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
    animation: pulse 2s infinite;
}

.login-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-subtitle {
    color: var(--text-secondary);
    margin-bottom: 30px;
    font-size: 1rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
    text-align: left;
}

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

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

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.login-btn, .btn-primary {
    padding: 14px;
    background: var(--gradient-1);
    color: #ffffff;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    width: auto;
    max-width: 100%;
    opacity: 1;
    visibility: visible;
}

.login-btn:hover, .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.login-btn:active, .btn-primary:active {
    transform: translateY(0);
}

.login-btn::before, .btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.login-btn:hover::before, .btn-primary:hover::before {
    left: 100%;
}

/* Input Group and Button Styles */
.input-group {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    width: 100%;
}

.input-group .form-control {
    position: relative;
    flex: 1 1 auto;
    width: 1%;
    min-width: 0;
}

.input-group-append {
    display: flex;
    margin-left: -1px;
}

.input-group-append .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    height: 100%;
}

.btn-outline-secondary {
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
    background: var(--bg-primary);
    padding: 12px 16px;
    border-radius: var(--border-radius);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--button-height);
    white-space: nowrap;
}

.btn-outline-secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--text-secondary);
    transform: translateY(-1px);
}

.btn-sm {
    padding: 8px 12px;
    font-size: 0.875rem;
    line-height: 1.5;
    border-radius: 6px;
}

.btn-outline-secondary i {
    font-size: 1rem;
}

.btn-outline-secondary:hover i {
    transform: scale(1.1);
}

/* Dashboard Container Base Styles */
.dashboard-container {
    display: flex;
    flex: 1;
    background: var(--bg-secondary);
    min-height: calc(100vh - var(--footer-height));
}

/* Sidebar Styles */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(135deg, #ff6b6b 0%, #4ecdc4 25%, #45b7d1 50%, #96ceb4 75%, #ffeaa7 100%);
    box-shadow: 0 8px 32px rgba(255, 107, 107, 0.4);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: all 0.3s ease;
    border-right: 1px solid rgba(255, 255, 255, 0.3);
    padding-bottom: 0;
}

.sidebar.collapsed {
    width: 0;
    overflow: hidden;
}
html[dir="rtl"] .sidebar.collapsed {
    width: 0;
    overflow: hidden;
}

.sidebar-header {
    display: none;
}

.sidebar-header::before {
    display: none;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-self: start;
}
.header-center {
    justify-self: center;
    text-align: center;
}
.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-self: end;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background: var(--gradient-2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
    flex-shrink: 0;
}

.logo-text {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    transition: opacity 0.3s ease;
}

.sidebar-logo {
    width: 60px;
    height: 60px;
    margin-right: 15px;
    object-fit: contain;
    flex-shrink: 0;
    border: none;
    box-shadow: none;
    border-radius: 0;
    transition: none;
    backdrop-filter: none;
}
.sidebar-header .sidebar-logo {
    position: absolute;
    left: calc(var(--sidebar-width) + 12px);
    top: 50%;
    transform: translateY(-50%);
    margin-right: 0;
    z-index: 1101;
    pointer-events: none;
}

html[dir="rtl"] .sidebar-header .sidebar-logo {
    right: calc(var(--sidebar-width) + 12px);
    left: auto;
}

.sidebar-logo:hover {
    transform: translateY(-50%);
    box-shadow: none;
    border-color: transparent;
}

.sidebar-school-name {
    font-weight: 800;
    font-size: 20px;
    color: white;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    letter-spacing: 0.5px;
    background: linear-gradient(45deg, #ffffff, #e8f4f8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar.collapsed .logo-text {
    opacity: 0;
    pointer-events: none;
}

.sidebar.collapsed .sidebar-school-name {
    opacity: 0;
    pointer-events: none;
}

.sidebar-toggle {
    background: rgba(255, 255, 255, 0.12);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(5px);
}
.sidebar-header .sidebar-toggle {
    position: relative;
    z-index: 1103;
}
body.has-global-header .sidebar-header .sidebar-toggle {
    display: none;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.3);
    transform: none;
    box-shadow: none;
}

.sidebar-expand {
    position: relative;
    background: linear-gradient(135deg, #ff6b6b 0%, #4ecdc4 50%, #45b7d1 100%);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.4);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.5);
    backdrop-filter: blur(10px);
    margin-right: 10px;
}

.sidebar-expand:hover {
    background: linear-gradient(135deg, #45b7d1 0%, #4ecdc4 50%, #ff6b6b 100%);
    transform: scale(1.15) rotate(180deg);
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.7);
}

.nav-menu {
    flex: 1;
    padding: 25px 0 0;
    overflow-y: auto;
    overflow-x: hidden;
    background: linear-gradient(180deg, rgba(255, 107, 107, 0.15) 0%, rgba(78, 205, 196, 0.1) 25%, rgba(69, 183, 209, 0.08) 50%, rgba(150, 206, 180, 0.06) 75%, rgba(255, 234, 167, 0.04) 100%);
}

.nav-menu::-webkit-scrollbar {
    width: 8px;
}

.nav-menu::-webkit-scrollbar-track {
    background: linear-gradient(180deg, rgba(255, 107, 107, 0.2) 0%, rgba(78, 205, 196, 0.15) 25%, rgba(69, 183, 209, 0.1) 50%, rgba(150, 206, 180, 0.08) 75%, rgba(255, 234, 167, 0.05) 100%);
    border-radius: 4px;
}

.nav-menu::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #ff6b6b 0%, #4ecdc4 50%, #45b7d1 100%);
    border-radius: 4px;
    border: 2px solid rgba(255, 107, 107, 0.3);
}

.nav-menu::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #ff4757 0%, #26de81 50%, #3742fa 100%);
    box-shadow: 0 0 15px rgba(255, 107, 107, 0.7);
}

.nav-item {
    margin-bottom: 8px;
    padding: 0 15px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: #ffffff;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 4px solid #007bff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.3px;
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    margin: 2px 0;
    background: linear-gradient(90deg, rgba(0, 123, 255, 0.7) 0%, rgba(0, 86, 179, 0.8) 100%);
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.9);
    box-shadow: 0 8px 25px rgba(0, 123, 255, 0.4), inset 0 0 30px rgba(0, 123, 255, 0.3);
    border: 1px solid rgba(0, 123, 255, 0.5);
    transform: translateX(8px) scale(1.02);
}

.nav-link:hover {
    background: linear-gradient(90deg, rgba(0, 123, 255, 0.75) 0%, rgba(0, 86, 179, 0.85) 100%);
    color: #ffffff;
    border-left-color: #0056b3;
    transform: translateX(8px) scale(1.03);
    text-shadow: 0 0 18px rgba(255, 255, 255, 1);
    box-shadow: 0 10px 30px rgba(0, 123, 255, 0.5), inset 0 0 35px rgba(0, 123, 255, 0.4);
    border: 1px solid rgba(0, 123, 255, 0.7);
}

.nav-link:hover::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s ease;
}

.nav-link:hover::before {
    left: 100%;
}

.nav-link.active {
    background: linear-gradient(90deg, rgba(255, 193, 7, 0.8) 0%, rgba(255, 152, 0, 0.9) 100%);
    color: #000000;
    border-left-color: #ffc107;
    font-weight: 800;
    text-shadow: 0 0 20px rgba(255, 255, 255, 1);
    box-shadow: inset 0 0 40px rgba(255, 193, 7, 0.5), 0 10px 30px rgba(255, 193, 7, 0.6);
    transform: translateX(5px);
    border-radius: 12px;
    border: 2px solid rgba(255, 193, 7, 0.8);
}

/* Main Content Styles */
.main-content {
    flex: 1;
    margin-left: 0;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--footer-height) - var(--header-height));
    transition: margin-left 0.3s ease;
    position: relative;
    padding-top: 0;
}

/* Constrain dashboard layout between fixed header and footer */
body.has-dashboard-layout #header-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1100;
}

body.has-dashboard-layout #footer-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

body.has-dashboard-layout .toast,
body.has-dashboard-layout .notification,
body.has-dashboard-layout #toast-container,
body.has-dashboard-layout .toast-container {
    z-index: 20000 !important;
    top: calc(var(--header-height) + 20px) !important;
    bottom: auto !important;
}

body.has-dashboard-layout #toastContainer {
    z-index: 20000 !important;
    bottom: calc(var(--footer-height) + 20px) !important;
    top: auto !important;
}

html.has-dashboard-layout,
body.has-dashboard-layout {
    overflow: auto !important;
    overflow-x: auto !important;
    height: 100% !important;
    width: 100% !important;
    max-width: 100% !important;
}
html.no-x-scroll-desktop:not(.device-mobile).has-dashboard-layout,
html.no-x-scroll-desktop:not(.device-mobile) body.has-dashboard-layout {
    overflow-x: hidden !important;
}
html.no-x-scroll-desktop:not(.device-mobile) body.has-dashboard-layout .main-content .row {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Fix for mobile/tablet zoom and scroll */
html.device-mobile.has-dashboard-layout {
    overflow: auto !important;
    overflow-x: auto !important;
    height: auto !important;
}

body.has-dashboard-layout .dashboard-container {
    margin-top: var(--header-height);
    margin-bottom: var(--footer-height);
    height: calc(100vh - var(--header-height) - var(--footer-height));
    height: calc(100dvh - var(--header-height) - var(--footer-height));
    min-height: 0;
    display: flex;
    align-items: stretch;
    width: auto !important;
    max-width: none !important;
    overflow-x: auto !important;
    position: relative;
}
html.no-x-scroll-desktop:not(.device-mobile) body.has-dashboard-layout .dashboard-container {
    overflow-x: hidden !important;
}

body.has-dashboard-layout .main-content {
    height: 100%;
    overflow-y: auto;
    overflow-x: auto !important;
    padding-bottom: 0;
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    width: 0; /* Let flex-grow handle it */
}
html.no-x-scroll-desktop:not(.device-mobile) body.has-dashboard-layout .main-content {
    overflow-x: hidden !important;
}

.sidebar.collapsed ~ .main-content {
    margin-left: 0;
}

/* Ensure toggle works even if sibling selector fails */
.main-content.expanded {
    margin-left: 0;
}
html[dir="rtl"] .main-content.expanded {
    margin-right: 0;
}

/* Global collapse fallback using body flag */
body.sidebar-collapsed .sidebar {
    width: 0 !important;
    min-width: 0 !important;
    overflow: hidden !important;
    border-right: none !important;
    box-shadow: none !important;
}

body.sidebar-collapsed .main-content {
    margin-left: 0 !important;
}
html[dir="rtl"] body.sidebar-collapsed .main-content {
    margin-right: 0 !important;
}

html.device-mobile body.has-dashboard-layout {
    overflow-x: auto !important;
    overflow-y: auto !important; /* Fixed: Allow vertical scroll on mobile */
}


html.device-mobile body.has-dashboard-layout .dashboard-container {
    position: relative;
    width: auto !important;
    min-width: 100% !important;
}


html.device-mobile body.has-dashboard-layout .sidebar {
    position: relative;
    top: auto;
    bottom: auto;
    left: auto;
    z-index: 950;
}
html[dir="rtl"].device-mobile body.has-dashboard-layout .sidebar {
    left: auto;
    right: auto;
}

html.device-mobile body.has-dashboard-layout .main-content {
    flex: 1 1 auto;
    width: auto !important;
    min-width: 100% !important;
    overflow-x: hidden !important;
}



html.device-mobile body.has-dashboard-layout .sidebar:not(.collapsed) ~ .main-content {
    margin-left: 0;
}
html[dir="rtl"].device-mobile body.has-dashboard-layout .sidebar:not(.collapsed) ~ .main-content {
    margin-left: 0;
    margin-right: 0;
}

/* Header Styles */
.header {
    height: auto;
    background: transparent;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0;
    position: static;
    border-bottom: none;
}

.search-bar {
    display: none;
}

.search-input {
    width: 100%;
    padding: 6px 12px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 16px;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    transition: all 0.2s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    color: #2c3e50;
    -webkit-text-fill-color: #2c3e50;
    font-weight: 500;
    line-height: 1.1;
}
.search-input::placeholder {
    color: #64748b;
    -webkit-text-fill-color: #64748b;
}

.search-input:focus {
    outline: none;
    border-color: #ff6b6b;
    box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.3), 0 8px 32px rgba(255, 107, 107, 0.2);
    transform: translateY(-2px);
}

.header-actions {
    display: none;
}

.notification-btn {
    position: relative;
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    border: 2px solid rgba(255, 255, 255, 0.4);
    font-size: 1rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(255, 154, 158, 0.3);
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.notification-btn:hover {
    background: linear-gradient(135deg, #ff6b6b 0%, #ffa726 100%);
    animation: bellRing 0.5s ease-in-out;
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 8px 32px rgba(255, 107, 107, 0.4);
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ff4757 100%);
    color: white;
    font-size: 0.7rem;
    padding: 3px 7px;
    border-radius: 12px;
    min-width: 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(255, 71, 87, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.6);
    font-weight: 700;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px 15px;
    border-radius: 25px;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.1) 100%);
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.user-profile:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0.2) 100%);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ffa726 50%, #ff6b6b 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 4px 16px rgba(255, 107, 107, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.4);
    transition: all 0.3s ease;
}

.user-name {
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.user-profile:hover .user-name {
    color: #ffeaa7;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.user-profile:hover .user-avatar {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 8px 32px rgba(255, 107, 107, 0.6);
    border-color: rgba(255, 255, 255, 0.6);
}

.search-highlight {
    background: linear-gradient(90deg, #ffeaa7 0%, #ffd166 100%);
    color: #111827;
    border-radius: 4px;
    padding: 0 2px;
}

/* Content Area Styles */
.content {
    flex: 1;
    padding: 30px;
    background: var(--bg-secondary);
}

.page-content {
    width: 100%;
}

.page {
    animation: fadeIn 0.3s ease-out;
}

.page h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 30px;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Card Styles */
.card {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 20px;
    transition: all 0.3s ease;
}

.card:hover {
    /* Removed transform to prevent movement */
    box-shadow: var(--shadow-lg);
}
 
/* Transparent layout for Top Students: no box */
.top-students-card {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
}

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

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

.card-body {
    color: var(--text-secondary);
    overflow: visible !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
}

/* Stat Card Styles */
.stat-card {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    position: relative;
    overflow: visible !important;
}

.grid {
    --stat-card-height: 160px;
    --stat-card-padding: 16px;
    --stat-icon-size: 46px;
    --stat-icon-margin-bottom: 10px;
    --stat-number-size: 1.85rem;
}

.grid .stat-card {
    height: var(--stat-card-height) !important;
    padding: var(--stat-card-padding) !important;
    box-sizing: border-box;
    overflow: hidden !important;
}

.grid .stat-icon {
    width: var(--stat-icon-size) !important;
    height: var(--stat-icon-size) !important;
    margin-bottom: var(--stat-icon-margin-bottom) !important;
    font-size: 1.4rem !important;
}

.grid .stat-number {
    font-size: var(--stat-number-size) !important;
    line-height: 1.1;
}

.grid .stat-label {
    font-size: 0.85rem !important;
}

.stat-card:hover {
    /* Removed transform to prevent movement */
    box-shadow: var(--shadow-lg);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-1);
}

.stat-card.gradient-2::before { background: var(--gradient-2); }
.stat-card.gradient-3::before { background: var(--gradient-3); }
.stat-card.gradient-4::before { background: var(--gradient-4); }
.stat-card.gradient-5::before { background: var(--gradient-5); }

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    margin-bottom: 16px;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

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

/* Grid Layouts */
.grid {
    display: grid;
    gap: 20px;
    width: 100%;
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
}

/* Table Styles */
.table-container {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: visible !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
    max-width: 100%;
    position: relative;
}

.table-responsive,
.marks-table-scroll,
.attendance-table,
[class*="table-scroll"],
[class*="table-wrapper"],
[class*="table-container"] {
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
    overflow-x: visible !important;
    overflow-y: visible !important;
}

/* Ensure table doesn't cause page overflow */
.card .table-container {
    margin: 0;
    padding: 0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 200px;
    white-space: normal;
}

/* Keep the system-admin school tables fitted to the card width without internal scrollbars */
.schools-fit-table-container {
    overflow: visible !important;
    max-height: none !important;
    height: auto !important;
}

.schools-fit-table {
    width: 100%;
    table-layout: fixed !important;
}

.schools-fit-table th,
.schools-fit-table td {
    max-width: none;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    vertical-align: middle;
    line-height: 1.35;
    font-size: 0.95rem;
}

.schools-fit-table th {
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
}

.schools-fit-table th:last-child,
.schools-fit-table td:last-child,
.schools-fit-table th:nth-child(5),
.schools-fit-table td:nth-child(5),
.schools-fit-table th:nth-child(6),
.schools-fit-table td:nth-child(6),
.schools-fit-table th:nth-child(7),
.schools-fit-table td:nth-child(7),
.schools-fit-table th:nth-child(8),
.schools-fit-table td:nth-child(8) {
    text-align: center;
}

#schoolsOverviewTable th:nth-child(1) { width: 34%; }
#schoolsOverviewTable th:nth-child(2) { width: 13%; }
#schoolsOverviewTable th:nth-child(3) { width: 12%; }
#schoolsOverviewTable th:nth-child(4) { width: 12%; }
#schoolsOverviewTable th:nth-child(5) { width: 15%; }
#schoolsOverviewTable th:nth-child(6) { width: 14%; }

#schoolsTable th:nth-child(1) { width: 18%; }
#schoolsTable th:nth-child(2) { width: 10%; }
#schoolsTable th:nth-child(3) { width: 16%; }
#schoolsTable th:nth-child(4) { width: 12%; }
#schoolsTable th:nth-child(5) { width: 17%; }
#schoolsTable th:nth-child(6) { width: 11%; }
#schoolsTable th:nth-child(7) { width: 8%; }
#schoolsTable th:nth-child(8) { width: 8%; }

.schools-fit-table .badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    white-space: nowrap;
    word-break: normal;
    line-height: 1.2;
    padding: 6px 10px;
}

.schools-fit-table .action-dropdown-dotted {
    display: inline-flex;
    justify-content: center;
    width: 100%;
}

.schools-fit-table td:nth-child(6),
.schools-fit-table td:nth-child(7),
.schools-fit-table td:nth-child(8) {
    white-space: nowrap;
}

.marks-form {
    overflow: visible;
}

.marks-table-scroll {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
}

.marks-form .marks-entry-table {
    width: max-content;
    min-width: 100%;
    table-layout: auto;
}

.marks-form .marks-entry-table th,
.marks-form .marks-entry-table td {
    max-width: none;
    white-space: nowrap;
}

.marks-table-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    margin: 12px 0 0;
}

.marks-table-controls .marks-student-search {
    flex: 1 1 280px;
    min-width: 280px;
}

@media (max-width: 768px) {
    .marks-table-controls .marks-student-search {
        flex: 0 0 50%;
        max-width: 50%;
        min-width: 0;
    }
    .marks-table-controls #clearMarksStudentSearch {
        display: none !important;
    }
}

/* RTL table alignment: headers and cells start from the right */
html[dir="rtl"] .modern-table th,
html[dir="rtl"] .modern-table td {
    text-align: right;
}
html[dir="rtl"] .data-table th,
html[dir="rtl"] .data-table td {
    text-align: right !important;
}
/* Generic RTL table alignment for any table */
html[dir="rtl"] table th,
html[dir="rtl"] table td {
    text-align: right !important;
}
/* RTL form field alignment */
html[dir="rtl"] input:not([type="checkbox"]):not([type="radio"]),
html[dir="rtl"] textarea,
html[dir="rtl"] select {
    text-align: right !important;
    direction: rtl;
}

.data-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-primary);
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/*.data-table tr:hover {
    /* Removed hover background to prevent dropdown issues */
    /* background: var(--bg-secondary); */
/*}

/* Form Container Styles */
.form-container {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 24px;
}

.form-header {
    margin-bottom: 20px;
}

.form-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

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

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

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

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

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

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

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

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

html[dir="rtl"] body {
    direction: rtl;
    text-align: right;
}
body.rtl {
    direction: rtl;
    text-align: right;
}
html[dir="rtl"] .nav-menu .nav-link {
    text-align: right;
}
body.rtl .nav-menu .nav-link {
    text-align: right;
}
html[dir="rtl"] .form-header,
html[dir="rtl"] .card-header {
    flex-direction: row-reverse;
}
body.rtl .form-header,
body.rtl .card-header {
    flex-direction: row-reverse;
}
html[dir="rtl"] .section-title i {
    margin-left: 10px;
    margin-right: 0;
}
body.rtl .section-title i {
    margin-left: 10px;
    margin-right: 0;
}
html[dir="rtl"] .sidebar-toggle {
    float: left;
}
body.rtl .sidebar-toggle {
    float: left;
}
/* RTL layout adjustments */
html[dir="rtl"] .dashboard-container {
    flex-direction: row !important;
}
html[dir="rtl"] .dashboard-container > .main-content { order: 0 !important; }
html[dir="rtl"] .dashboard-container > .sidebar { order: 0 !important; margin-left: 0 !important; }
html[dir="rtl"] .sidebar {
    left: 0;
    right: auto;
    border-right: 1px solid rgba(255, 255, 255, 0.3);
    border-left: none;
    margin-left: 0 !important;
}
html[dir="rtl"] .main-content {
    margin-left: 0 !important;
    margin-right: 0;
    direction: rtl;
    padding-top: 0;
}
body.rtl .dashboard-container {
    flex-direction: row !important;
}
body.rtl .dashboard-container > .main-content { order: 0 !important; }
body.rtl .dashboard-container > .sidebar { order: 0 !important; margin-left: 0 !important; }
body.rtl .sidebar {
    left: 0;
    right: auto;
    border-right: 1px solid rgba(255, 255, 255, 0.3);
    border-left: none;
    margin-left: 0 !important;
}
body.rtl .main-content {
    margin-left: 0 !important;
    margin-right: 0;
    direction: rtl;
    padding-top: 0;
}
/* Prevent blank left strip on RTL desktop by disabling horizontal overflow
   while keeping vertical scrollbar on the left */
html[dir="rtl"]:not(.device-mobile) .main-content {
    overflow-x: hidden !important;
}
html[dir="rtl"] .main-content .header {
    direction: ltr;
    flex-direction: row;
}
body.rtl .main-content .header {
    direction: ltr;
    flex-direction: row;
}
html[dir="rtl"] .search-input {
    text-align: right;
}
body.rtl .search-input {
    text-align: right;
}
html[dir="rtl"] .main-content .header .header-actions {
    order: 1;
}
body.rtl .main-content .header .header-actions {
    order: 1;
}
html[dir="rtl"] .main-content .header .search-bar {
    order: 2;
}
body.rtl .main-content .header .search-bar {
    order: 2;
}
html[dir="rtl"] .sidebar.collapsed ~ .main-content {
    margin-left: 0;
    margin-right: 0;
}
body.rtl .sidebar.collapsed ~ .main-content {
    margin-left: 0;
    margin-right: 0;
}
html[dir="rtl"] .sidebar-toggle {
    right: auto;
    left: 20px;
}
body.rtl .sidebar-toggle {
    right: auto;
    left: 20px;
}
html[dir="rtl"] .sidebar-expand {
    left: auto;
    right: 20px;
}
body.rtl .sidebar-expand {
    left: auto;
    right: 20px;
}
html[dir="rtl"] .nav-link {
    border-left: 0;
    border-right: 4px solid #007bff;
}
body.rtl .nav-link {
    border-left: 0;
    border-right: 4px solid #007bff;
}
html[dir="rtl"] .nav-link.active {
    border-left-color: transparent;
    border-right-color: #ffc107;
    transform: translateX(-5px);
}
body.rtl .nav-link.active {
    border-left-color: transparent;
    border-right-color: #ffc107;
    transform: translateX(-5px);
}
/* Ensure text inside the content area remains RTL even when the scroll container is LTR */
html[dir="rtl"] .main-content .content,
html[dir="rtl"] .main-content .page {
    direction: rtl;
    text-align: right;
}
body.rtl .main-content .content,
body.rtl .main-content .page {
    direction: rtl;
    text-align: right;
}
html[dir="rtl"] .btn,
body.rtl .btn,
html[dir="rtl"] button,
body.rtl button,
html[dir="rtl"] .nav-link,
body.rtl .nav-link {
    line-height: 1.2;
}
html[dir="rtl"] .btn,
body.rtl .btn {
    white-space: nowrap;
}
.btn-danger:hover {
    background: #dc2626;
}

/* Quick Action Cards - Global Consistency Across Languages */
.quick-action-card {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}
.quick-action-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}
.quick-action-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: white;
    margin: 0 auto 12px;
}
.quick-action-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.quick-action-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
}
/* Ensure RTL does not alter the card layout/alignment */
html[dir="rtl"] .quick-action-card { text-align: center; }
html[dir="rtl"] .quick-action-card .quick-action-icon { margin: 0 auto 12px; }
html[dir="rtl"] .quick-action-card .quick-action-title,
html[dir="rtl"] .quick-action-card .quick-action-desc { text-align: center; }

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: scale(1);
}

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

.modal-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background: var(--bg-tertiary);
}

.modal-body {
    padding: 24px;
}

/* Toast Styles */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 10000;
    animation: slideInRight 0.3s ease-out;
}

.toast.success { border-left: 4px solid var(--success-color); }
.toast.error { border-left: 4px solid var(--error-color); }
.toast.info { border-left: 4px solid var(--info-color); }
.toast.warning { border-left: 4px solid var(--warning-color); }

/* Toggle Switch Styles */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--primary-color);
}

input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

/* Image Upload Styles */
.image-upload-container {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
    transition: border-color 0.3s ease;
}

.image-upload-container:hover {
    border-color: var(--primary-color);
}

.image-preview {
    max-width: 200px;
    max-height: 200px;
    border-radius: var(--border-radius);
    margin-top: 10px;
}

/* Utility Classes */
.hidden {
    display: none !important;
}
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }

.mobile-bottom-nav {
    display: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        transform: none;
    }
    .sidebar.collapsed {
        transform: none;
    }
    html[dir="rtl"] .sidebar {
        transform: none;
    }
    html[dir="rtl"] .sidebar.collapsed {
        transform: none;
    }
    .main-content {
        margin-left: 0;
    }
    
    html[dir="rtl"] .main-content {
        margin-right: 0;
    }
    
    .sidebar.collapsed ~ .main-content {
        margin-left: 0;
    }
    
    html[dir="rtl"] .sidebar.collapsed ~ .main-content {
        margin-right: 0;
    }
    
    .sidebar-expand {
        display: inline-flex;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .content {
        padding: 15px;
    }
}

/* Total Row Styles */
.table-total-row {
    background-color: var(--bg-tertiary);
    font-weight: bold;
    border-top: 2px solid var(--primary-color);
}

.table-total-row td {
    padding: 12px 8px;
    font-size: 1.1em;
}

.table-total-row strong {
    color: var(--primary-color);
}

/* Print Styles */
@media print {
    body * {
        visibility: hidden;
    }
    
    .print-content, .print-content * {
        visibility: visible;
    }
    
    .print-content {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
    
    .no-print {
        display: none !important;
    }
    
    .print-header {
        text-align: center;
        margin-bottom: 30px;
        border-bottom: 2px solid #000;
        padding-bottom: 20px;
    }
    
    .print-header h2 {
        margin: 0;
        font-size: 24px;
    }
    
    .print-header p {
        margin: 5px 0;
        font-size: 14px;
    }
    
    .print-table {
        width: 100%;
        border-collapse: collapse;
    }
    
    .print-table th,
    .print-table td {
        border: 1px solid #000;
        padding: 8px;
        text-align: left;
    }
    
    .print-table th {
        background-color: #f5f5f5;
        font-weight: bold;
    }
    
    .print-total-row {
        background-color: #e9ecef;
        font-weight: bold;
    }
}

/* Print Preview Modal */
.print-preview-modal {
    max-width: 95vw;
    max-height: 95vh;
}

.print-preview-content {
    max-height: 80vh;
    overflow-y: auto;
    padding: 20px;
    background: white;
}

.print-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.print-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

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

.print-btn.secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.print-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* Action Dropdown Styles */
.action-dropdown {
    position: relative;
    display: inline-block;
    z-index: 10000;
}

.table td:last-child {
    position: relative;
    z-index: auto;
}

.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-secondary);
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.action-btn:hover {
    background: var(--bg-tertiary);
    color: var(--primary-color);
    transform: scale(1.1);
}

/* Dotted Action Dropdown Button */
.action-dropdown-dotted {
    position: relative;
    display: inline-block;
}

.action-btn-dotted {
    background: transparent;
    border: 2px dotted var(--primary-color);
    color: var(--primary-color);
    padding: 6px 8px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn-dotted:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

.action-menu-dotted {
    position: absolute;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    min-width: 160px;
    z-index: 9999; /* Highest z-index to appear above everything */
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.2s ease;
    padding: 4px 0;
}

.action-menu-dotted.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.action-menu-dotted.action-menu-top {
    bottom: 100%;
    top: auto;
    transform: translateY(-10px);
}

.action-menu-dotted.action-menu-top.show {
    transform: translateY(0);
}

.action-item-dotted {
    display: block;
    width: 100%;
    padding: 10px 16px;
    text-align: left;
    border: none;
    background: none;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    text-decoration: none;
}

.action-item-dotted:hover { background: var(--bg-secondary); color: var(--primary-color); }

.action-item-dotted.text-warning:hover { background: #fff3cd; color: #856404; }

.action-item-dotted.text-danger:hover { background: #f8d7da; color: #721c24; }

.action-item-dotted i {
    margin-right: 8px;
    width: 16px;
    text-align: center;
}

.action-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    z-index: 10000;
    display: none;
    animation: slideUp 0.2s ease-out;
    overflow: visible !important;
    max-height: none !important;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.action-menu.show {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: translateY(0) !important;
    clip: auto !important;
    clip-path: none !important;
}

.action-item {
    display: flex !important;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    color: #333 !important;
    background-color: white !important;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    width: 100%;
    text-align: left;
    font-size: 0.9rem;
    visibility: visible !important;
    opacity: 1 !important;
    line-height: 1.4;
    min-height: 40px;
}

.action-item:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
}

.action-item.text-warning:hover {
    color: var(--warning-color);
}

.action-item.text-danger:hover {
    color: var(--error-color);
}

.action-item.text-info:hover {
    color: var(--info-color);
}

.action-item.text-success:hover {
    color: var(--success-color);
}

.action-item i {
    width: 16px;
    text-align: center;
}

/* Timetable Card Styles */
.timetable-card {
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.timetable-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.timetable-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.timetable-card-header h5 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.timetable-actions {
    display: flex;
    gap: 10px;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 32px;
}

.action-btn:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.action-btn:nth-child(1):hover {
    background: #e0f2fe;
    color: #0369a1;
    border-color: #0369a1;
}

.action-btn:nth-child(2):hover {
    background: #f0f9ff;
    color: #0c4a6e;
    border-color: #0c4a6e;
}

.action-btn:nth-child(3):hover {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #b91c1c;
}

.timetable-info {
    font-size: 0.8rem;
    color: var(--text-light);
}

.timetable-info small {
    font-size: inherit;
    color: inherit;
}

/* Global button text visibility overrides */
button,
.btn,
.btn * {
    color: var(--text-primary) !important;
}

.btn-primary,
.btn-success,
.btn-warning,
.btn-danger {
    color: #ffffff !important;
}

.nav-link:hover {
    background: linear-gradient(90deg, rgba(0, 123, 255, 0.7) 0%, rgba(0, 86, 179, 0.8) 100%) !important;
    color: #ffffff !important;
    border-left-color: #007bff !important;
    transform: translateX(8px) scale(1.02) !important;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.9) !important;
    box-shadow: 0 8px 25px rgba(0, 123, 255, 0.4), inset 0 0 30px rgba(0, 123, 255, 0.3) !important;
    border: 1px solid rgba(0, 123, 255, 0.5) !important;
}
.nav-link:hover::before { content: none !important; }

html.device-mobile .nav-item {
    margin-bottom: 6px !important;
    padding: 0 10px !important;
}

html.device-mobile .nav-link {
    background: linear-gradient(90deg, rgba(0, 123, 255, 0.65) 0%, rgba(0, 86, 179, 0.75) 100%) !important;
    box-shadow: none !important;
    text-shadow: none !important;
    transform: none !important;
    border: 1px solid rgba(0, 123, 255, 0.35) !important;
    border-left: 3px solid rgba(0, 123, 255, 0.8) !important;
    margin: 0 !important;
    padding: 8px 12px !important;
    border-radius: 10px !important;
}

html.device-mobile .nav-link.active {
    background: rgba(255, 193, 7, 0.12) !important;
    box-shadow: none !important;
    text-shadow: none !important;
    transform: none !important;
    border: 1px solid rgba(255, 193, 7, 0.32) !important;
    border-left: 3px solid rgba(255, 193, 7, 0.95) !important;
    border-radius: 10px !important;
    color: rgba(255, 255, 255, 0.98) !important;
}

@media (hover: hover) and (pointer: fine) {
    html.device-mobile .nav-link:hover {
        background: linear-gradient(90deg, rgba(0, 123, 255, 0.72) 0%, rgba(0, 86, 179, 0.82) 100%) !important;
        border-color: rgba(0, 123, 255, 0.45) !important;
    }
    html.device-mobile .nav-link:hover::before { content: none !important; }
}

@media (hover: none), (pointer: coarse) {
    html.device-mobile .nav-link:hover {
        background: transparent !important;
    }
    html.device-mobile .nav-link:hover::before { content: none !important; }
}

html.device-mobile .nav-link:active {
    background: rgba(255, 255, 255, 0.16) !important;
    border-color: rgba(255, 255, 255, 0.32) !important;
}

.login-btn:hover,
.btn-primary:hover {
    transform: none !important;
    box-shadow: none !important;
}
.login-btn:hover::before,
.btn-primary:hover::before {
    content: none !important;
}

.btn-outline-secondary:hover {
    background: var(--bg-primary) !important;
    border-color: var(--border-color) !important;
    transform: none !important;
}
.btn-outline-secondary:hover i { transform: none !important; }

.btn-secondary:hover {
    background: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
    transform: none !important;
}
.btn-success:hover {
    background: var(--success-color) !important;
    color: #ffffff !important;
    transform: none !important;
}
.btn-warning:hover {
    background: var(--warning-color) !important;
    color: #ffffff !important;
    transform: none !important;
}
.btn-danger:hover {
    background: var(--error-color) !important;
    color: #ffffff !important;
    transform: none !important;
}

.btn-search:hover {
    transform: translateY(-50%) !important;
    box-shadow: none !important;
}
.btn-generate:hover,
.btn-password:hover {
    transform: none !important;
    box-shadow: none !important;
}
.btn-submit:hover,
.btn-cancel:hover,
.btn-reset:hover {
    transform: none !important;
    box-shadow: none !important;
}

.profile-image-wrapper:hover { transform: none !important; }
.profile-image-wrapper:hover .profile-overlay { opacity: 0 !important; }
.profile-upload-btn:hover { transform: none !important; }

.image-upload-container:hover {
    border-color: var(--border-color) !important;
}
.permission-item:hover {
    border-color: #dee2e6 !important;
    transform: none !important;
    box-shadow: none !important;
}
.salary-option:hover {
    border-color: #e9ecef !important;
    transform: none !important;
    box-shadow: none !important;
}

.card:hover,
.stat-card:hover {
    box-shadow: var(--shadow) !important;
}
.timetable-card:hover {
    transform: none !important;
    box-shadow: var(--shadow) !important;
}

.action-btn:hover {
    background: none !important;
    color: var(--text-secondary) !important;
    transform: none !important;
    border-color: var(--border-color) !important;
}
.action-btn:nth-child(1):hover,
.action-btn:nth-child(2):hover,
.action-btn:nth-child(3):hover {
    background: var(--bg-primary) !important;
    color: var(--text-secondary) !important;
    border-color: var(--border-color) !important;
}
.action-btn-dotted:hover {
    background: transparent !important;
    color: var(--primary-color) !important;
    transform: none !important;
}
.action-item:hover {
    background: #ffffff !important;
    color: #333 !important;
}
.action-item-dotted:hover {
    background: none !important;
    color: var(--text-color) !important;
}
.action-item-dotted.text-warning:hover {
    background: none !important;
    color: var(--text-color) !important;
}
.action-item-dotted.text-danger:hover {
    background: none !important;
    color: var(--text-color) !important;
}

.modal-close:hover { background: none !important; }

.console-btn:hover { background-color: #555 !important; }
.console-btn.clear:hover { background-color: #e74c3c !important; }
.console-btn.hide:hover { background-color: #3498db !important; }
.console-output::-webkit-scrollbar-thumb:hover { background: #555 !important; }

.modern-table tr:hover td { background: var(--bg-primary) !important; }
.sidebar nav a:hover { background-color: transparent !important; }
.main-header .menu-toggle:hover { background: transparent !important; }
.ms-hidden-native{display:none}
.ms-dropdown{position:relative;width:100%}
.ms-button{position:relative;text-align:left;cursor:pointer;padding-right:34px}
.ms-button::after{content:"▼";position:absolute;right:12px;top:50%;transform:translateY(-50%);font-size:.8em;color:#6b7280;pointer-events:none}
.ms-menu{display:none;position:absolute;left:0;top:calc(100% + 4px);width:100%;background:#fff;border:1px solid var(--border-color);border-radius:8px;box-shadow:var(--shadow);max-height:240px;overflow:auto;z-index:1000}
.ms-dropdown.open .ms-menu{display:block}
.ms-option{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;column-gap:6px;padding:8px 10px;width:100%;color:#000}
.ms-option:hover{background:var(--bg-tertiary)}
.form-group .ms-option{display:grid !important;grid-template-columns:minmax(0,1fr) auto !important;align-items:center !important;column-gap:6px !important;padding:8px 10px !important;margin:0 !important;text-transform:none !important}
.form-group label.ms-option::before{content:none !important;display:none !important}
.ms-option input[type="checkbox"]{margin:0;flex:0 0 auto}
.ms-option span{white-space:normal;overflow:visible;text-overflow:clip;text-align:left;display:inline-block;grid-column:1;color:#000}
.ms-option input[type="checkbox"]{grid-column:2;margin:0}
.ms-dropdown.ms-ltr .ms-menu{left:0;right:auto;text-align:left}
.ms-dropdown.ms-rtl .ms-menu{right:0;left:auto;text-align:right}
.ms-dropdown.ms-ltr .ms-option span{text-align:left;grid-column:1}
.ms-dropdown.ms-ltr .ms-option input[type="checkbox"]{grid-column:2}
.ms-dropdown.ms-rtl .ms-option span{text-align:right;grid-column:2}
.ms-dropdown.ms-rtl .ms-option input[type="checkbox"]{grid-column:1}

.form-group,
.modern-form-group,
.filter-container,
.filter-item {
    border: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
}

.filter-container label,
.filter-section label,
.filter-row label,
.filter-item label,
.marks-table-controls label,
#releaseControls > .form-group > label,
#previewFilters > div > .form-group > label,
[id*="filter" i] label,
[class*="filter" i] label {
    display: none !important;
}

#releaseControls {
    align-items: center !important;
}

#releaseControls > .form-group {
    padding: 0 !important;
}

#releaseControls > #releaseOkBtn {
    min-height: var(--control-height);
    height: var(--control-height);
}
