/* C:\xampp\htdocs\sinav\assets\css\style.css */
:root {
    --bg-color: #0c0e12;
    --surface-color: #171923;
    --primary-color: #6366f1;
    /* Indigo / Professional Blue */
    --primary-variant: #4f46e5;
    --secondary-color: #818cf8;
    --error-color: #ef4444;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: #2d3748;
    --font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Suppress browser autofill highlight globally */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text-primary);
    -webkit-box-shadow: 0 0 0px 1000px var(--surface-color) inset;
    box-shadow: 0 0 0px 1000px var(--surface-color) inset;
    transition: background-color 5000s ease-in-out 0s;
}


body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-family);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    margin-bottom: 1rem;
    font-weight: 600;
}

p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--secondary-color);
}

/* Layout */
.container {
    width: 98%;
    max-width: 1920px;
    margin: 0 auto;
    padding: 2rem 0;
}

/* Header */
.header {
    background-color: var(--surface-color);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.header .logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.header nav ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
}

/* Cards & Surfaces */
.card {
    background-color: var(--surface-color);
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    margin-bottom: 2rem;
}

/* Stat Cards */
.card-stat {
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.card-stat:hover {
    transform: translateY(-5px);
}

.stat-blue {
    border-color: #6366f1;
    background-color: rgba(99, 102, 241, 0.05);
}

.stat-blue h3 {
    color: #818cf8;
}

.stat-blue .stat-value {
    color: #6366f1;
}

.stat-green {
    border-color: #22c55e;
    background-color: rgba(34, 197, 94, 0.05);
}

.stat-green h3 {
    color: #4ade80;
}

.stat-green .stat-value {
    color: #22c55e;
}

.stat-red {
    border-color: #ef4444;
    background-color: rgba(239, 68, 68, 0.05);
}

.stat-red h3 {
    color: #ef4444;
}

.stat-red .stat-value {
    color: #ef4444;
}

.stat-yellow {
    border-color: #f59e0b;
    background-color: rgba(245, 158, 11, 0.05);
}

.stat-yellow h3 {
    color: #fbbf24;
}

.stat-yellow .stat-value {
    color: #f59e0b;
}

/* Remove Number Input Spinners */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    -webkit-appearance: textfield;
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Custom Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block !important;
    /* Ensure it overrides .form-group label */
    width: 44px !important;
    height: 22px !important;
    flex-shrink: 0;
    margin-bottom: 0 !important;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
    cursor: pointer;
    z-index: 1;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: .4s;
    border-radius: 22px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-primary);
    transition: .4s;
    border-radius: 50%;
}

.toggle-switch input:checked+.slider {
    background-color: var(--primary-color);
}

.toggle-switch input:checked+.slider:before {
    transform: translateX(22px);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.search-wrapper {
    position: relative;
    width: 100%;
}

.search-wrapper i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
    z-index: 5;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.8rem;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 4px;
    /* Matches .form-control */
    font-size: 1rem;
    /* Matches .form-control */
    transition: border-color 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1.2rem center;
    padding-right: 3rem;
    cursor: pointer;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Modal Buttons Container */
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: var(--primary-color);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--primary-variant);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: var(--text-secondary);
    color: var(--primary-color);
}

.btn-success {
    background-color: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.btn-success:hover {
    background-color: #22c55e;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.btn-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background-color: var(--error-color);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

table th,
table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

table th {
    background-color: rgba(255, 255, 255, 0.05);
    font-weight: 600;
}

table tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: rgba(99, 102, 241, 0.1);
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
}

.alert-error {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error-color);
    color: var(--error-color);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 4px;
}

.badge-success {
    background-color: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.badge-error {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--error-color);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Utilities */
.text-center {
    text-align: center;
}

.mt-1 {
    margin-top: 1rem;
}

.mt-2 {
    margin-top: 2rem;
}

.mb-1 {
    margin-bottom: 1rem;
}

.mb-2 {
    margin-bottom: 2rem;
}

.flex {
    display: flex;
}

.justify-between {
    justify-content: space-between;
}

.align-center {
    align-items: center;
}

/* Dashboard layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 1.5rem;
}

.sidebar {
    background-color: var(--surface-color);
    padding: 1.5rem;
    border-radius: 8px;
    height: calc(100vh - 120px);
    position: sticky;
    top: 100px;
}

.sidebar ul.nav {
    list-style: none;
}

.sidebar ul.nav li {
    margin-bottom: 1rem;
}

.sidebar ul.nav li a {
    color: var(--text-secondary);
    display: block;
    padding: 0.5rem;
    border-radius: 4px;
}

.sidebar ul.nav li a:hover,
.sidebar ul.nav li a.active {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--primary-color);
}

/* Modals */
.modal-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 95%;
    /* Increased slightly for better fit */
    max-width: 600px;
    background-color: var(--surface-color);
    padding: 0;
    /* Remove internal padding */
    border-radius: 12px;
    z-index: 1001;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    opacity: 0;
    overflow: hidden;
    /* Keep it contained */
}

.modal.active {
    display: flex;
    flex-direction: column;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    max-height: 95vh;
    height: auto;
}

/* Ensure form takes full height of modal flex */
.modal>form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.modal-body {
    overflow-y: auto !important;
    max-height: 60vh;
    /* Fixed height constraint for form container */
    padding: 1.5rem 2.5rem;
    flex: 1;
    min-height: 0;
}

/* Modal Custom Scrollbar */
.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* SortableJS Styles */
.sortable-ghost {
    opacity: 0.4;
    background-color: var(--primary-color) !important;
}

.drag-handle:hover {
    color: var(--primary-color) !important;
}

