﻿/* Global White Background */
body {
    background-color: #fff !important;
}

/* Table cell styling */
td {
    padding: 2px;
    border: 1px solid #ddd;
    vertical-align: middle;

    position: relative;
    text-align: center;
}

input.form-control:not(textarea),
.form-select:not([multiple]) {
    height: 28px;
}

input.form-control,
textarea.form-control,
.form-select {
    width: 100%;
    padding: 0.15rem 0.4rem;
    border-radius: 0.375rem !important;
    box-sizing: border-box;
    font-size: 0.8rem;
    background-color: #f8f9fa;
    border: 1px solid #ccc;
    /* Forced ultra-compact height for single-line inputs */
}

/* Global RTL support for selects when Bootstrap RTL CSS is missing */
body[dir="rtl"] .form-select,
[dir="rtl"] .form-select {
    background-position: left 0.75rem center !important;
    padding-left: 2.25rem !important;
    padding-right: 0.75rem !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e") !important;
}

body[dir="rtl"] .form-select-sm,
[dir="rtl"] .form-select-sm {
    padding-left: 1.75rem !important;
}

/* Specific styles for textareas to make them taller */
textarea.form-control {
    height: 120px !important;
    resize: vertical;
}

/* Button styling */
input[type="button"],
.btn {
    cursor: pointer;
    border-radius: 0.375rem;
    padding: 0.15rem 0.4rem;
    height: 28px;
    /* Force identical height to inputs */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

/* Ensure icon-only buttons are perfectly square and symmetric */
.btn-icon-square {
    width: 28px !important;
    height: 28px !important;
    padding: 0 !important;
    min-width: 28px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.btn-icon-square i {
    font-size: 0.9rem !important;
}

.btn-outline-purple {
    color: #8b5cf6;
    border-color: #8b5cf6;
}

.btn-outline-purple:hover {
    background-color: #8b5cf6;
    color: white;
}

.shadow-2xl {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
}

.fw-black {
    font-weight: 900 !important;
}

/* Standardized Page Titles - Matching Reports Look */
.site-page-title {
    font-weight: 700 !important;
    color: #212529 !important;
}

@media (min-width: 992px) {
    .site-page-title {
        font-size: 2.2rem !important;
    }
}

@media (max-width: 991px) {
    .site-page-title {
        font-size: 1.5rem !important;
    }
}

/* Extra compact square for density in tables */
.btn-table-sm {
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    font-size: 0.8rem !important;
}

/* Specific class for Back buttons to match input border-radius */
.btn-back {
    border-radius: 0.375rem !important;
}

input[type="button"]:hover {
    background-color: #0056b3;
}

/* Question Edit Link styling */
.question-edit-link {
    color: #0d6efd;
    /* Bootstrap primary blue */
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.2s ease;
    display: block;
    width: 100%;
}

.question-edit-link:hover {
    color: #0056b3;
}

/* Base Checkbox styling */
input[type="checkbox"] {
    width: 17px;
    height: 17px;
    margin: 0;
    /*transform: scale(1.5);*/
    display: block;
    margin-left: auto;
    /*margin-right: auto;*/
}

/* Ensure checkbox is centered vertically */
td input[type="checkbox"] {
    display: block;
    margin-left: auto;
    margin-right: auto;
    margin-top: 0px;
}

/* Form controls borders */
td input[type="text"],
td textarea {
    border: 0.5px solid #E0E0E0 !important;
}

#questionContainer>table tr td {
    border: 0px none !important;
}

/* General Mobile & Tablet Adjustments (Up to 991px) */
@media (max-width: 991px) {

    /* Global Page Titles */
    h2 {
        font-size: 1.5rem !important;
    }

    h5 {
        font-size: 1rem !important;
    }

    /* Create Test Table */
    .id-column {
        display: none !important;
    }

    #tblQuestions {
        font-size: 0.75rem !important;
        table-layout: fixed;
        width: 100% !important;
    }

    #tblQuestions td {
        padding: 3px !important;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    #tblQuestions td:nth-child(2) {
        width: 32px !important;
        min-width: 32px !important;
    }

    #tblQuestions input[type="checkbox"],
    .table input[type="checkbox"] {
        transform: scale(1) !important;
        width: 16px !important;
        height: 16px !important;
        margin-right: auto !important;
        margin-left: auto !important;
    }

    /* Filter/Search Inputs */
    #txtFilterQuestions::placeholder,
    #searchExam::placeholder {
        font-size: 0.82rem !important;
    }

    /* My Tests Page */
    #tblMyTests {
        font-size: 0.7rem !important;
    }

    #tblMyTests td,
    #tblMyTests th {
        padding: 4px 2px !important;
    }

    #tblMyTests .btn-sm {
        padding: 0.2rem 0.4rem !important;
        font-size: 0.75rem !important;
    }

    #tblMyTests .btn-sm i {
        font-size: 0.85rem !important;
    }

    .text-truncate-custom {
        display: inline-block;
        max-width: 110px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        vertical-align: middle;
    }

    /* Groups Page */
    .group-name-input {
        height: 38px !important;
        font-size: 0.9rem !important;
        padding: 5px 15px !important;
    }

    .btn-add-group {
        padding: 0.3rem 0.6rem !important;
        font-size: 0.85rem !important;
    }

    .btn-add-group i {
        font-size: 1.1rem !important;
    }

    /* User Management Page - Mobile Optimizations */
    #tblUsers {
        font-size: 0.65rem !important;
        /* Aggressively small font */
    }

    #tblUsers td,
    #tblUsers th {
        padding: 3px 1px !important;
        /* Minimum padding */
    }

    #tblUsers .btn-sm {
        padding: 0.15rem 0.3rem !important;
        /* Shrunk buttons */
        font-size: 0.7rem !important;
    }

    #tblUsers .btn-sm i {
        font-size: 0.75rem !important;
    }

    #tblUsers .badge {
        padding: 3px 5px !important;
        font-size: 0.65rem !important;
        width: auto !important;
        min-width: 40px;
    }

    /* Other Adjustments */
    #lstSubjects,
    #txtFilterQuestions {
        font-size: 0.78rem !important;
        line-height: 1.2 !important;
        padding: 0.25rem 0.5rem !important;
    }

    /* Force small font for the input text itself */
    input#txtFilterQuestions {
        font-size: 0.78rem !important;
        padding-right: 1.8rem !important;
    }

    #txtFilterQuestions::placeholder {
        font-size: 0.78rem !important;
    }

    .header-count-span {
        margin-right: -2px !important;
        margin-left: 0 !important;
    }

    .test-buttons .btn {
        padding: 0.3rem 0.6rem !important;
        font-size: 0.85rem !important;
    }

    .test-buttons .btn i {
        font-size: 1.1rem !important;
    }

    /* Global Blue Section Headers */
    .section-header-blue {
        padding: 0.4rem 0.6rem !important;
    }

    .section-header-blue h4,
    .section-header-blue h5,
    .section-header-blue h6,
    .section-header-blue .modal-title {
        font-size: 0.9rem !important;
        margin-bottom: 0 !important;
    }

}

