:root {
    /* Base colors */
    --dark-bg: #13111C;
    --dark-surface: #1E1B2C;
    --dark-surface-lighter: #2D2A3C;
    --accent-color: #9D4EDD;
    --accent-lighter: #B77DE9;
    --accent-darker: #7B3BAF;
    
    /* Text colors */
    --text-primary: #ffffff;
    --text-secondary: #B8B5C6;
    
    /* Status colors */
    --danger: #E84855;
    --success: #4caf50;
    --warning: #FFB86C;
    --info: #7B61FF;
    
    /* Surface variations */
    --surface-1: var(--dark-surface);
    --surface-2: var(--dark-surface-lighter);
    --surface-3: #3D3A4C;  /* Even lighter surface */
    
    /* Border colors */
    --border-color: rgba(255, 255, 255, 0.1);
    --border-color-hover: rgba(255, 255, 255, 0.2);
    
    /* Shadow colors */
    --shadow-color: rgba(0, 0, 0, 0.2);
    --shadow-color-hover: rgba(157, 78, 221, 0.15);
    
    /* Add these new CSS variables for opacity versions */
    --accent-color-alpha: rgba(157, 78, 221, 0.25);
    --success-alpha: rgba(76, 175, 80, 0.2);
    --danger-alpha: rgba(232, 72, 85, 0.2);
    --warning-alpha: rgba(255, 184, 108, 0.2);
    --info-alpha: rgba(123, 97, 255, 0.2);
}
header{
    background-color: var(--dark-bg);
    color: var(--text-primary);
    z-index: 0;
}
body{
    background-color: var(--dark-bg);
    color: var(--text-primary);
}
.bg-dark{
    background-color: var(--dark-bg) !important;
}
textarea {
    /* fit to size of content */
    min-height: 100px !important;
}

.hr-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hr-container hr {
    flex-grow: 1;
    border: none;
    height: 2px;
    background: #aaa;
}

.hr-container span {
    font-size: 20px;
    color: #555;
}

small {
    color: #b0b0b0;
}

.text-muted {
    color: #b0b0b0 !important;
}

.card-body {
    color: #FFF !important;
}

iframe {
    width: 100%;
    height: 100%;
    background-color: #FFF;
}

#logga {
    width: 50px;
    height: 50px;
    border-radius: 10px;
}

.dark-theme {
    background-color: var(--dark-bg);
    color: var(--text-primary);
}

/* General styles */
body, p, h1, h2, h3, h4, h5, h6, label, strong, div, a, .card-title {
    font-family: 'Roboto', sans-serif; /* Use Roboto font */
    color: var(--text-primary); /* Ensure all body, p, and h* elements are white */
}

.container {
    margin-top: 50px;
}

/* Full screen container styles */
.container.mt-5 {
    min-height: calc(100vh - 76px - 3rem);
    margin-top: 3rem !important;
    display: flex;
    flex-direction: column;
}

/* Full width container styles */
.container-fluid.mt-5 {
    padding: 0 2rem;
    min-height: calc(100vh - 76px - 3rem);
    margin-top: 3rem !important;
    display: flex;
    flex-direction: column;
}

.container-fluid.mt-5 .card {
    margin-bottom: 2rem;
}

/* Adjust child elements to fill height if needed */
.container.mt-5 > .row {
    flex: 1;
}

.card {
    box-shadow: 0 4px 8px var(--shadow-color);
    background-color: var(--dark-surface);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    transition: transform 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--shadow-color-hover);
}

.card-header {
    background-color: var(--dark-surface-lighter);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    color: var(--text-primary);
}

/* Tab navigation styling */
.card .card-header {
    /*background: transparent !important;*/
    color:#13111C !important;
    border-bottom: none;
}

.card .card-header .nav-tabs {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: var(--dark-surface-lighter);
    border-top-left-radius: 0.75rem;
    border-top-right-radius: 0.75rem;
}

.nav-tabs.card-header-tabs {
    padding: 0.5rem 1rem 0;
    margin: 0;
    border-bottom: none;
    display: flex;
    gap: 1rem;
    background: transparent;
}

.nav-tabs .nav-link {
    color: var(--text-primary);
    padding: 0.75rem 1.5rem;
    margin: 0;
    border: none;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    font-weight: 500;
    background: transparent;
}

