/**
 * Category Landing Page Styles
 *
 * Displays practice mode options when user selects a category
 * Uses design tokens from variables.css for consistency
 */

/* Container */
.category-landing {
    margin: 0 auto;
    padding: 0 1rem 1rem 1rem;
    position: relative;
    z-index: 1;
}

.category-landing--loading,
.category-landing--error {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

/* Header - at practice-app-container level */
.practice-header {
    position: sticky;
    position: -webkit-sticky;
    top: 60px;
    z-index: 100;
    background: transparent;
    margin-bottom: 0;
}

/* Header Card */
.category-landing__header-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
    overflow: hidden;
}

.category-landing__title {
    margin: 0;
    padding: 1rem 1.5rem;
    font-size: 1.5rem;
    color: var(--color-primary, #368BC1);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    border-bottom: 1px solid var(--color-gray-200, #e9ecef);
}

.category-landing__title svg {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    stroke: var(--color-primary, #368BC1);
}

/* Progress section inside card */
.category-landing__progress {
    padding: 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.category-landing__progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.category-landing__progress-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-primary, #212529);
}

.category-landing__progress-text {
    font-size: 0.875rem;
    color: var(--color-text-secondary, #6c757d);
}

.category-landing__progress-bar {
    width: 100%;
    height: 8px;
    background: var(--color-gray-200, #e9ecef);
    border-radius: var(--radius-sm, 4px);
    overflow: hidden;
}

.category-landing__progress-fill {
    height: 100%;
    background: var(--color-primary, #368BC1);
    border-radius: var(--radius-sm, 4px);
    transition: width 0.3s ease;
}

/* Section header */
.category-landing__section-header {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
}

.category-landing__section-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-primary, #368BC1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.category-landing__section-title svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    stroke: var(--color-primary, #368BC1);
}

/* Mode cards grid - 2 columns */
.category-landing__modes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

/* Individual mode card */
.category-landing__mode-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--color-bg-card, #ffffff);
    border: 2px solid var(--color-gray-200, #e9ecef);
    border-radius: var(--radius-lg, 8px);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.1));
}

.category-landing__mode-card:hover:not(.category-landing__mode-card--disabled) {
    border-color: var(--color-primary, #368BC1);
    box-shadow: var(--shadow-lg, 0 4px 12px rgba(0, 0, 0, 0.1));
    transform: translateY(-2px);
}

.category-landing__mode-card:active:not(.category-landing__mode-card--disabled) {
    transform: translateY(0);
}

/* Primary card (Continue/All Questions) */
.category-landing__mode-card--primary {
    background: var(--color-primary, #368BC1);
    border-color: var(--color-primary, #368BC1);
    color: var(--color-white, #ffffff);
}

.category-landing__mode-card--primary:hover:not(.category-landing__mode-card--disabled) {
    background: var(--color-primary-hover, #2c6a96);
    border-color: var(--color-primary-hover, #2c6a96);
    box-shadow: var(--shadow-primary, 0 4px 12px rgba(54, 139, 193, 0.3));
}

.category-landing__mode-card--primary .category-landing__mode-label,
.category-landing__mode-card--primary .category-landing__mode-description,
.category-landing__mode-card--primary .category-landing__mode-count {
    color: var(--color-white, #ffffff);
}

.category-landing__mode-card--primary .category-landing__mode-description {
    opacity: 0.9;
}

.category-landing__mode-card--primary .category-landing__mode-count {
    background: rgba(255, 255, 255, 0.2);
    color: var(--color-white, #ffffff);
}

.category-landing__mode-card--primary .category-landing__mode-icon {
    background: rgba(255, 255, 255, 0.2);
}

.category-landing__mode-card--primary .category-landing__mode-icon svg {
    stroke: var(--color-white, #ffffff);
}

.category-landing__mode-card--primary .category-landing__mode-btn {
    background: rgba(255, 255, 255, 0.2);
    color: var(--color-white, #ffffff);
    border-color: rgba(255, 255, 255, 0.3);
}

.category-landing__mode-card--primary .category-landing__mode-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Disabled card */
.category-landing__mode-card--disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.category-landing__mode-card--disabled:hover {
    transform: none;
    box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.1));
    border-color: var(--color-gray-200, #e9ecef);
}

/* Loading state */
.category-landing__mode-card--loading {
    pointer-events: none;
    opacity: 0.7;
}

/* Icon */
.category-landing__mode-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary-light, #e8f4fc);
    border-radius: var(--radius-lg, 8px);
}

.category-landing__mode-icon svg {
    stroke: white;
}

/* Content */
.category-landing__mode-content {
    flex: 1;
    min-width: 0;
}

.category-landing__mode-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-text-primary, #212529);
    margin: 0 0 0.25rem 0;
}

.category-landing__mode-description {
    font-size: 0.875rem;
    color: var(--color-text-secondary, #6c757d);
    margin: 0 0 0.5rem 0;
    line-height: 1.4;
}

.category-landing__mode-count {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-primary, #368BC1);
    background: var(--color-primary-light, #e8f4fc);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm, 4px);
}

/* Button */
.category-landing__mode-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: var(--color-primary, #368BC1);
    border: none;
    border-radius: var(--radius-md, 6px);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-white, #ffffff);
    cursor: pointer;
    transition: all 0.15s ease;
}

.category-landing__mode-btn:hover:not(:disabled) {
    background: var(--color-primary-hover, #2c6a96);
}

.category-landing__mode-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.category-landing__mode-btn svg {
    flex-shrink: 0;
}

/* Spinner in button */
.category-landing__mode-btn .btn-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Error state */
.error-message {
    text-align: center;
    padding: 2rem;
}

.error-message svg {
    stroke: var(--color-danger, #dc3545);
    margin-bottom: 1rem;
}

.error-message h3 {
    font-size: 1.25rem;
    color: var(--color-text-primary, #212529);
    margin: 0 0 0.5rem 0;
}

.error-message p {
    color: var(--color-text-secondary, #6c757d);
    margin: 0 0 1.5rem 0;
}

/* Responsive */
@media (max-width: 640px) {
    /* Ensure landing page displays properly on mobile (not affected by carousel styles) */
    .category-landing {
        padding: 0 0.75rem 1rem 0.75rem;
        position: relative !important;
        display: block !important;
        opacity: 1 !important;
        pointer-events: auto !important;
        transform: none !important;
    }

    .category-landing--loading {
        display: flex !important;
    }

    .practice-header {
        padding: 0.75rem;
    }

    .category-landing__title {
        font-size: 1.25rem;
        padding: 0.875rem 1rem;
        gap: 0.5rem;
    }

    .category-landing__title svg {
        width: 24px;
        height: 24px;
    }

    .category-landing__progress {
        padding: 0.875rem 1rem;
    }

    .category-landing__section-header {
        padding: 0.875rem 1rem;
    }

    .category-landing__section-title {
        font-size: 1.1rem;
        gap: 0.5rem;
    }

    .category-landing__section-title svg {
        width: 20px;
        height: 20px;
    }

    .category-landing__modes {
        grid-template-columns: 1fr;
    }

    .category-landing__mode-card {
        flex-wrap: wrap;
        padding: 1rem;
    }

    .category-landing__mode-icon {
        width: 40px;
        height: 40px;
    }

    .category-landing__mode-icon svg {
        width: 24px;
        height: 24px;
    }

    .category-landing__mode-content {
        flex: 1;
        min-width: calc(100% - 56px - 1rem);
    }

    .category-landing__mode-btn {
        width: 100%;
        justify-content: center;
        margin-top: 0.5rem;
    }

    .category-landing__mode-description {
        display: none;
    }
}

/* =====================================================
   Subcategory Cards (Topic Browser)
   ===================================================== */

/* Section header for topics */
.category-landing__section-header--topics {
    margin-top: 1rem;
    border-top: 1px solid var(--color-gray-200, #e9ecef);
}

/* Subcategories grid */
.category-landing__subcategories {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-top: 0.5rem;
}

/* Individual subcategory card */
.category-landing__subcategory-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 0.75rem;
    background: white;
    border: 1px solid var(--color-gray-200, #e9ecef);
    border-radius: var(--radius-md, 6px);
    text-decoration: none;
    color: var(--color-text-primary, #212529);
    transition: all 0.2s ease;
    cursor: pointer;
    min-height: 80px;
}

.category-landing__subcategory-card:hover {
    border-color: var(--color-primary, #368BC1);
    background: var(--color-primary-light, #e8f4fc);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(54, 139, 193, 0.15);
}

.category-landing__subcategory-card:active {
    transform: translateY(0);
}

/* Subcategory icon */
.category-landing__subcategory-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--color-primary-light, #e8f4fc);
    border-radius: var(--radius-sm, 4px);
    color: var(--color-primary, #368BC1);
}

.category-landing__subcategory-card:hover .category-landing__subcategory-icon {
    background: var(--color-primary, #368BC1);
    color: white;
}

.category-landing__subcategory-icon svg {
    stroke: currentColor;
}

/* Subcategory name */
.category-landing__subcategory-name {
    font-size: 0.8rem;
    font-weight: 500;
    text-align: center;
    line-height: 1.3;
    color: var(--color-text-secondary, #6c757d);
}

.category-landing__subcategory-card:hover .category-landing__subcategory-name {
    color: var(--color-primary, #368BC1);
}

/* Responsive - mobile */
@media (max-width: 640px) {
    .category-landing__section-header--topics {
        margin-top: 1rem;
        padding-top: 1rem;
    }

    .category-landing__subcategories {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }

    .category-landing__subcategory-card {
        padding: 0.75rem 0.5rem;
        min-height: 70px;
    }

    .category-landing__subcategory-icon {
        width: 32px;
        height: 32px;
    }

    .category-landing__subcategory-icon svg {
        width: 18px;
        height: 18px;
    }

    .category-landing__subcategory-name {
        font-size: 0.7rem;
    }
}

/* =====================================================
   DARK MODE STYLES
   ===================================================== */

/* Force dark mode */
html.dark-mode .category-landing {
    background: transparent !important;
}

/* Header Card */
html.dark-mode .category-landing__header-card {
    background: #1a1d23 !important;
    border-color: #363c47 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}

html.dark-mode .category-landing__title {
    color: #4a9ed4 !important;
    border-bottom-color: #363c47 !important;
}

html.dark-mode .category-landing__title svg {
    stroke: #4a9ed4 !important;
}

/* Progress section */
html.dark-mode .category-landing__progress {
    background: transparent !important;
}

html.dark-mode .category-landing__progress-label {
    color: #f3f4f6 !important;
}

html.dark-mode .category-landing__progress-text {
    color: #9ca3af !important;
}

html.dark-mode .category-landing__progress-bar {
    background: #363c47 !important;
}

html.dark-mode .category-landing__progress-fill {
    background: #4a9ed4 !important;
}

/* Section header */
html.dark-mode .category-landing__section-header {
    background: #1a1d23 !important;
    border-color: #363c47 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}

html.dark-mode .category-landing__section-header--topics {
    border-top-color: #363c47 !important;
}

html.dark-mode .category-landing__section-title {
    color: #4a9ed4 !important;
}

html.dark-mode .category-landing__section-title svg {
    stroke: #4a9ed4 !important;
}

/* Mode cards */
html.dark-mode .category-landing__mode-card {
    background: #1a1d23 !important;
    border-color: #363c47 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}

html.dark-mode .category-landing__mode-card:hover:not(.category-landing__mode-card--disabled) {
    border-color: #4a9ed4 !important;
    box-shadow: 0 4px 12px rgba(74, 158, 212, 0.2) !important;
}

/* Primary card (Continue/All Questions) */
html.dark-mode .category-landing__mode-card--primary {
    background: #2d8bc9 !important;
    border-color: #5bb8e8 !important;
    box-shadow: 0 0 15px rgba(91, 184, 232, 0.35) !important;
}

html.dark-mode .category-landing__mode-card--primary:hover:not(.category-landing__mode-card--disabled) {
    background: #3498db !important;
    border-color: #7cc8f0 !important;
    box-shadow: 0 0 20px rgba(91, 184, 232, 0.5) !important;
}

/* Disabled card */
html.dark-mode .category-landing__mode-card--disabled {
    opacity: 0.4 !important;
}

/* Mode icon */
html.dark-mode .category-landing__mode-icon {
    background: #22262e !important;
}

html.dark-mode .category-landing__mode-icon svg {
    stroke: #4a9ed4 !important;
}

/* Mode content */
html.dark-mode .category-landing__mode-label {
    color: #f3f4f6 !important;
}

html.dark-mode .category-landing__mode-description {
    color: #9ca3af !important;
}

html.dark-mode .category-landing__mode-card--primary .category-landing__mode-description {
    color: rgba(255, 255, 255, 0.85) !important;
}

html.dark-mode .category-landing__mode-count {
    background: #22262e !important;
    color: #4a9ed4 !important;
}

/* Mode button */
html.dark-mode .category-landing__mode-btn {
    background: #4a9ed4 !important;
    color: #ffffff !important;
}

html.dark-mode .category-landing__mode-btn:hover:not(:disabled) {
    background: #5aa8dc !important;
}

/* Error message */
html.dark-mode .error-message h3 {
    color: #f3f4f6 !important;
}

html.dark-mode .error-message p {
    color: #9ca3af !important;
}

html.dark-mode .error-message svg {
    stroke: #f87171 !important;
}

/* Subcategory cards */
html.dark-mode .category-landing__subcategory-card {
    background: #1a1d23 !important;
    border-color: #363c47 !important;
    color: #f3f4f6 !important;
}

html.dark-mode .category-landing__subcategory-card:hover {
    border-color: #4a9ed4 !important;
    background: #22262e !important;
    box-shadow: 0 4px 12px rgba(74, 158, 212, 0.2) !important;
}

html.dark-mode .category-landing__subcategory-icon {
    background: #22262e !important;
    color: #4a9ed4 !important;
}

html.dark-mode .category-landing__subcategory-card:hover .category-landing__subcategory-icon {
    background: #4a9ed4 !important;
    color: #ffffff !important;
}

html.dark-mode .category-landing__subcategory-name {
    color: #9ca3af !important;
}

html.dark-mode .category-landing__subcategory-card:hover .category-landing__subcategory-name {
    color: #4a9ed4 !important;
}

/* =====================================================
   AUTO DARK MODE (System Preference)
   ===================================================== */

@media (prefers-color-scheme: dark) {
    html.dark-mode-auto .category-landing {
        background: transparent !important;
    }

    /* Header Card */
    html.dark-mode-auto .category-landing__header-card {
        background: #1a1d23 !important;
        border-color: #363c47 !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
    }

    html.dark-mode-auto .category-landing__title {
        color: #4a9ed4 !important;
        border-bottom-color: #363c47 !important;
    }

    html.dark-mode-auto .category-landing__title svg {
        stroke: #4a9ed4 !important;
    }

    /* Progress section */
    html.dark-mode-auto .category-landing__progress {
        background: transparent !important;
    }

    html.dark-mode-auto .category-landing__progress-label {
        color: #f3f4f6 !important;
    }

    html.dark-mode-auto .category-landing__progress-text {
        color: #9ca3af !important;
    }

    html.dark-mode-auto .category-landing__progress-bar {
        background: #363c47 !important;
    }

    html.dark-mode-auto .category-landing__progress-fill {
        background: #4a9ed4 !important;
    }

    /* Section header */
    html.dark-mode-auto .category-landing__section-header {
        background: #1a1d23 !important;
        border-color: #363c47 !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
    }

    html.dark-mode-auto .category-landing__section-header--topics {
        border-top-color: #363c47 !important;
    }

    html.dark-mode-auto .category-landing__section-title {
        color: #4a9ed4 !important;
    }

    html.dark-mode-auto .category-landing__section-title svg {
        stroke: #4a9ed4 !important;
    }

    /* Mode cards */
    html.dark-mode-auto .category-landing__mode-card {
        background: #1a1d23 !important;
        border-color: #363c47 !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
    }

    html.dark-mode-auto .category-landing__mode-card:hover:not(.category-landing__mode-card--disabled) {
        border-color: #4a9ed4 !important;
        box-shadow: 0 4px 12px rgba(74, 158, 212, 0.2) !important;
    }

    /* Primary card */
    html.dark-mode-auto .category-landing__mode-card--primary {
        background: #2d8bc9 !important;
        border-color: #5bb8e8 !important;
        box-shadow: 0 0 15px rgba(91, 184, 232, 0.35) !important;
    }

    html.dark-mode-auto .category-landing__mode-card--primary:hover:not(.category-landing__mode-card--disabled) {
        background: #3498db !important;
        border-color: #7cc8f0 !important;
        box-shadow: 0 0 20px rgba(91, 184, 232, 0.5) !important;
    }

    /* Disabled card */
    html.dark-mode-auto .category-landing__mode-card--disabled {
        opacity: 0.4 !important;
    }

    /* Mode icon */
    html.dark-mode-auto .category-landing__mode-icon {
        background: #22262e !important;
    }

    html.dark-mode-auto .category-landing__mode-icon svg {
        stroke: #4a9ed4 !important;
    }

    /* Mode content */
    html.dark-mode-auto .category-landing__mode-label {
        color: #f3f4f6 !important;
    }

    html.dark-mode-auto .category-landing__mode-description {
        color: #9ca3af !important;
    }

    html.dark-mode-auto .category-landing__mode-card--primary .category-landing__mode-description {
        color: rgba(255, 255, 255, 0.85) !important;
    }

    html.dark-mode-auto .category-landing__mode-count {
        background: #22262e !important;
        color: #4a9ed4 !important;
    }

    /* Mode button */
    html.dark-mode-auto .category-landing__mode-btn {
        background: #4a9ed4 !important;
        color: #ffffff !important;
    }

    html.dark-mode-auto .category-landing__mode-btn:hover:not(:disabled) {
        background: #5aa8dc !important;
    }

    /* Error message */
    html.dark-mode-auto .error-message h3 {
        color: #f3f4f6 !important;
    }

    html.dark-mode-auto .error-message p {
        color: #9ca3af !important;
    }

    html.dark-mode-auto .error-message svg {
        stroke: #f87171 !important;
    }

    /* Subcategory cards */
    html.dark-mode-auto .category-landing__subcategory-card {
        background: #1a1d23 !important;
        border-color: #363c47 !important;
        color: #f3f4f6 !important;
    }

    html.dark-mode-auto .category-landing__subcategory-card:hover {
        border-color: #4a9ed4 !important;
        background: #22262e !important;
        box-shadow: 0 4px 12px rgba(74, 158, 212, 0.2) !important;
    }

    html.dark-mode-auto .category-landing__subcategory-icon {
        background: #22262e !important;
        color: #4a9ed4 !important;
    }

    html.dark-mode-auto .category-landing__subcategory-card:hover .category-landing__subcategory-icon {
        background: #4a9ed4 !important;
        color: #ffffff !important;
    }

    html.dark-mode-auto .category-landing__subcategory-name {
        color: #9ca3af !important;
    }

    html.dark-mode-auto .category-landing__subcategory-card:hover .category-landing__subcategory-name {
        color: #4a9ed4 !important;
    }
}