#tblBorder td {
    border: 0px none;
}

.current_question {
    font-size: 18px;
    color: #007bff;
    font-weight: bold;
}

#divCorrectAnswer,
#divPeepAnswer {
    font-size: 14px;
    color: #0077cc;
}

#txtFilterQuestions,
#searchExam {
    width: 100%;
}

/* Desktop widths for #tblQuestions */
#tblQuestions {
    width: 100% !important;
}

#tblQuestions td:nth-child(1) {
    width: 5% !important;
}

#tblQuestions td:nth-child(2) {
    width: 5% !important;
}

#tblQuestions td:nth-child(3) {
    width: 28% !important;
}

#tblQuestions td:nth-child(4) {
    width: 62% !important;
}

.test-buttons {
    display: flex;
    gap: 10px;
}

.row-collapsed {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: auto;
    cursor: pointer;
    /* Indicate clickability */
}

.row-expanded {
    height: auto;
}

body {
    padding-bottom: 60px;
}

/* Global Modern Search Boxes - Single Class Approach */
.search-input-modern {
    height: 34px !important;
    font-size: 0.75rem !important;
    padding-right: 2.22rem !important;
    /* Space for the icon on the right (RTL) */
    padding-left: 0.75rem !important;
    border-radius: 0.375rem !important;
    border: 1px solid #ced4da !important;
    width: 100% !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3E%3Cpath fill='%236c757d' d='M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM208 352a144 144 0 1 0 0-288 144 144 0 1 0 0 288z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 14px 14px !important;
    background-color: #fff !important;
    transition: border-color 0.2s, box-shadow 0.2s !important;
}


