/* Practice Mode Modal Component (Dashboard) */

/* Modal Container */
#practiceOptionsPanel {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px 0;
}

#practiceOptionsPanel .card {
    max-width: 700px;
    margin: 0 auto;
}

#practiceOptionsPanel .card-body {
    padding: 2rem !important;
}

/* Subject Practice Cards */
.subject-practice-card {
    /* padding: 1.5rem; */
    cursor: pointer;
    transition: all 0.3s ease;
    border-width: 3px;
    position: relative;
    box-shadow: none !important;
    /* Remove Bootstrap's default shadow - NO elevation for unselected */
}

.subject-practice-card:hover {
    /* No hover effects for unselected cards */
}

.subject-practice-card.selected {
    border-color: var(--primary);
    box-shadow: 0 10px 35px rgba(40, 120, 235, 0.6) !important;
    /* STRONG elevation ONLY for selected */
    transform: translateY(-5px);
}

/* Selected card with gradient backgrounds */
.subject-practice-card[data-subject="glossa"].selected {
    background: linear-gradient(180deg, #d4edda 0%, #3ec05c 100%) !important;
    border-color: var(--green);
    box-shadow: 0 10px 35px rgba(40, 167, 69, 0.5) !important;
    /* Green-tinted shadow */
}

.subject-practice-card[data-subject="math"].selected {
    background: linear-gradient(180deg, #d1ecf9 0%, #4892c6 100%) !important;
    border-color: #2878eb;
    box-shadow: 0 10px 35px rgba(40, 120, 235, 0.5) !important;
    /* Blue-tinted shadow */
}

.subject-practice-card.locked-card {
    opacity: 0.6;
    cursor: not-allowed;
}

.subject-practice-card.locked-card:hover {
    transform: none;
    box-shadow: none;
}

.subject-practice-card .lock-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: auto;
    filter: grayscale(100%);
}

/* Questions Count Dropdown - Bigger arrow with padding */
#practiceQuestionsCount {
    background-position: right 1rem center;
    background-size: 20px 20px;
    padding-right: 3rem;
}

/* Start Practice Button */
#startPracticeBtn {
    background-color: white !important;
    color: var(--green) !important;
    border: 2px solid var(--green) !important;
    border-radius: 10px !important;
    font-weight: 600;
    transition: all 0.3s ease;
}

#startPracticeBtn:hover {
    background-color: var(--light) !important;
    box-shadow: 0 4px 12px rgba(40, 120, 235, 0.2);
}

/* Selected Icon (checkmark) */
.subject-practice-card .selected-icon {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 28px;
    color: white;
    z-index: 10;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

/* Subject Practice Buttons (Legacy - if needed) */
.subject-practice-btn {
    font-size: 1.1rem;
    padding: 0.75rem 1.5rem;
    border-width: 2px;
    transition: all 0.3s ease;
}

.subject-practice-btn.active {
    background-color: var(--primary);
    color: white !important;
    border-color: var(--primary);
}

.subject-practice-btn:not(.active) {
    background-color: white;
    color: var(--primary);
    border-color: var(--primary);
}

.subject-practice-btn:hover:not(:disabled) {
    box-shadow: 0 5px 15px rgba(40, 120, 235, 0.3);
}

.subject-practice-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Category Filter Badges Wrapper (for interactive selection) */
/* The .category-badge inside inherits styles from badges.css */
.category-filter-badge {

    display: inline-block;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    /* Wrapper for the actual category-badge - badge styles handled by badges.css */
}

/* NOTE: All badge styling (colors, borders, etc.) is handled by the 
   unified badge component in css/components/badges.css
   Do NOT add badge-specific styles here! */

/* Custom Checkbox for "Select All" */
.custom-control-label {
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
}

/* Category Views - Show/Hide based on screen size */
.categories-desktop-view {
    display: block;
}

.categories-mobile-view {
    display: none !important;
}

/* Categories Selection Modal */
#categoriesSelectionModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(18, 15, 45, 0.8);
    z-index: 1050;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#categoriesSelectionModal.show {
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
}

.modal-content-wrapper {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 0 15px;
}

#categoriesSelectionModal .card {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    z-index: 1051;
    border-radius: 10px;
    overflow: hidden;
}

/* ========================================
   RESPONSIVE DESIGN - MEDIA QUERIES
   ======================================== */

/* Tablet and below (992px) */
@media (max-width: 992px) {
    .subject-practice-card {
        margin-bottom: 15px;
    }

    .subject-practice-btn {
        font-size: 1rem;
        padding: 0.6rem 1.2rem;
    }
}