.nav-tabs .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.nav-tabs .nav-link.active {
    color: var(--text-primary);
    background-color: var(--dark-surface);
    border: none;
    position: relative;
}

.nav-tabs .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--accent-color);
}

.tab-content {
    padding-top: 1rem;
    background: transparent;
}

.tab-pane {
    transition: all 0.3s ease;
}

/* Ensure consistent card styling within tabs */
.tab-pane .card {
    margin-bottom: 1rem;
}

.tab-pane .card-header {
    border-radius: 0.5rem 0.5rem 0 0;
}

.nav-tabs .nav-link {
    margin-bottom: -1px;
    border: none;
    color: var(--text-secondary);
}

.nav-tabs .nav-link:hover {
    border: none;
    color: var(--text-primary);
}

.nav-tabs .nav-link.active {
    background-color: transparent;
    border: none;
    border-bottom: 2px solid var(--accent-color);
    color: var(--text-primary);
}

/* Test name link styling */
.card-header a {
    color: var(--text-primary) !important;
    text-decoration: none;
}

.card-header a:hover {
    color: var(--text-primary) !important;
    text-decoration: none;
}

.btn-primary, .btn-secondary, .btn-success, .btn-danger, .btn-warning, .btn-info {
    margin-right: 10px;
}

.btn {
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background-color: var(--accent-color);
    border: none;
}

.btn-primary:hover {
    background-color: var(--accent-lighter);
    transform: translateY(-1px);
}

.table {
    margin-top: 20px;
    background-color: var(--dark-bg); /* Changed to black */
    color: var(--text-primary);
    border-radius: 0.75rem;
    overflow: hidden;
    table-layout: fixed;
}

.table th, .table td {
    vertical-align: middle;
    border: 1px solid var(--border-color);
}

.table th {
    background-color: var(--dark-surface); /* Changed to dark gray */
    border-bottom: 2px solid var(--border-color);
    color: var(--text-secondary);
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: var(--dark-surface-lighter); /* Slightly lighter gray for striped rows */
}

.table-striped tbody tr:nth-of-type(even) {
    background-color: var(--dark-bg); /* Black for even rows */
}

/* Ensure table-dark class is consistent with the new styles */
.table-dark {
    background-color: var(--dark-bg); /* Black background */
}

.table-dark th, .table-dark td {
    border-color: var(--border-color);
}

.table-dark thead th {
    background-color: var(--dark-surface); /* Dark gray for headers */
    color: var(--text-secondary);
}

/* Override Bootstrap table styles */
.table, 
.table tbody,
.table tr,
.table td,
.table th {
    background-color: var(--dark-surface) !important;
    color: var(--text-primary) !important;
}

.table thead th {
    background-color: var(--dark-surface-lighter) !important;
    color: var(--text-secondary) !important;
    border-bottom-color: var(--border-color) !important;
}

.table-striped > tbody > tr:nth-of-type(odd) {
    background-color: var(--dark-surface-lighter) !important;
}

.table-striped > tbody > tr:nth-of-type(even) {
    background-color: var(--dark-surface) !important;
}

.table td, 
.table th {
    border-color: var(--border-color) !important;
}

/* Make sure the table retains dark mode in all contexts */
.card .table,
.modal .table,
.tab-content .table {
    background-color: var(--dark-surface) !important;
    color: var(--text-primary) !important;
}

.alert {
    margin-top: 20px;
    background-color: var(--dark-surface);  /* Changed from #495057 */
    color: #f8f9fa;
    border: none;
    border-radius: 0.75rem;
    padding: 1rem;
}

.alert-success {
    background-color: var(--success-alpha);
    color: var(--success);
}

.alert-danger {
    background-color: var(--danger-alpha);
    color: var(--danger);
}

.alert-warning {
    background-color: var(--warning-alpha);
    color: var(--warning);
}

.alert-info {
    background-color: var(--info-alpha);
    color: var(--info);
}

/* Specific styles for different pages */
#answersContainer .mb-3 {
    margin-bottom: 15px;
}

#answersContainer .form-check {
    margin-top: 10px;
}

.list-group-item {
    padding: 20px;
    border: 1px solid #dee2e6;
    background-color: var(--dark-surface);  /* Changed from #495057 */
    color: #f8f9fa;
}

.mt-2 {
    margin-top: 10px;
}

.mt-5 {
    margin-top: 50px;
}