.search-input-modern:focus {
    border-color: #0d6efd !important;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25) !important;
    outline: none;
}

/* Modern Form Input (same as search but without icon) */
.form-input-modern {
    height: 34px !important;
    font-size: 0.82rem !important;
    border-radius: 0.375rem !important;
    border: 1px solid #ced4da !important;
    padding: 0.375rem 0.75rem !important;
    background-color: #fff !important;
    width: 100% !important;
    transition: border-color 0.2s, box-shadow 0.2s !important;
}

.form-input-modern:focus {
    border-color: #0d6efd !important;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25) !important;
    outline: none;
}

/* Header buttons styling */
/* Header buttons styling - Self contained */
.btn-header-action {
    padding: 0.25rem 0.6rem !important;
    font-size: 0.78rem !important;
    line-height: 1.2 !important;
    height: auto !important;
    background-color: #f8f9fa !important;
    /* btn-light */
    color: #0d6efd !important;
    /* text-primary */
    font-weight: 700 !important;
    /* fw-bold */
    border: 1px solid transparent !important;
    border-radius: 0.25rem !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.3rem !important;
}

.btn-header-action:hover {
    background-color: #e2e6ea !important;
    color: #0b5ed7 !important;
}

.btn-header-action i {
    font-size: 0.9em !important;
}

.t_11 {
    font-size: 11px
}

.t_12 {
    font-size: 12px
}

.t_13 {
    font-size: 13px
}

.t_14 {
    font-size: 14px
}

/* Modern Alert Styles - Single Class for Consistency */
.alert-modern {
    font-size: 12px !important;
    padding: 0.4rem 0.75rem !important;
    padding-left: 2.8rem !important;
    /* Extra space for close button */
    position: relative !important;
    margin-bottom: 0.75rem !important;
    border-radius: 4px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
    white-space: normal !important;
    line-height: 1.3 !important;
    /* Allow wrapping */
}

/* Ensure the close button is positioned correctly in the modern alert */
.alert-modern .btn-close {
    padding: 0.8rem !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    left: 4px !important;
    /* Position on the left for RTL */
    right: auto !important;
    margin: 0 !important;
    position: absolute !important;
}

/* Compact Validation Summary - Matching Alert Modern */
.validation-summary-errors,
.validation-summary-valid {
    font-size: 12px !important;
    padding: 0.4rem 0.75rem !important;
    margin-bottom: 0.75rem !important;
    border-radius: 4px !important;
    background-color: #f8d7da !important;
    /* Pink background like alert-danger */
    color: #842029 !important;
    border: 1px solid #f5c2c7 !important;
}

.validation-summary-errors ul {
    margin-bottom: 0 !important;
    padding-right: 1.2rem !important;
    /* RTL padding for bullets */
}

.row-inactive td {
    background-color: #ededed !important;
    color: #6c757d !important;
}

.row-inactive a.fw-bold {
    color: #666 !important;
    text-decoration: none !important;
    font-weight: normal !important;
}

.row-inactive .btn {
    opacity: 0.6;
}

.row-inactive .btn:hover {
    opacity: 1;
}

/* Inactive Row Styling - Strong Overrides */
tr.row-inactive,
tr.row-inactive>td,
tr.row-inactive>th {
    background-color: #e9ecef !important;
    color: #6c757d !important;
}

/* Ensure links inside inactive rows are also grayed out */
tr.row-inactive a {
    color: #6c757d !important;
}

tr.row-inactive a:hover {
    color: #495057 !important;
}

/* Dim styling for buttons to imply inactivity but keep them clickable */
tr.row-inactive .btn {
    opacity: 0.6;
    transition: opacity 0.2s;
}

