/* ========================================
   MODERN DARK THEME - RESPONSIVE DESIGN
   ======================================== */

/* Base & Typography */
body {
    font-size: 14px;
    font-weight: 300;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 100%);
    min-height: 100vh;
    color: #e0e0e0;
}

/* Navbar - Modern gradient with glassmorphism */
.navbar {
    background: linear-gradient(135deg, rgba(31, 31, 31, 0.95) 0%, rgba(45, 45, 45, 0.95) 100%);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(187, 134, 252, 0.2);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
    padding: 1rem 0;
}

.navbar-brand {
    font-weight: 600;
    background: linear-gradient(135deg, #bb86fc 0%, #03dac6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 1.25rem;
}

.nav-link {
    transition: all 0.3s ease;
    border-radius: 8px;
    padding: 0.5rem 1rem !important;
    margin: 0 0.25rem;
}

.nav-link:hover {
    background: rgba(187, 134, 252, 0.1);
    transform: translateY(-2px);
}

.navbar-toggler:focus {
    box-shadow: none;
}

/* Form Controls - Enhanced */
.form-select {
    background: rgba(30, 30, 30, 0.8);
    border: 1px solid rgba(187, 134, 252, 0.3);
    color: #fff;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.form-select:focus {
    border-color: #bb86fc;
    box-shadow: 0 0 0 0.25rem rgba(187, 134, 252, 0.25);
    background: rgba(30, 30, 30, 0.95);
}

/* Question Cards - Premium design */
.list-group-item {
    background: linear-gradient(135deg, rgba(30, 30, 30, 0.9) 0%, rgba(40, 40, 40, 0.9) 100%);
    border: 1px solid rgba(187, 134, 252, 0.2);
    border-radius: 16px;
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.list-group-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(187, 134, 252, 0.2);
    border-color: rgba(187, 134, 252, 0.4);
}

.list-group-item img {
    width: 100%;
    max-width: 500px;
    border-radius: 12px;
    margin: 1rem 0 1rem -35px;
}

/* Question Typography */
h6.fw-bold {
    font-weight: 400 !important;
    color: #fff;
    font-size: 1rem;
    line-height: 1.6;
}

.question-container {
    position: relative;
    text-indent: 40px;
}

.question-number {
    color: #bb86fc;
    font-weight: 600;
    position: absolute;
    left: 0;
    top: 0;
    text-indent: 0;
    font-size: 1.1rem;
}

.question-content {
    display: inline;
}

/* Options List */
.options-section {
    padding-left: 0;
    list-style-type: none;
    margin-top: 1rem;
}

.options-section li {
    list-style: none;
    color: #e0e0e0;
    padding: 0.75rem 1rem;
    margin: 0.5rem 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border-left: 3px solid rgba(187, 134, 252, 0.3);
    transition: all 0.2s ease;
}

.options-section li:hover {
    background: rgba(187, 134, 252, 0.1);
    border-left-color: #bb86fc;
    /* transform: translateX(4px); */
}

/* HTML formatting support in options */
.options-section li strong,
.options-section li b {
    color: #bb86fc;
    font-weight: 600;
}

.options-section li em,
.options-section li i {
    color: #03dac6;
    font-style: italic;
}

.options-section li u {
    text-decoration: underline;
    text-decoration-color: rgba(187, 134, 252, 0.5);
}

.options-section li code {
    background: rgba(187, 134, 252, 0.15);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #c99dff;
}

/* Answer Sections */
.answer-section {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(3, 218, 198, 0.05);
    border-radius: 8px;
    border-left: 3px solid #03dac6;
    color: #e0e0e0;
}

/* Buttons - Modern style */
.btn-link {
    color: #bb86fc;
    margin-right: 0.75rem;
    font-size: 0.9rem;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.btn-link:hover {
    background: rgba(187, 134, 252, 0.1);
    color: #c99dff;
}

.btn-outline-primary {
    border-color: rgba(187, 134, 252, 0.5);
    color: #bb86fc;
    transition: all 0.3s ease;
}

.btn-outline-primary:hover {
    background: #bb86fc;
    border-color: #bb86fc;
    color: #000;
    transform: scale(1.05);
}

.btn-secondary {
    background: rgba(187, 134, 252, 0.2);
    border: 1px solid rgba(187, 134, 252, 0.3);
    color: #bb86fc;
    transition: all 0.3s ease;
}

.btn-secondary:hover:not(:disabled) {
    background: #bb86fc;
    color: #000;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(187, 134, 252, 0.3);
}

.btn-secondary:disabled {
    opacity: 0.4;
}

.no-border {
    border: none;
}

/* Pagination */
#pagination {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(30, 30, 30, 0.6);
    border-radius: 16px;
    border: 1px solid rgba(187, 134, 252, 0.2);
}

#pageInfo {
    color: #bb86fc;
    font-weight: 500;
    font-size: 1rem;
}