.mb-3 {
    margin-bottom: 30px;
}

.ms-2 {
    margin-left: 20px;
}

.row {
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
}

.row > [class*='col-'] {
    display: flex;
    flex-direction: column;
}

/* Full height centered row */
.row.justify-content-center {
    min-height: 100%;
    flex: 1 1 auto;
    align-items: stretch;
}

.row.justify-content-center > [class*='col-'] {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.dark-mode {
    background-color: var(--dark-bg);
    color: var(--text-primary);
}

.dark-mode .card {
    background-color: var(--dark-surface);
}

.dark-mode .card-header {
    background-color: var(--dark-surface-lighter);
    color: var(--text-primary);
}

.dark-mode .table {
    background-color: var(--dark-surface);
}

.dark-mode .alert {
    background-color: var(--dark-surface);
}

.dark-mode .list-group-item {
    background-color: var(--dark-surface);
}

.points {
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
    font-weight: 600;
    display: inline-block;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: bold;
}

.nav-link {
    font-size: 1.1rem;
    margin-right: 15px;
}

.navbar-dark .navbar-nav .nav-link.active {
    color: #f8f9fa;
}

/* Enhanced Navbar Styling */
.navbar {
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px var(--shadow-color);
    background: linear-gradient(to right, var(--dark-bg), var(--dark-surface)) !important;
}

.navbar-brand {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(45deg, var(--accent-color), var(--info));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.nav-link {
    color: var(--text-secondary) !important;
    transition: all 0.3s ease;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem !important;
}

.nav-link:hover {
    color: var(--text-primary) !important;
    background-color: rgba(255, 255, 255, 0.1);
}

/* Teacher Dashboard Styling */
.teacher-dashboard {
    background-color: var(--dark-surface);
    border-radius: 10px;
    padding: 1.5rem;
    margin-top: 1rem;
    box-shadow: 0 4px 6px var(--shadow-color);
}

.teacher-dashboard h1 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--accent-color);
    padding-bottom: 0.5rem;
}

/* AI Model Selector Styling */
.ai-model-form {
    background-color: var(--dark-surface-lighter);
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.ai-model-form label {
    color: var(--text-primary);
    font-weight: 500;
    margin-right: 1rem;
}

.ai-model-form select {
    background-color: var(--dark-surface);
    color: var(--text-primary);
    border: 1px solid var(--accent-color);
    border-radius: 4px;
    padding: 0.5rem;
    margin-right: 1rem;
}

.ai-model-form button {
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
}

.ai-model-form button:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
}

/* Dashboard Buttons */
.dashboard-buttons .btn {
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
    padding: 0.6rem 1.2rem;
    transition: all 0.3s ease;
    margin-bottom: 0.5rem;
    margin-right: 0.5rem;
}

.dashboard-buttons .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow-color);
}

/* Badge Styling */
.badge {
    padding: 0.5rem 0.75rem;
    font-weight: 500;
    border-radius: 0.5rem;
}

/* Form Controls */
.form-control, .form-select {
    background-color: var(--dark-surface-lighter);
    border: 1px solid var(--border-color);
    color: var(--text-primary); /* Ensure input text is white */
}

.form-control::placeholder, .form-select::placeholder {
    color: var(--text-primary); /* Ensure placeholder text is white */
}

.form-control:focus, .form-select:focus {
    background-color: var(--dark-surface-lighter);
    border-color: var(--accent-color);
    color: var(--text-primary); /* Ensure focused input text is white */
    box-shadow: 0 0 0 2px var(--accent-color-alpha);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--dark-surface);
}

::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-lighter);
}

/* Animation for Loading States */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.loading {
    animation: pulse 2s infinite ease-in-out;
}

/* Improved readability for student answers and AI evaluations */
.student-answer, .ai-evaluation {
    background-color: #2d3748 !important;
    color: #e2e8f0 !important;
    font-size: 1.1rem;
    line-height: 1.6;
    border-radius: 0.5rem;
    border-color: var(--border-color) !important;
    min-height: 50px;
    height: auto;
    resize: none;
    overflow: hidden;
}

/* Table cell styling for teacher dashboard */
.table td.text-truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 0;
    cursor: help;
}

.table td.text-nowrap {
    white-space: nowrap;
    padding: 0.5rem;
}