/* Mobile (768px and below) */
@media (max-width: 768px) {

    /* Fix modal centering on mobile */
    #practiceOptionsPanel {
        min-height: auto;
        padding: 10px 0;
        width: 100%;
        margin-left: 0 !important;
        margin-right: 0 !important;
        justify-content: center;
    }

    #practiceOptionsPanel>div {
        width: 100%;
        padding-left: 0 !important;
        padding-right: 0 !important;
        max-width: calc(100% - 10px);
        margin-left: 15px;
        margin-right: 15px;
    }

    /* Reduce modal content padding to minimum */
    #practiceOptionsPanel .card-body {
        padding: 5px !important;
    }

    #practiceOptionsPanel .card-header {
        padding: 10px 10px !important;
    }

    #practiceOptionsPanel .card-header h4 {
        font-size: 1.2rem;
        margin-bottom: 0;
    }

    /* Make subject cards smaller and side by side */
    #practiceOptionsPanel .row.justify-content-center.mb-4 {
        margin-left: 0;
        margin-right: 0;
    }

    #practiceOptionsPanel .row.justify-content-center.mb-4>div {
        flex: 0 0 50%;
        max-width: 50%;
        padding-left: 5px;
        padding-right: 5px;
    }

    /* Make subject cards compact with minimum width/height */
    .subject-practice-card {
        margin-bottom: 5px;
        min-height: 110px;
    }

    .subject-practice-card .card-body {
        padding: 0.75rem 0.25rem !important;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }

    .subject-practice-card h5 {
        font-size: 0.85rem;
        margin-bottom: 0;
    }

    /* Keep icon size OK (50px for side-by-side layout) */
    .subject-practice-card .test-icon {
        margin-bottom: 0.5rem !important;
    }

    .subject-practice-card .test-icon img {
        width: 40% !important;
    }

    /* Lock/Selected icons - slightly smaller */
    .subject-practice-card .lock-icon {
        width: 30px;
        top: 5px;
        right: 5px;
    }

    .subject-practice-card .selected-icon {
        font-size: 22px;
        top: 5px;
        right: 5px;
    }

    /* Compact sections */
    #practiceOptionsPanel .mb-4 {
        margin-bottom: 1rem !important;
    }

    #practiceOptionsPanel p.text-muted {
        font-size: 0.85rem;
        margin-bottom: 1rem !important;
        padding: 0 0.5rem;
    }

    #practiceOptionsPanel h4.text-center {
        font-size: 1.1rem;
        margin-bottom: 1rem !important;
    }

    /* Category badges */
    .category-filter-badge {
        font-size: 0.85rem;
        padding: 6px 12px;
        margin: 4px;
    }

    /* Questions count dropdown */
    #practiceQuestionsCount {
        padding: 0.5rem 2.5rem 0.5rem 0.75rem;
        font-size: 0.9rem;
    }

    /* Start button */
    #startPracticeBtn {
        padding: 0.75rem !important;
        font-size: 1rem;
    }

    /* Close button in header */
    .card-header .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }

    /* Switch to mobile category view */
    .categories-desktop-view {
        display: none !important;
    }

    .categories-mobile-view {
        display: block !important;
    }

    /* Categories dropdown button styling */
    .categories-dropdown-btn {
        background-color: white !important;
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
        line-height: 1.5;
        height: auto;
        cursor: pointer;
        border: 1px solid #ced4da !important;
        border-radius: 0.3rem;
        position: relative;
        display: flex;
        align-items: center;
        justify-content: space-between;
        text-align: left;
        transition: all 0.3s ease;
    }

    .categories-dropdown-btn:hover:not(:disabled) {
        background-color: #f8f9fa !important;
        border-color: #adb5bd !important;
    }

    .categories-dropdown-btn:disabled {
        background-color: #e9ecef !important;
        cursor: not-allowed;
        opacity: 0.65;
    }

    .categories-dropdown-btn .dropdown-text {
        flex: 1;
        color: #495057;
    }

    .categories-dropdown-btn:disabled .dropdown-text {
        color: #6c757d;
    }

    .categories-dropdown-btn .fa-chevron-down {
        color: #6c757d;
        font-size: 0.85rem;
    }

    /* Categories Modal Mobile Adjustments */
    #categoriesSelectionModal.show {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        padding: 0px;
    }

    .modal-content-wrapper {
        padding: 0;
        width: calc(100%);
        max-width: 600px;
        margin: 0 auto;
        display: flex;
        justify-content: center;
    }

    #categoriesSelectionModal .card {
        width: 100%;
    }

    #categoriesSelectionModal .card-body {
        padding: 3px 0 !important;
        max-height: calc(100vh - 150px);
        overflow-y: auto;
    }

    #categoriesSelectionModal .card-header {
        padding: 8px 3px !important;
    }

    #categoriesSelectionModal .card-header h4 {
        font-size: 1rem;
        padding: 0 2px;
    }

    #categoriesSelectionModal p.text-muted {
        padding: 0 3px !important;
        margin-bottom: 0.5rem !important;
        font-size: 0.8rem !important;
    }

    #categoriesSelectionModal .custom-control {
        padding-left: 5px !important;
        padding-right: 5px !important;
        margin-bottom: 0.5rem !important;
        margin-left: 1.5rem !important;
    }

    #categoriesSelectionModal .custom-control-label {
        font-size: 0.9rem !important;
        font-weight: 600 !important;
    }

    #categoriesSelectionModal hr {
        margin: 0.5rem 0 !important;
    }

    #categoriesSelectionModal .mt-4 {
        margin-top: 0.75rem !important;
        padding: 0 3px !important;
    }

    #modalCategoriesList {
        gap: 2px !important;
        row-gap: 2px !important;
        column-gap: 2px !important;
        padding: 0 2px !important;
        margin: 0 !important;
    }

    #modalCategoriesList .category-filter-badge {
        font-size: 0.75rem;
        margin: 0px !important;
    }

    /* Make both selected and unselected badges the same size */
    #modalCategoriesList .category-badge {
        padding: 3px 6px !important;
        font-size: 0.7rem !important;
        min-height: 24px;
        display: inline-flex;
        align-items: center;
    }

    #modalCategoriesList .category-badge i {
        font-size: 0.65rem !important;
        margin-right: 3px !important;
    }

    /* Apply Button styling for mobile */
    #categoriesSelectionModal .btn-primary {
        width: 80%;
        background: white;
        color: var(--primary) !important;
        border: 2px solid var(--primary) !important;
        padding: 0.55rem 1rem !important;
        font-size: 0.95rem !important;
        font-weight: 600 !important;
        border-radius: 8px !important;
        margin: 0px auto 5px auto;
    }
}