/* Modal Enhancements */
.modal-content {
    background: linear-gradient(135deg, #1e1e1e 0%, #2d2d2d 100%);
    border: 1px solid rgba(187, 134, 252, 0.3);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
    border-bottom: 1px solid rgba(187, 134, 252, 0.2);
}

.modal-footer {
    border-top: 1px solid rgba(187, 134, 252, 0.2);
}

.modal-footer .btn {
    font-size: 14px;
}

.form-label {
    color: #bb86fc;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-control {
    background: rgba(30, 30, 30, 0.8);
    border: 1px solid rgba(187, 134, 252, 0.3);
    color: #fff;
    border-radius: 8px;
    padding: 0.75rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    background: rgba(30, 30, 30, 0.95);
    border-color: #bb86fc;
    box-shadow: 0 0 0 0.25rem rgba(187, 134, 252, 0.25);
    color: #fff;
}

/* Quill Editor Dark Theme */
.ql-toolbar,
.ql-container {
    border-color: rgba(187, 134, 252, 0.3) !important;
}

.ql-toolbar {
    background: rgba(45, 45, 45, 0.8);
    border-radius: 8px 8px 0 0;
}

.ql-container {
    background: rgba(30, 30, 30, 0.8);
    color: #fff;
    border-radius: 0 0 8px 8px;
}

.ql-editor {
    color: #fff;
    min-height: 150px;
}

.ql-toolbar .ql-stroke {
    stroke: #bb86fc;
}

.ql-toolbar .ql-fill {
    fill: #bb86fc;
}

.ql-toolbar button:hover,
.ql-toolbar .ql-picker-label:hover {
    background: rgba(187, 134, 252, 0.2);
}

.ql-toolbar button.ql-active {
    background: rgba(187, 134, 252, 0.3);
}

.ql-toolbar .ql-picker-options {
    background: #2d2d2d;
    border-color: rgba(187, 134, 252, 0.3);
}

/* Loading States */
.spinner-border {
    color: #bb86fc;
}

/* Alerts */
.alert {
    border-radius: 12px;
    border: 1px solid rgba(187, 134, 252, 0.3);
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* Tablet */
@media (max-width: 768px) {
    body {
        font-size: 13px;
    }

    .navbar-brand {
        font-size: 1.1rem;
    }

    .list-group-item {
        padding: 1rem;
        margin-bottom: 1rem;
        border-radius: 12px;
    }

    h6.fw-bold {
        font-size: 0.95rem;
    }

    .question-number {
        font-size: 1rem;
    }

    .options-section li {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
    }

    .btn-link {
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
    }

    #pagination {
        padding: 1rem;
    }

    .modal-dialog {
        margin: 0.5rem;
    }

    .form-select {
        font-size: 0.9rem;
    }
}

/* Mobile */
@media (max-width: 576px) {
    .list-group-item {
        padding: 0.75rem;
    }

    .question-container {
        text-indent: 35px;
    }

    .options-section li {
        font-size: 0.85rem;
    }

    .btn {
        font-size: 0.85rem;
        padding: 0.5rem 0.75rem;
    }
}

/* Touch-friendly for mobile */
@media (hover: none) and (pointer: coarse) {

    .btn,
    .nav-link,
    .form-select {
        min-height: 44px;
        /* Apple's recommended touch target size */
    }

    .list-group-item {
        padding: 1.25rem;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Container spacing */
.container-fluid {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

@media (max-width: 768px) {
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* Alert Enhancements */
.alert {
    padding: 1.25rem;
}

.alert-heading {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-heading i {
    font-size: 1.5rem;
}

.alert p {
    margin-bottom: 0;
    font-size: 1rem;
}

.alert-link {
    font-weight: 600;
    text-decoration: underline;
}

/* Auth container */
.auth-container {
    max-width: 500px;
    margin: 50px auto;
    padding: 0 1rem;
}

/* Mobile Alert Improvements */
@media (max-width: 768px) {
    .alert {
        padding: 1rem;
        margin: 1rem;
    }

    .alert-heading {
        font-size: 1.1rem;
    }

    .alert p {
        font-size: 0.9rem;
    }
}

@media (max-width: 576px) {
    .alert {
        padding: 0.875rem;
        margin: 0.75rem;
        border-radius: 8px;
    }

    .alert-heading {
        font-size: 1rem;
        gap: 0.375rem;
    }

    .alert-heading i {
        font-size: 1.25rem;
    }

    .alert p {
        font-size: 0.875rem;
        line-height: 1.5;
    }

    .auth-container {
        margin: 20px auto;
        padding: 0 0.75rem;
    }
}

/* Alert Redesign - Modern & Beautiful */
.alert-warning {
    background: linear-gradient(135deg, rgba(187, 134, 252, 0.15) 0%, rgba(187, 134, 252, 0.05) 100%);
    border: 1px solid rgba(187, 134, 252, 0.4);
    border-left: 4px solid #bb86fc;
    color: #e0e0e0;
    box-shadow: 0 4px 20px rgba(187, 134, 252, 0.1);
}

.alert-danger {
    background: linear-gradient(135deg, rgba(207, 102, 121, 0.15) 0%, rgba(207, 102, 121, 0.05) 100%);
    border: 1px solid rgba(207, 102, 121, 0.4);
    border-left: 4px solid #cf6679;
    color: #e0e0e0;
    box-shadow: 0 4px 20px rgba(207, 102, 121, 0.1);
}

.alert-success {
    background: linear-gradient(135deg, rgba(3, 218, 198, 0.15) 0%, rgba(3, 218, 198, 0.05) 100%);
    border: 1px solid rgba(3, 218, 198, 0.4);
    border-left: 4px solid #03dac6;
    color: #e0e0e0;
    box-shadow: 0 4px 20px rgba(3, 218, 198, 0.1);
}

.alert-info {
    background: linear-gradient(135deg, rgba(3, 169, 244, 0.15) 0%, rgba(3, 169, 244, 0.05) 100%);
    border: 1px solid rgba(3, 169, 244, 0.4);
    border-left: 4px solid #03a9f4;
    color: #e0e0e0;
    box-shadow: 0 4px 20px rgba(3, 169, 244, 0.1);
}

.alert .alert-link {
    color: #bb86fc;
    font-weight: 600;
    text-decoration: none;
    border-bottom: 2px solid rgba(187, 134, 252, 0.3);
    transition: all 0.2s ease;
}

.alert .alert-link:hover {
    color: #c99dff;
    border-bottom-color: #bb86fc;
}

.alert-heading {
    color: #fff;
    font-weight: 500;
}

.alert-warning .alert-heading {
    color: #bb86fc;
}

.alert-danger .alert-heading {
    color: #cf6679;
}

.alert-success .alert-heading {
    color: #03dac6;
}

.alert-info .alert-heading {
    color: #03a9f4;
}

/* KaTeX Formula Styling for Dark Theme */
.ql-editor .ql-formula {
    background: rgba(187, 134, 252, 0.1);
    border: 1px solid rgba(187, 134, 252, 0.3);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    display: inline-block;
    margin: 0.25rem;
}

.katex {
    color: #e0e0e0 !important;
}

.katex .katex-html {
    color: #e0e0e0;
}

.ql-snow .ql-picker{
    color: #bc86fc;
}

.ql-font-helvetica {
    font-family: Helvetica, sans-serif !important;
}

.ql-font-arial {
    font-family: Arial, sans-serif !important;
}

.ql-font-sans-serif {
    font-family: sans-serif !important;
}

.ql-font-roboto {
    font-family: 'Roboto', sans-serif !important;
}

.ql-picker.ql-font .ql-picker-label[data-value="helvetica"]::before,
.ql-picker.ql-font .ql-picker-item[data-value="helvetica"]::before {
    content: 'Helvetica' !important;
    font-family: Helvetica, sans-serif !important;
}

.ql-picker.ql-font .ql-picker-label[data-value="arial"]::before,
.ql-picker.ql-font .ql-picker-item[data-value="arial"]::before {
    content: 'Arial' !important;
    font-family: Arial, sans-serif !important;
}

.ql-picker.ql-font .ql-picker-label[data-value="sans-serif"]::before,
.ql-picker.ql-font .ql-picker-item[data-value="sans-serif"]::before {
    content: 'Sans Serif' !important;
    font-family: sans-serif !important;
}

.ql-picker.ql-font .ql-picker-label[data-value="roboto"]::before,
.ql-picker.ql-font .ql-picker-item[data-value="roboto"]::before {
    content: 'Roboto' !important;
    font-family: 'Roboto', sans-serif !important;
}

.ql-picker.ql-font .ql-picker-label:not([data-value])::before {
    content: 'Chọn font' !important;
}

.ql-picker.ql-font .ql-picker-options {
    background: #2d2d2d;
    border-color: rgba(187, 134, 252, 0.3);
}

.ql-picker.ql-font .ql-picker-item {
    color: #e0e0e0;
}

.ql-picker.ql-font .ql-picker-item:hover {
    background: rgba(187, 134, 252, 0.2);
    color: #bb86fc;
}

/* Print protection: hide main content when printing and show warning */
@media print {
    body * {
        visibility: hidden !important;
    }

    body::before {
        content: "In ấn đã bị vô hiệu hóa để bảo vệ nội dung.";
        visibility: visible !important;
        display: block;
        padding: 50px;
        font-size: 20px;
        text-align: center;
    }
}