tr.row-inactive .btn:hover {
    opacity: 1;
}

/* Fix for Bootstrap table-hover overriding our gray background on hover */
.table-hover>tbody>tr.row-inactive:hover>* {
    background-color: #e2e6ea !important;
    box-shadow: none !important;
}

/* Custom Validation Styling */
.input-validation-error,
.input-validation-error:focus {
    border-color: #dc3545 !important;
    /* Strong red border */
    background-color: #ffe6e6 !important;
    /* More visible reddish background */
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25) !important;
    outline: none !important;
}

/* Optional: Hide the default text message if user wants purely visual border cues */
.field-validation-error {
    color: #dc3545;
    font-size: 0.75rem;
    margin-top: 0.1rem;
    font-weight: 600;

}

/* Custom Row Coloring for Audit Log */
.row-success-custom,
.row-success-custom>td {
    background-color: #d1e7dd !important;
    /* Light Green */
}

.row-danger-custom,
.row-danger-custom>td {
    background-color: #f8d7da !important;
    /* Light Red */
}

/* Ensure hover effect darkens slightly but keeps tint */
.table-hover>tbody>tr.row-success-custom:hover>td {
    background-color: #c3e6cb !important;
}

.table-hover>tbody>tr.row-danger-custom:hover>td {
    background-color: #f5c6cb !important;
}

/* Answer Expansion Styling */
.answer-toggle-icon {
    cursor: pointer;
    font-size: 0.8rem;
    color: #0d6efd;
    text-decoration: none !important;
    display: inline-block;
    border: none !important;
    outline: none !important;
}

.answer-toggle-icon:hover {
    color: #0b5ed7;
    text-decoration: none !important;
}

/* Compact Table Header and Rows */
#tblQuestions thead th {
    padding-top: 1px !important;
    padding-bottom: 1px !important;
    line-height: 1.1;
    font-size: 0.8rem;
    background-color: #f8f9fa;
    height: 30px;
    vertical-align: middle !important;
}

#tblQuestions td {
    padding-top: 3px !important;
    padding-bottom: 3px !important;
    height: 30px;
}

#qHeaderButtons button,
#qHeaderButtons button:hover,
#qHeaderButtons button:focus,
#qHeaderButtons button i {
    text-decoration: none !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    font-size: 1rem !important;
    /* Smaller icons to reduce header height */
}

/* Minimize blue header height */
.section-header-blue {
    padding-top: 2px !important;
    padding-bottom: 2px !important;
}

.section-header-blue h5 {
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.question-text-toggle {
    line-height: 1.1;
    font-size: inherit;
    font-weight: normal;
    color: #0d6efd;
    cursor: pointer;
    transition: color 0.1s;
}

.question-text-toggle:hover {
    color: #0056b3;
    text-decoration: underline !important;
}

.answer-details-row {
    background-color: #f8f9fa !important;
    display: none;
    /* Hidden by default */
}

.answer-details-wrapper {
    padding: 10px;
    border-right: 3px solid #0d6efd;
    background: #fff;
    margin: 5px 20px 5px 0;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* KaTeX RTL fix - Absolute Isolation from Hebrew Environment */
#mathPreview {
    direction: ltr !important;
    unicode-bidi: plaintext !important;
    /* The most powerful way to ignore site-wide RTL rules */
    text-align: center !important;
    padding: 20px !important;
    min-height: 80px;
}

.katex {
    direction: ltr !important;
    unicode-bidi: isolate !important;
    color: #000 !important;
    font-size: 1.3em !important;
}

/* Specific fix for the equals sign (=) and other relations */
.katex .mrel {
    vertical-align: middle !important;
    padding: 0 0.2em !important;
    font-weight: bold !important;
    /* Ensures both lines are thick enough to see */
}

/* Prevent bottom-clipping which makes equals look like minus */
.katex .katex-html {
    display: inline-flex !important;
    align-items: center !important;
    height: auto !important;
    padding: 4px 0 !important;
}

.katex * {
    direction: ltr !important;
    unicode-bidi: isolate !important;
}