.drag-handle:active {
    cursor: grabbing !important;
}

tr.sortable-chosen {
    background-color: rgba(187, 134, 252, 0.05);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 2.5rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.modal-header h3 {
    margin-bottom: 0 !important;
    color: var(--primary-color);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s;
}

.modal-close:hover {
    color: var(--error-color);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem 2.5rem 2rem;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

/* Professional File Upload */
.file-upload-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.file-upload-input {
    position: absolute;
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    z-index: -1;
}

.file-upload-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px dashed var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    white-space: nowrap;
}

.file-upload-label:hover {
    border-color: var(--primary-color);
    background-color: rgba(187, 134, 252, 0.05);
    color: var(--primary-color);
}

.file-upload-label i {
    font-size: 1.1rem;
}

.preview-thumbnail {
    width: 50px;
    height: 50px;
    border-radius: 4px;
    object-fit: cover;
    border: 1px solid var(--border-color);
}

.mb-1 {
    margin-bottom: 1rem !important;
}

.mt-1 {
    margin-top: 1rem !important;
}

.mt-2 {
    margin-top: 2rem !important;
}

.swal2-popup {
    background: var(--surface-color) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 12px !important;
}

.swal2-title,
.swal2-html-container {
    color: var(--text-primary) !important;
}

.swal2-confirm {
    background-color: var(--primary-color) !important;
    color: var(--bg-color) !important;
}

.swal2-cancel {
    background-color: transparent !important;
    color: var(--text-secondary) !important;
    border: 1px solid var(--border-color) !important;
}

/* Remaining Points Logic */
.remaining-points-badge {
    position: sticky;
    top: 20px;
    background-color: var(--surface-color);
    border: 1px solid var(--primary-color);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.points-number {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--secondary-color);
}

/* Logo Styling */
.logo-img {
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    object-fit: contain;
    background-color: transparent;
}

.logo-img-lg {
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    object-fit: contain;
    background-color: transparent;
}

/* Professional File Upload */
.custom-file-upload {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: rgba(255, 255, 255, 0.02);
}

.custom-file-upload:hover {
    border-color: var(--primary-color);
    background-color: rgba(99, 102, 241, 0.05);
}

.custom-file-upload i {
    font-size: 2.5rem;
    color: var(--primary-color);
    display: block;
    margin-bottom: 1rem;
}

.custom-file-upload p {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.custom-file-upload span {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.custom-file-upload input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-name-preview {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: var(--secondary-color);
    font-weight: 500;
}

/* Select2 Premium Dark Theme Overrides */
.select2-container--default .select2-selection--single {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    height: 46px;
    /* Optimized height */
    display: flex;
    align-items: center;
    background-color: var(--bg-color) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 4px !important;
    height: 42px !important;
    /* Matches .form-control exactly */
    display: flex !important;
    align-items: center !important;
    transition: all 0.3s ease !important;
}

.select2-container--default.select2-container--focus .select2-selection--single {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2) !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--text-primary) !important;
    padding-left: 1rem !important;
    line-height: 40px !important;
    font-size: 1rem !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 40px !important;
    right: 8px !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: var(--text-secondary) transparent transparent transparent !important;
}

.select2-dropdown {
    background-color: var(--surface-color) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 4px !important;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5) !important;
    z-index: 9999 !important;
}

.select2-container--default .select2-search--dropdown {
    padding: 8px !important;
    background-color: var(--surface-color) !important;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    background-color: var(--bg-color) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    border-radius: 4px !important;
    padding: 6px 10px !important;
}

.select2-container--default .select2-results__option {
    padding: 8px 12px !important;
    color: var(--text-primary) !important;
    background-color: transparent !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected],
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    background-color: var(--primary-color) !important;
    color: white !important;
}

.select2-container--default .select2-results__option[aria-selected=true] {
    background-color: var(--border-color) !important;
    color: var(--primary-color) !important;
}

/* Custom Scrollbar for Select2 */
.select2-results__options::-webkit-scrollbar {
    width: 6px !important;
}

.select2-results__options::-webkit-scrollbar-track {
    background: transparent !important;
}

.select2-results__options::-webkit-scrollbar-thumb {
    background: var(--border-color) !important;
    border-radius: 10px !important;
}

/* Modal Grid Layout */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* Premium Circular Progress Overlay */
.progress-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--surface-color);
    display: none !important;
    /* Force hidden by default */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    /* Above modal content */
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
}

.progress-overlay.active-overlay {
    display: flex !important;
}

.circular-progress {
    position: relative;
    width: 154px;
    height: 154px;
    border-radius: 50%;
    background: conic-gradient(var(--primary-color) 0deg, var(--border-color) 0deg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 25px rgba(99, 102, 241, 0.2);
    margin: 0 auto;
}

.circular-progress::before {
    content: "";
    position: absolute;
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background-color: var(--surface-color);
}

.progress-value {
    position: relative;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
}

.progress-status {
    margin-top: 2rem;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
}

#import-results {
    margin-top: 1.5rem;
    font-size: 0.85rem;
    max-height: 120px;
    overflow-y: auto;
    width: 100%;
    padding: 0 1rem;
    border-radius: 4px;
}

.import-success {
    color: var(--success-color);
    font-weight: 600;
}

.import-error {
    color: var(--error-color);
    margin-bottom: 0.4rem;
    padding: 4px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 4px;
}

/* File Upload & Template Buttons Row */
.import-actions-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    margin-top: 1rem;
}

.import-actions-row>div {
    flex: 1;
}

.hidden {
    display: none !important;
}

/* Exam Filter Select2 Specific Styling */
.select2-exam-filter + .select2-container {
    min-width: 200px;
    width: auto !important;
}