.table td.text-nowrap .btn {
    margin: 0.25rem;
    white-space: nowrap;
}

/* Ensure buttons stay on one line */
.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    white-space: nowrap;
    display: inline-block;
}

/* Question cell styling for teacher dashboard */
.table td.question-cell {
    white-space: normal;
    word-wrap: break-word;
    max-width: 0;
    padding: 1rem;
    line-height: 1.4;
}

/* Adjust table cell widths for better readability */
.table td.question-cell {
    padding: 1.5rem;
    font-size: 1.1rem;
}

/* Status text styles */
.status-correct {
    color: #00b74a;
    font-weight: bold;
}

.status-incorrect {
    color: #f93154;
    font-weight: bold;
}

.status-pending {
    color: #ffa900;
    font-weight: bold;
}

.status-unanswered {
    color: #757575;
    font-style: italic;
}

/* Remove margin between buttons in input groups */
.input-group .btn {
    margin-right: 0;
}

/* Ensure buttons are directly adjacent */
.input-group .btn + .btn {
    margin-left: 0;
}

/* Separated tab navigation styling */
.container .card-header .nav-tabs {
    border-bottom: none;
    padding-bottom: 0;
}

.container .mb-4 {
    margin-bottom: 1rem !important;
}

.tab-content {
    background: transparent;
}

.tab-content > .tab-pane {
    padding-top: 0;
}

/* Modal styling fixes */
.modal {
    z-index: 1050 !important;
    background-color: rgba(0, 0, 0, 0.5);
    position: fixed !important;
    height: 100svh !important;
    width: 100% !important;
    top: 0;
    left: 0;
    
}

.modal.show {
    display: block !important;
}

.modal-backdrop {
    z-index: 1049 !important;
    display: none !important;
}

.modal-content {
    background-color: var(--dark-surface) !important;
    border: 1px solid var(--border-color);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.modal-header {
    border-bottom-color: var(--border-color);
}

.modal-footer {
    border-top-color: var(--border-color);
}

.modal-content .form-control {
    background-color: var(--dark-surface-lighter) !important;
    border: 1px solid var(--border-color);
    color: var(--text-primary) !important;
    z-index: 1052 !important;
}

.modal-content .form-control:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-color-alpha);
}

/* AI Models Tab Styling */
.ai-model-form {
    background-color: var(--dark-surface-lighter);
    padding: 1.5rem;
    border-radius: 0.75rem;
    margin-bottom: 2rem;
}

