/* ============================================
   MMSE Custom Styles
   ============================================ */

/* RTL Support */
[dir="rtl"] {
    text-align: right;
}

[dir="rtl"] .text-start {
    text-align: right !important;
}

[dir="rtl"] .text-end {
    text-align: left !important;
}

[dir="rtl"] .ms-3 {
    margin-left: 0 !important;
    margin-right: 1rem !important;
}

[dir="rtl"] .me-2 {
    margin-right: 0 !important;
    margin-left: 0.5rem !important;
}

[dir="rtl"] .me-1 {
    margin-right: 0 !important;
    margin-left: 0.25rem !important;
}

[dir="rtl"] .pe-2 {
    padding-right: 0 !important;
    padding-left: 0.5rem !important;
}

[dir="rtl"] .ps-3 {
    padding-left: 0 !important;
    padding-right: 1rem !important;
}

[dir="rtl"] .flex-row {
    flex-direction: row-reverse;
}

[dir="rtl"] .justify-content-between {
    justify-content: space-between !important;
}

[dir="rtl"] .d-flex .flex-grow-1 {
    text-align: right;
}

/* RTL Alert fixes */
[dir="rtl"] .alert {
    text-align: right !important;
}

[dir="rtl"] .alert .alert-heading {
    text-align: right !important;
}

[dir="rtl"] .alert .d-flex {
    flex-direction: row-reverse;
}

[dir="rtl"] .alert .border-bottom {
    text-align: right;
}

[dir="rtl"] .alert .small {
    text-align: right;
}

[dir="rtl"] .alert p {
    text-align: right;
}

[dir="rtl"] .alert .mb-0 {
    text-align: right;
}

[dir="rtl"] .alert .d-flex.justify-content-between {
    flex-direction: row-reverse;
}

[dir="rtl"] .alert .text-start {
    text-align: right !important;
}

[dir="rtl"] .alert .text-end {
    text-align: left !important;
}

body {
    background-color: #f4f6f9;
    color: #333;
}