.ai-model-form .form-control {
    background-color: var(--dark-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.ai-model-form .btn {
    margin-left: 1rem;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    .container {
        padding: 0.5rem;
        margin-top: 1rem !important;
    }

    .card {
        margin-bottom: 1rem;
    }

    .card-header {
        padding: 0.75rem;
    }

    .navbar-brand {
        font-size: 1.2rem;
    }

    .mobile-logo {
        height: 40px !important;
        width: 40px !important;
    }

    .school-name {
        font-size: 1rem;
        margin-left: 0.5rem;
    }

    .table {
        display: block;
        width: 100%;
        overflow-x: auto;
    }

    .table td, .table th {
        min-width: 120px;
        white-space: normal;
        word-wrap: break-word;
    }

    .nav-tabs .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }

    .modal-dialog {
        margin: 0.5rem;
    }

    .btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }

    .table td:first-child,
    .table th:first-child {
        min-width: 200px;
    }

    /* Stacked form elements on mobile */
    .form-inline {
        flex-direction: column;
    }

    .form-inline .form-control,
    .form-inline .form-select {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    /* Adjust modal for mobile */
    .modal-fullscreen {
        padding: 0;
    }

    .modal-fullscreen .modal-dialog {
        margin: 0;
        width: 100%;
        max-width: none;
    }

    .modal-fullscreen .modal-content {
        border-radius: 0;
        min-height: 100vh;
    }

    /* Improve table responsiveness */
    .table-responsive {
        margin-bottom: 1rem;
        -webkit-overflow-scrolling: touch;
    }

    /* Stack badges vertically on mobile */
    .card-header .badge {
        display: block;
        margin-bottom: 0.3rem;
        text-align: left;
    }

    /* Adjust button groups for mobile */
    .btn-group {
        display: flex;
        flex-direction: column;
        width: 100%;
    }

    .btn-group .btn {
        margin-bottom: 0.3rem;
        border-radius: 0.25rem !important;
    }

    /* Improve form layout on mobile */
    .form-group {
        margin-bottom: 1rem;
    }

    /* Adjust navbar collapse */
    .navbar-collapse {
        background-color: var(--dark-surface);
        padding: 1rem;
        border-radius: 0.5rem;
        margin-top: 0.5rem;
    }

    .navbar-nav {
        width: 100%;
    }

    .nav-item {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .nav-link {
        padding: 0.5rem !important;
        text-align: left;
    }

    /* Improve select teacher form on mobile */
    .teacher-select-form {
        flex-direction: column;
        align-items: stretch;
    }

    .teacher-select-form select {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .mobile-header {
        font-size: 1.2rem;
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .mobile-form select.form-select-lg {
        font-size: 1rem;
        padding: 0.5rem;
        height: auto;
    }

    .mobile-table {
        font-size: 0.9rem;
    }

    .mobile-table th {
        white-space: normal;
        min-width: auto;
    }

    .mobile-table td {
        padding: 0.75rem 0.5rem;
    }

    .mobile-row {
        position: relative;
    }

    .mobile-row .badge {
        font-size: 0.8rem;
        padding: 0.3rem 0.5rem;
    }

    .table-responsive {
        border: none;
        margin-bottom: 0;
    }

    /* Improve card spacing on mobile */
    .card {
        border-radius: 0.5rem;
        margin-bottom: 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    /* Better button styling for mobile */
    .btn-lg {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }

    /* Improve form elements on mobile */
    .form-label {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }

    .form-select {
        font-size: 1rem;
        padding: 0.5rem;
    }

    /* Fix table header on mobile */
    .table thead th {
        position: sticky;
        top: 0;
        background: var(--dark-surface);
        z-index: 1;
    }

    /* Stack badges and icons more cleanly */
    .badge {
        display: inline-block;
        margin: 0.2rem 0;
    }

    /* Improve test detail cards */
    .question-header {
        flex-direction: column;
        gap: 0.5rem;
    }

    .answer-section {
        padding: 0.5rem 0;
    }

    /* Better spacing for evaluation sections */
    .evaluation-section {
        margin-top: 1rem;
        padding: 0.5rem;
    }

    /* Improve modal display on mobile */
    .modal-fullscreen-sm-down {
        padding: 0;
    }

    .modal-fullscreen-sm-down .modal-dialog {
        margin: 0;
        height: 100vh;
        max-width: none;
    }

    .modal-fullscreen-sm-down .modal-content {
        height: 100vh;
        border-radius: 0;
    }

    /* Server Info Mobile Optimizations */
    .container-fluid.px-2 {
        padding: 0.5rem !important;
    }

    /* Make cards more compact on mobile */
    .card {
        margin-bottom: 0.75rem;
    }

    .card-header {
        padding: 0.75rem !important;
    }

    /* Adjust accordion items for better touch targets */
    .accordion-button {
        padding: 1rem;
        min-height: 44px;
    }

    .accordion-body {
        padding: 0.75rem;
    }

    /* Improve list items readability */
    .list-group-item {
        padding: 0.75rem;
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
    }

    /* Make badges wrap properly */
    .list-group-item .badge {
        margin-left: 0.5rem;
        margin-top: 0.25rem;
    }

    /* Adjust charts for mobile view */
    .chart-container {
        height: 200px !important;
        margin-bottom: 1rem;
    }

    /* Make tables scrollable horizontally */
    .table-responsive {
        margin: 0;
        padding: 0;
    }

    .table td, .table th {
        min-width: 100px;
        white-space: normal;
        word-break: break-word;
    }

    /* Improve button groups on mobile */
    .btn-group {
        flex-direction: column;
        width: 100%;
    }

    .btn-group .btn {
        width: 100%;
        margin: 0.25rem 0;
        border-radius: 0.25rem !important;
    }

    /* Better nav pills for mobile */
    .nav-pills {
        gap: 0.5rem;
    }

    .nav-pills .nav-link {
        width: 100%;
        text-align: center;
        padding: 0.75rem;
    }

    /* Adjust modal for mobile view */
    .modal-dialog.modal-xl {
        margin: 0.5rem;
        max-width: none;
    }

    .modal-body {
        padding: 0.75rem;
    }

    /* Improve form controls on mobile */
    .input-group {
        flex-wrap: wrap;
    }

    .input-group > * {
        width: 100%;
        margin: 0.25rem 0;
        border-radius: 0.25rem !important;
    }

    /* Better spacing for statistics */
    .row.g-3 > * {
        padding: 0.5rem;
    }

    /* Improve table controls visibility */
    .table-controls {
        flex-direction: column;
        gap: 0.5rem;
    }

    .table-controls .col-auto {
        width: 100%;
    }

    /* Make search more usable on mobile */
    #searchColumn, #tableSearch {
        width: 100%;
        margin: 0.25rem 0;
    }

    /* Improve AI log display */
    .prompt-textarea {
        min-height: 60px;
        font-size: 0.875rem;
    }

    /* Better GPU temperature chart display */
    #gpuTempChart {
        height: 200px !important;
    }

    /* Improve installed models section */
    #installedModelsSection .table td {
        padding: 0.5rem;
    }

    #installedModelsSection .btn-group {
        display: flex;
        gap: 0.25rem;
    }

    /* Better model search interface */
    #model-search {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    /* Adjust spacing for model tables */
    #api-models-body td {
        padding: 0.5rem;
    }

    /* Make model actions more touch-friendly */
    .btn-sm {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }

    /* Improve loading indicators */
    .spinner-border {
        width: 1.5rem;
        height: 1.5rem;
    }

    /* Better scroll behavior */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }
}

/* Tablet optimizations */
@media (min-width: 769px) and (max-width: 1024px) {
    .container-fluid.px-md-4 {
        padding: 1rem !important;
    }

    .chart-container {
        height: 300px !important;
    }

    .btn-group {
        flex-direction: row;
    }

    .btn-group .btn {
        width: auto;
        margin: 0;
    }

    .table td, .table th {
        min-width: 120px;
    }
}

/* Additional tablet-specific adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        padding: 1rem;
    }

    .card-header .badge {
        margin-left: 0.5rem;
    }

    .table td:first-child,
    .table th:first-child {
        min-width: 250px;
    }

    .mobile-table {
        font-size: 0.95rem;
    }

    .card-body {
        padding: 1.25rem;
    }
}

/* Improve dark mode contrast on mobile */
@media (max-width: 768px) {
    .dark-theme {
        --dark-surface: #1a1d21;
        --dark-surface-lighter: #242830;
    }

    .card {
        border: 1px solid var(--border-color);
    }
}

/* Add to your existing <style> section or CSS file */
.question-preview {
    flex: 1;
    overflow: hidden;
    margin-right: 1rem;
}

.question-number {
    font-weight: bold;
    white-space: nowrap;
}

.question-preview-text {
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .accordion-button {
        padding: 0.75rem;
    }
    
    .question-preview {
        font-size: 0.9rem;
        margin-right: 0.5rem;
    }
    
    .question-status {
        min-width: 80px;
        text-align: right;
    }
}

/* Database Statistics Styling */
.stats-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.stats-section {
    background: var(--dark-surface-lighter);
    border-radius: 0.5rem;
    padding: 1rem;
    transition: transform 0.2s;
}

.stats-section:hover {
    transform: translateY(-2px);
}

.stats-title {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--accent-color);
}

.stats-items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: var(--dark-surface);
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
}

.stat-item:hover {
    background: var(--dark-surface-lighter);
    transform: translateX(4px);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.stat-value {
    font-weight: 600;
    color: var(--text-primary);
}

.progress-stat {
    width: 100%;
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.progress {
    background-color: var(--dark-surface);
    overflow: hidden;
}

/* Mobile optimizations for stats */
@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .stats-section {
        padding: 0.75rem;
    }

    .stat-item {
        padding: 0.375rem;
    }

    .stats-title {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }

    .stat-label {
        font-size: 0.875rem;
    }

    .stat-value {
        font-size: 0.875rem;
    }

    .progress-labels {
        font-size: 0.75rem;
    }
}

.test-card {
    transition: transform 0.2s;
}
.test-card:hover {
    transform: translateY(-5px);
}
.question-item {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
}
.answer-preview {
    margin-top: 0.5rem;
}
.progress {
    height: 25px;
    background-color: rgba(255,255,255,0.1);
}
.progress-bar {
    background: linear-gradient(45deg, var(--accent-color), var(--accent-lighter));
    transition: width 0.3s ease;
}
.modal-dialog {
    max-width: 800px;
}

.text-primary {
    color: var(--text-primary); /* Ensure all text-primary elements are white */
}

.modal-header, .modal-body, #flashcardDarkModal .modal-content {
    background-color: var(--dark-surface) !important;
}