/* Header styling */
.header-bar {
    background: linear-gradient(135deg, #0d6efd, #0a58ca);
    color: white;
    padding: 20px 0;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Introduction section styling */
.intro-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.intro-section h2 {
    color: #0d6efd;
    font-size: 1.75rem;
    margin-bottom: 25px;
    font-weight: 700;
}

.intro-section h3 {
    color: #495057;
    font-size: 1.25rem;
    margin-top: 20px;
    margin-bottom: 12px;
    font-weight: 600;
}

.intro-section p {
    color: #6c757d;
    line-height: 1.8;
    margin-bottom: 15px;
}

.disclaimer-box {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 20px;
    margin-top: 25px;
    border-radius: 8px;
}

[dir="rtl"] .disclaimer-box {
    border-left: none;
    border-right: 4px solid #ffc107;
}

.disclaimer-box h3 {
    color: #856404;
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.disclaimer-box p {
    color: #856404;
    margin-bottom: 0;
}

/* Card styling */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    background: white;
}

.card-header {
    background-color: #ffffff;
    border-bottom: 2px solid #f0f2f5;
    font-weight: 700;
    color: #0d6efd;
    padding: 15px 20px;
    border-radius: 12px 12px 0 0 !important;
}

.section-score {
    font-size: 0.85rem;
    color: #6c757d;
    font-weight: 500;
    float: right;
}

[dir="rtl"] .section-score {
    float: left;
}

/* Form styling */
.form-check-input:checked {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.form-check-input:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.form-check-input {
    width: 1.5rem;
    height: 1.5rem;
    margin-top: 0.25rem;
}

.form-check-label {
    font-size: 1rem;
    padding-left: 0.5rem;
}

[dir="rtl"] .form-check-label {
    padding-left: 0;
    padding-right: 0.5rem;
}

.question-row {
    padding: 12px 0;
    border-bottom: 1px solid #f8f9fa;
}

.question-row:last-child {
    border-bottom: none;
}

/* Score circle styling */
.score-circle {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: #fff;
    border: 8px solid;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    font-weight: 700;
    margin: 0 auto 20px;
    color: #0d6efd;
}

/* Button styling */
.btn-toggle-lang {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 20px;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.btn-toggle-lang:hover {
    background-color: rgba(255, 255, 255, 0.3);
    color: white;
    border-color: rgba(255, 255, 255, 0.5);
}

.btn-primary {
    padding: 12px 30px;
    font-weight: 600;
    border-radius: 8px;
}

/* Alert styling for results */
.alert {
    border-radius: 10px;
    padding: 20px;
}

.alert-heading {
    font-weight: 600;
}

/* Print styles */
@media print {
    @page {
        size: A4;
        margin: 1.5cm;
    }

    .no-print,
    .btn,
    .header-bar,
    .intro-section,
    .card:not(#print-view .card),
    footer {
        display: none !important;
    }

    /* Specific hide for the screen result card if it doesn't have a specific class to target */
    body>.container>.row>.col-lg-8>.card {
        display: none !important;
    }

    body {
        background-color: white;
        font-size: 10pt;
        /* Reduced from 11pt */
        color: black;
        margin: 0;
        padding: 0;
    }

    .container {
        max-width: 100% !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    /* Print View Styling */
    #print-view {
        display: block !important;
        width: 100%;
    }

    #print-view h1 {
        font-size: 16pt;
        /* Reduced from 18pt */
        margin-bottom: 5px;
        border-bottom: 2px solid #000;
        padding-bottom: 5px;
        text-align: center;
        text-transform: uppercase;
    }

    #print-view .print-meta {
        margin-bottom: 10px;
        font-size: 10pt;
        border-bottom: 1px solid #000;
        padding-bottom: 10px;
    }

    #print-view .print-meta table td {
        border: none !important;
        padding: 2px 0 !important;
    }

    #print-view .print-score {
        background-color: transparent;
        border: 2px solid #000;
        padding: 5px 10px;
        margin-bottom: 15px;
        font-weight: bold;
        font-size: 11pt;
        text-align: center;
    }

    #print-view table.results-table {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 0;
        font-size: 9pt;
        /* Further reduced for table */
    }

    #print-view table.results-table th,
    #print-view table.results-table td {
        border: 1px solid #000;
        /* Black borders for crisp printing */
        padding: 2px 5px;
        /* Compact padding */
        text-align: left;
    }

    [dir="rtl"] #print-view table.results-table th,
    [dir="rtl"] #print-view table.results-table td {
        text-align: right;
    }

    #print-view table.results-table th {
        background-color: #f0f0f0 !important;
        /* Force light gray background for headers */
        font-weight: bold;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Ensure styles are always black for text */
    * {
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    /* Compact section headers in table */
    .section-header {
        background-color: #e0e0e0 !important;
        font-weight: bold;
        text-transform: uppercase;
        font-size: 8pt;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* Notes & Recommendations */
    .print-notes {
        margin-top: 15px;
        page-break-inside: avoid;
    }

    .box-section {
        border: 1px solid #000;
        padding: 5px;
        margin-bottom: 10px;
        min-height: 50px;
    }

    .box-section h6 {
        margin: 0 0 5px 0;
        font-weight: bold;
        font-size: 10pt;
        border-bottom: 1px dotted #ccc;
        width: 100%;
    }

    .text-content {
        white-space: pre-wrap;
        /* Preserve line breaks from textarea */
        font-size: 10pt;
    }

    /* ensure the icon is visible */
    #print-view img {
        display: inline-block !important;
        vertical-align: middle;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .score-circle {
        width: 120px;
        height: 120px;
        font-size: 3rem;
    }

    .intro-section {
        padding: 20px;
    }
}

/* Error message styling */
.error-alert {
    background-color: #f8d7da;
    border: 1px solid #f5c2c7;
    color: #842029;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}


.form-switch .form-check-input {
    width: 3rem;
    height: 1.7rem;
}