.modal-content, .card, .sidebar {
    background-color: var(--dark-surface);
    border-color: var(--border-color);
}

.badge-question-type {
    background-color: var(--dark-surface-lighter);
    border: 1px solid var(--accent-color);
}

.badge-unanswered {
    background-color: var(--danger);
    border: 1px solid var(--border-color);
}

/* Modal styling */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    display: none;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    overflow-y: auto;
}

.modal.show {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.modal-dialog {
    margin: 0;
    width: 100%;
    max-width: 800px;
    transform: none;
    position: relative;
}

.modal-content {
    width: 100%;
    margin: 20px;
    background: var(--dark-surface);
    border-radius: 0.75rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* Förhindra scroll på body när modal är öppen */
body.modal-open {
    overflow: hidden;
    padding-right: 17px; /* Kompensera för scrollbar */
}

@media (max-width: 768px) {
    .modal-dialog {
        max-width: 95%;
    }
    
    .modal-content {
        margin: 10px;
    }
}

/* Update dialog styles */
.custom-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: none;
    z-index: 2000;
}

.custom-dialog.show {
    display: block; /* Changed from flex */
}

.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
}

.dialog-container {
    position: absolute; /* Changed from fixed */
    top: 50vh;  /* Changed from 50% */
    left: 50%;
    transform: translate(-50%, -50%);
    margin: auto;
    width: 90%;
    max-width: 600px;
    background: var(--dark-surface);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    max-height: 90vh;
    overflow-y: auto;
}
.btn-close{
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 1.5rem;
    color: #FFF !important;
    cursor: pointer;
}

/* Uppdatera radio-knapp styling */
input[type="radio"] {
    appearance: none;
    width: 38px; /* Match button height */
    height: 38px; /* Match button height */
    border: 1px solid var(--border-color);
    background-color: var(--dark-bg);
    margin: 0;
    cursor: pointer;
    display: inline-block;
    position: relative;
    border-radius: 0.25rem;
    transition: all 0.2s ease-in-out;
    vertical-align: middle;
}

input[type="radio"]:checked {
    background-color: var(--success);
    border-color: var(--accent-color);
}

input[type="radio"]:checked::before {
    content: "✔";
    color: white;
    font-size: 20px;
    font-weight: bold;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Justera input-group layouten */
.input-group .input-group-append {
    display: flex;
}

.input-group .input-group-append .input-group-text {
    padding: 0;
    background: none;
    border: none;
}

.input-group .remove-alternative {
    height: 38px;
    width: 38px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-groupdown {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
/* Återställ alla standardstilar från Bootstrap eller webbläsaren */
.form-check-input {
    all: unset; /* Tar bort alla standardstilar */
    appearance: none; /* Döljer standardutseendet */
    display: inline-block;
    position: relative;
    cursor: pointer;
}

/* Anpassa utseendet på radio-knappen */
.form-check-input {
    appearance: none;
    width: 38px; /* Storlek på den "falska" radioknappen */
    height: 38px;
    border: 2px solid var(--border-color);
    background-color: var(--dark-bg);
    margin: 0;
    cursor: pointer;
    display: inline-block;
    position: relative;
    border-radius: 0.25rem; /* För rundade kanter */
    transition: all 0.2s ease-in-out;
    vertical-align: middle;
}

/* När radion är vald */
.form-check-input:checked {
    background-color: var(--success);
    border-color: var(--accent-color);
}

/* Lägger till en bock (✔) i mitten av knappen vid val */
.form-check-input:checked::before {
    content: "✔";
    color: white;
    font-size: 20px;
    font-weight: bold;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Justerar textens position i förhållande till knappen */
.form-check-label {
    position: relative;
    top: 5px; /* Justera efter behov för att få rätt höjd */
    left: 10px; /* Avstånd mellan knapp och text */
    font-size: 16px;
}
#messageInput{
    width: 100%;
    height: 100px;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid var(--border-color);
    background-color: var(--dark-bg);
    color: var(--text-primary);
    resize: none;
}