/* Problem Solving Shared Styles */

.problem-solving-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem 1rem 2rem 1rem;
    background-color: #ffffff;
}

/* Back Button - Uses standardized style from styles.css */

/* Top Navigation Bar */
.ps-top-nav-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    width: 100%;
}

.ps-top-nav-bar .back-button {
    margin-bottom: 0;
}

.ps-top-nav-bar .ps-how-to-use-link {
    margin-bottom: 0;
    margin-left: auto;
}

.ps-how-to-use-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #2563eb;
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    font-family: 'Roboto', sans-serif;
    padding: 0.5rem 0.75rem;
    margin-left: -0.75rem;
    margin-right: -0.75rem;
    transition: all 0.2s;
    border-radius: 0.375rem;
}

.ps-how-to-use-link:hover {
    color: #1d4ed8;
    background-color: #eff6ff;
}

/* Page Header - Blue Box Style (default for secondary) */
.page-header-section {

    border-radius: 1.25rem;
    padding: 1.25rem 2.25rem;
    margin-bottom: 1.5rem;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08), 0 1px 4px rgba(0, 0, 0, 0.05);
    box-sizing: border-box;
    width: 100%;
    overflow: hidden;
    border: none;
    min-height: 80px;
}

/* Page Header - Green Box Style (for primary pages) */
.page-header-section.primary-level {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.page-header-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        /* Decorative shapes */
        radial-gradient(circle at 15% 25%, rgba(59, 130, 246, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 85% 75%, rgba(147, 197, 253, 0.1) 0%, transparent 45%),
        radial-gradient(circle at 50% 10%, rgba(191, 219, 254, 0.06) 0%, transparent 35%),
        /* Grid pattern */
        repeating-linear-gradient(0deg, rgba(59, 130, 246, 0.05) 0px, rgba(59, 130, 246, 0.05) 1px, transparent 1px, transparent 20px),
        repeating-linear-gradient(90deg, rgba(59, 130, 246, 0.05) 0px, rgba(59, 130, 246, 0.05) 1px, transparent 1px, transparent 20px);
}

.page-header-section.primary-level::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        /* Decorative shapes */
        radial-gradient(circle at 15% 25%, rgba(16, 185, 129, 0.08) 0%, transparent 40%),
        radial-gradient(circle at 85% 75%, rgba(110, 231, 183, 0.1) 0%, transparent 45%),
        radial-gradient(circle at 50% 10%, rgba(187, 247, 208, 0.06) 0%, transparent 35%),
        /* Grid pattern */
        repeating-linear-gradient(0deg, rgba(16, 185, 129, 0.05) 0px, rgba(16, 185, 129, 0.05) 1px, transparent 1px, transparent 20px),
        repeating-linear-gradient(90deg, rgba(16, 185, 129, 0.05) 0px, rgba(16, 185, 129, 0.05) 1px, transparent 1px, transparent 20px);
    background-size: 
        auto,
        auto,
        auto,
        20px 20px,
        20px 20px;
    background-position: 
        15% 25%,
        85% 75%,
        50% 10%,
        0 0,
        0 0;
    background-repeat: 
        no-repeat,
        no-repeat,
        no-repeat,
        repeat,
        repeat;
    pointer-events: none;
    border-radius: 1.25rem;
    opacity: 0.8;
}

.page-title-row {
    width: 100%;
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
}

.page-header-content {
    position: relative;
    z-index: 2;
    flex: 1;
    min-width: 0;
    max-width: 60%;
    padding-right: 2.5rem;
}

.page-header-text {
    flex: 1;
    min-width: 0;
}

.page-header-image {
    position: absolute;
    right: 2%;
    top: 150%;
    transform: translateY(-50%);
    height: 280%;
    width: auto;
    max-width: 80%;
    opacity: 1;
    z-index: 1;
    pointer-events: none;
    filter: drop-shadow(16px 16px 0 rgba(0, 0, 0, 0.25));
}

@media (max-width: 1200px) {
    .page-header-image {
        height: 300%;
        max-width: 70%;
        top: 150%;
    }
}

@media (max-width: 1024px) {
    .page-header-image {
        height: 250%;
        max-width: 60%;
        top: 150%;
    }
    
    .page-header-content {
        max-width: 60%;
    }
}

@media (max-width: 900px) {
    .page-header-image {
        height: 200%;
        max-width: 50%;
        top: 150%;
    }
    
    .page-header-content {
        max-width: 65%;
    }
}

@media (max-width: 768px) {
    .page-header-image {
        height: 180%;
        max-width: 40%;
        top: 150%;
    }
    
    .page-header-content {
        max-width: 70%;
    }
}

@media (max-width: 767px) {
    .page-header-image {
        display: none;
    }
    
    .page-title-row {
        justify-content: flex-start;
    }
    
    .page-header-content {
        max-width: 100% !important;
        padding-right: 0 !important;
        flex: 1 1 100%;
    }
}

.page-title {
    font-size: 3.5rem !important;
    font-weight: 800 !important;
    color: #ffffff !important;
    margin: 0 !important;
    font-family: 'Roboto', sans-serif;
    text-shadow: none;
    line-height: 1.1;
    letter-spacing: -0.03em;
    position: relative;
    padding-top: 0;
}

.page-title::after {
    display: none;
}

.page-subtitle {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.95);
    line-height: 1.5;
    margin: 0;
    font-family: 'Roboto', sans-serif;
    max-width: 800px;
}

@media (min-width: 768px) {
    .page-header-section {
        padding: 1.25rem 2.25rem;
    }
    
    .page-title {
        font-size: 3.5rem !important;
    }
    
    .page-subtitle {
        font-size: 1rem;
    }
}

/* Type Selector (Secondary/A Level) */
.type-selector-wrapper {
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.type-selector-label {
    font-size: 0.9375rem;
    font-weight: 500;
    color: #374151;
    font-family: 'Roboto', sans-serif;
}

.type-selector-dropdown {
    position: relative;
}

.type-selector-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background-color: #ffffff;
    color: #4b5563;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: 'Roboto', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.type-selector-btn:hover {
    background-color: #f9fafb;
    border-color: #9ca3af;
}

.type-selector-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    min-width: 200px;
    z-index: 1000;
    display: none;
    flex-direction: column;
    padding: 0.5rem;
}

.type-selector-dropdown.active .type-selector-menu {
    display: flex;
}

.type-selector-item {
    padding: 0.625rem 0.75rem;
    background-color: transparent;
    color: #374151;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: 'Roboto', sans-serif;
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
}

.type-selector-item:hover {
    background-color: #f3f4f6;
    color: #111827;
}

.type-selector-item.active {
    background-color: #dbeafe;
    color: #2563eb;
}

/* Year Tabs (Primary) - Button Style */
.year-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0;
    border-bottom: none;
    align-items: flex-end;
    justify-content: space-between;
    padding-bottom: 0;
}

.year-tabs-container {
    display: flex;
    gap: 0.5rem;
}

.year-tab {
    padding: 0.625rem 1.25rem;
    background-color: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Roboto', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.year-tab:hover {
    background-color: #e5e7eb;
    border-color: #9ca3af;
    color: #111827;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.year-tab.active {
    background-color: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.3);
    border-bottom: 1px solid #2563eb;
    margin-bottom: 0;
}

.year-tab.active:hover {
    background-color: #1d4ed8;
    border-color: #1d4ed8;
    transform: translateY(-1px);
}

/* Search Container */
.ps-search-container {
    display: flex;
    align-items: center;
    margin-left: auto;
    padding-bottom: 0;
    margin-bottom: -2px;
    position: relative;
    background-color: #ffffff;
    border: 1px solid #9ca3af;
    border-radius: 0.375rem;
    padding: 0.5rem;
    gap: 0.5rem;
    width: 250px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ps-search-container:focus-within {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.ps-search-icon {
    color: #9ca3af;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.ps-search-input {
    padding: 0;
    font-size: 0.875rem;
    border: none;
    background-color: transparent;
    flex: 1;
    min-width: 0;
    outline: none;
    color: #111827;
    font-family: 'Roboto', sans-serif;
}

.ps-search-input:focus {
    outline: none;
}

.ps-search-input::placeholder {
    color: #9ca3af;
}

.ps-search-clear-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    padding: 0.25rem;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    transition: color 0.2s ease;
}

.ps-search-clear-btn:hover {
    color: #374151;
}

/* Search Results Styling */
.ps-search-topic-section {
    margin-bottom: 2rem;
}

.ps-search-topic-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
    margin: 0 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e5e7eb;
    font-family: 'Roboto', sans-serif;
}

/* Type Toggle (in sidebar) */
.type-toggle-wrapper {
    width: 100%;
    margin-bottom: 1.5rem;
}

.type-toggle {
    display: flex;
    flex-direction: row;
    gap: 0;
    flex-wrap: nowrap;
    background: #f3f4f6;
    border-radius: 0.5rem;
    padding: 0.25rem;
    border: 1px solid #e5e7eb;
    width: 100%;
}

.type-toggle-btn {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    border-radius: 0.375rem;
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: 'Roboto', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.type-toggle-btn.active {
    background: white;
    color: #111827;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.type-toggle-btn.active:hover {
    background: white;
    color: #111827;
}

.type-toggle-btn:hover:not(.active) {
    color: #374151;
}

/* How to Use Modal */
.ps-topic-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.ps-topic-modal.active {
    display: flex;
}

.ps-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.ps-modal-content {
    position: relative;
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1001;
}

.ps-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 1.5rem 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.ps-modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
    font-family: 'Roboto', sans-serif;
}

.ps-modal-close {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: #6b7280;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ps-modal-close:hover {
    color: #111827;
}

.ps-how-to-use-content {
    padding: 1.5rem;
    font-family: 'Roboto', sans-serif;
}

.ps-how-to-use-content p {
    font-size: 1rem;
    color: #374151;
    line-height: 1.6;
    margin: 0 0 1rem 0;
}

.ps-how-to-use-content p:last-child {
    margin-bottom: 0;
}

/* How to Use Button */
.how-to-use-btn {
    padding: 0.75rem 1.5rem;
    background-color: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: 'Roboto', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 0.5rem;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.how-to-use-btn:hover {
    background-color: #1d4ed8;
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.3);
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal {
    background-color: #ffffff;
    border-radius: 0.75rem;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    font-family: 'Roboto', sans-serif;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: #111827;
}

.modal-content {
    color: #374151;
    font-size: 1rem;
    line-height: 1.6;
    font-family: 'Roboto', sans-serif;
}

.modal-content p {
    margin: 0 0 1rem 0;
}

.modal-content ul {
    margin: 0 0 1rem 0;
    padding-left: 1.5rem;
}

.modal-content li {
    margin-bottom: 0.5rem;
}

/* Content Wrapper */
.content-wrapper {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    margin-top: 0;
    padding-top: 1rem;
}

/* Primary Problem Solving - Override secondary-skillschecks.css margin-top */
.primary-page .problem-solving-container .content-wrapper,
body.primary-problem-solving-page .content-wrapper {
    margin-top: 0 !important;
}

/* Sidebar dropdown wrapper - desktop: trigger hidden, panel visible */
.ps-sidebar-dropdown-wrapper {
    position: relative;
    flex-shrink: 0;
}

.ps-sidebar-dropdown-trigger {
    display: none;
}

/* Topic Sidebar (Primary) */
.content-wrapper .topic-sidebar,
.content-wrapper .category-sidebar,
.content-wrapper .difficulty-sidebar {
    flex-shrink: 0 !important;
    width: 250px !important;
    max-width: 250px !important;
    min-width: 250px !important;
    background-color: #ffffff;
}

/* Mobile: sidebar becomes dropdown */
@media (max-width: 1024px) {
    .ps-sidebar-dropdown-wrapper {
        width: 100%;
        flex-shrink: 0;
        margin-top: 1rem;
        margin-bottom: 1rem;
    }

    .ps-sidebar-dropdown-trigger {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 0.75rem 1rem;
        background-color: #ffffff;
        border: 1px solid #9ca3af;
        border-radius: 0.5rem;
        font-size: 0.9375rem;
        font-weight: 500;
        color: #374151;
        cursor: pointer;
        font-family: 'Roboto', sans-serif;
        text-align: left;
        transition: border-color 0.2s, box-shadow 0.2s;
    }

    .ps-sidebar-dropdown-trigger:hover {
        border-color: #6b7280;
    }

    .ps-sidebar-dropdown-trigger[aria-expanded="true"] {
        border-color: #2563eb;
        box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
    }

    .ps-sidebar-dropdown-trigger[aria-expanded="true"] .ps-sidebar-dropdown-chevron {
        transform: rotate(180deg);
    }

    .ps-sidebar-dropdown-chevron {
        flex-shrink: 0;
        margin-left: 0.5rem;
        transition: transform 0.2s;
    }

    .ps-sidebar-dropdown-panel {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        margin-top: 0.5rem;
        background-color: #ffffff;
        border: 1px solid #d1d5db;
        border-radius: 0.5rem;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        z-index: 100;
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
    }
    
    /* Topic sidebar - ensure white background */
    .topic-sidebar,
    .ps-sidebar-dropdown-panel {
        background-color: #ffffff !important;
    }

    .ps-sidebar-dropdown-wrapper.open .ps-sidebar-dropdown-panel {
        display: block;
    }

    .ps-sidebar-dropdown-panel .ps-explore-button {
        display: none;
    }

    .content-wrapper .topic-sidebar,
    .content-wrapper .category-sidebar,
    .content-wrapper .difficulty-sidebar {
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
    }
}

.topic-nav-item {
    background: none;
    border: none;
    border-left: 3px solid transparent;
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.9375rem;
    font-weight: 400;
    color: #374151;
    cursor: pointer;
    border-bottom: 1px solid #e5e7eb;
    transition: all 0.2s;
    font-family: 'Roboto', sans-serif;
    width: 100%;
    display: block;
    user-select: none;
    text-decoration: none;
}

.topic-nav-item:last-child {
    border-bottom: none;
}

.topic-nav-item:hover {
    background-color: #f3f4f6;
    color: #111827;
}

.topic-nav-item.active {
    background-color: #eff6ff;
    color: #2563eb;
    font-weight: 500;
    border-left-color: #2563eb;
}

/* Explore Button (Cross-link between Primary and Secondary) */
.ps-explore-button {
    display: block;
    width: 100%;
    margin-top: 1.5rem;
    padding: 0.75rem 1rem;
    background-color: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: 'Roboto', sans-serif;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.ps-explore-button:hover {
    background-color: #e5e7eb;
    border-color: #9ca3af;
    color: #111827;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.ps-explore-button:active {
    background-color: #d1d5db;
    transform: translateY(0);
}


/* Main Content Area */
.main-content-area {
    flex: 1;
    background-color: #ffffff;
    min-width: 0;
    padding: 0;
    font-family: 'Roboto', sans-serif;
}

/* Topic/Subcategory Headers */
.topic-header,
.subcategory-header {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 1.5rem 0;
    font-family: 'Roboto', sans-serif;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e5e7eb;
}

.subcategory-section {
    margin-bottom: 3rem;
}

/* Category Navigation (Secondary/A Level) */
.category-nav-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2rem;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 1rem;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.category-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    flex: 1;
}

.category-nav-item {
    padding: 0.625rem 1.25rem;
    background-color: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: 'Roboto', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.category-nav-item:hover {
    background-color: #e5e7eb;
    border-color: #9ca3af;
    color: #111827;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.category-nav-item.active {
    background-color: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.3);
}

.category-nav-item.active:hover {
    background-color: #1d4ed8;
    border-color: #1d4ed8;
    transform: translateY(-1px);
}

/* View Toggles */
.unstructured-view,
.structured-view {
    display: none;
}

.unstructured-view.active,
.structured-view.active {
    display: block;
}

/* Difficulty Tabs (Secondary Structured) - Button Style */
.difficulty-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: none;
}

.difficulty-tab {
    padding: 0.625rem 1.25rem;
    background-color: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Roboto', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.difficulty-tab:hover {
    background-color: #e5e7eb;
    border-color: #9ca3af;
    color: #111827;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.difficulty-tab.active {
    background-color: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.3);
}

.difficulty-tab.active:hover {
    background-color: #1d4ed8;
    border-color: #1d4ed8;
    transform: translateY(-1px);
}

.difficulty-section {
    display: none;
}

.difficulty-section.active {
    display: block;
}

/* Problems Grid */
.problems-grid,
.structured-problems-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* Problem Cards */
.problem-card,
.structured-problem-card {
    background-color: #f3f4f6;
    border: 2px solid #d1d5db;
    border-radius: 0.75rem;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    position: relative;
}

.structured-problem-card {
    padding: 0.75rem;
}

.problem-card {
    padding: 0.75rem;
  /*  min-height: 300px; */
}

.problem-card:hover,
.structured-problem-card:hover {
    border-color: #374151;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transform: translateY(-4px);
}


.problem-card:hover,
.structured-problem-card:hover {
    border-color: #374151;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transform: translateY(-4px);
}

.structured-problem-card:hover {
    background-color: #e5e7eb;
}


.secondary-problem-card:hover {
    transform: none;
    border: 2px solid #d1d5db;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
}

/* Problem Image */
.problem-image,
.structured-problem-image {
  
    display: flex;
    align-items: center;
    justify-content: center;


}

.problem-image {
    height: 200px;
    margin-bottom: auto;
}

.problem-image img,
.structured-problem-image img {
   
    max-width: 96%;
    height: auto;
    max-height: 98%;
    object-fit: contain;
    border-radius: 0.5rem;
   box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  
}

/* Problem Title */
.problem-title,
.structured-problem-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
    margin: 0;
    font-family: 'Roboto', sans-serif;
    margin-top:1rem;
    margin-left:0.75rem;
}



.problem-title {
    color: #374151;
    
    margin-bottom: 0;
}

/* Secondary card title spacing */
.secondary-problem-card .problem-title {
    margin: 1rem 0;
    color: #374151;
}

/* Problem Actions (Secondary Unstructured) */
.problem-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: auto;
}

.problem-action-btn {
    flex: 1;
    padding: 0.625rem 1rem;
    background-color: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    font-family: 'Roboto', sans-serif;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
}

/* Secondary specific button colors - override default hover */
.problem-action-btn.print-btn,
.problem-action-btn.project-btn {
    text-decoration: none;
}

.problem-action-btn.print-btn {
    background-color: #ffffff;
    color: #374151;
    border-color: #d1d5db;
}

.problem-action-btn.print-btn:hover {
    background-color: #f9fafb;
    border-color: #9ca3af;
    color: #374151;
    transform: none;
}

.problem-action-btn.project-btn {
    background-color: #ffffff;
    color: #374151;
    border-color: #d1d5db;
}

.problem-action-btn.project-btn:hover {
    background-color: #f9fafb;
    border-color: #9ca3af;
    color: #374151;
    transform: none;
}

/* Default hover for other buttons (if any) */
.problem-action-btn:hover:not(.print-btn):not(.project-btn) {
    background-color: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

.problem-action-btn.print-only {
    flex: 1;
}

/* Problem Steps Overlay (Primary) */
.problem-steps-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(199, 203, 211, 0.95);
    border-radius: calc(0.75rem - 2px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
    overflow: hidden;
}

.problem-card:hover .problem-steps-overlay {
    opacity: 1;
    visibility: visible;
}

.problem-steps-title {
    color: #111827;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
    font-family: 'Roboto', sans-serif;
    text-align: center;
}

.problem-steps-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

.problem-step-item {
    color: #111827;
    font-size: 0.875rem;
    font-weight: 400;
    font-family: 'Roboto', sans-serif;
    text-align: center;
    padding: 0.5rem;
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 0.375rem;
}

/* Responsive Styles - Layout adapts, cards keep their size (min 280px) */

/* Tablet and below */
@media (max-width: 1024px) {
    .problem-solving-container {
        padding: 1.25rem 1rem 2rem;
    }

    .content-wrapper {
        flex-direction: column;
        gap: 1.5rem;
        margin-top: 0 !important;
    }

    .content-wrapper .topic-sidebar,
    .content-wrapper .category-sidebar,
    .content-wrapper .difficulty-sidebar {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        flex-shrink: 0 !important;
    }

    .main-content-area {
        min-width: 0;
        width: 100%;
    }
}

/* Ensure problems-grid is visible for screens 768px-1024px */
@media (min-width: 768px) and (max-width: 1024px) {
    .problems-grid,
    .structured-problems-grid {
        display: grid !important;
        visibility: visible !important;
        opacity: 1 !important;
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        width: 100% !important;
    }
    
    .problem-card,
    .structured-problem-card {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        height: auto !important;
    }
    
    /* Ensure content-wrapper maintains proper layout */
    .content-wrapper {
        display: flex !important;
        flex-direction: column !important;
        visibility: visible !important;
        opacity: 1 !important;
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        position: relative !important;
        align-items: stretch !important;
    }
    
    /* Ensure sidebar wrapper doesn't collapse or hide main content */
    .ps-sidebar-dropdown-wrapper {
        display: block !important;
        visibility: visible !important;
        flex-shrink: 0 !important;
        width: 100% !important;
    }
    
    /* Main content area - always visible and takes remaining space */
    .main-content-area,
    #main-content {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        height: auto !important;
        min-height: 200px !important; /* Ensure minimum height */
        max-height: none !important;
        overflow: visible !important;
        position: relative !important;
        z-index: 1 !important;
        width: 100% !important;
        flex: 1 1 auto !important;
        flex-basis: auto !important;
        flex-grow: 1 !important;
        flex-shrink: 0 !important;
    }
    
    /* Ensure problem-solving-container doesn't hide content */
    .problem-solving-container {
        overflow: visible !important;
        height: auto !important;
        min-height: auto !important;
    }
    
    /* Problems grid - ensure it's always visible */
    .main-content-area .problems-grid,
    #main-content .problems-grid {
        display: grid !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }
}

/* Primary: Year tabs + search responsive */
@media (max-width: 900px) {
    .year-tabs {
        flex-wrap: wrap;
        gap: 0.75rem;
        row-gap: 0.75rem;
    }

    .year-tabs-container {
        flex-wrap: wrap;
        flex: 1 1 auto;
        min-width: 0;
    }

    .year-tab {
        padding: 0.5rem 1rem;
        font-size: 0.9375rem;
    }

    .ps-search-container {
        width: 100%;
        min-width: 0;
        flex: 1 1 100%;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .problem-solving-container {
        padding: 1rem;
    }

    .ps-top-nav-bar {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .ps-top-nav-bar .ps-how-to-use-link {
        margin-left: 0;
    }

    .page-title {
        font-size: 2rem !important;
    }

    .page-header-section {
        padding: 1rem 1.25rem;
    }

    .year-tabs {
        flex-direction: column;
        align-items: stretch;
    }

    .year-tabs-container {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.25rem;
        flex-wrap: nowrap;
        justify-content: flex-start;
    }

    .year-tab {
        flex-shrink: 0;
    }

    .ps-search-container {
        width: 100%;
    }

    .content-wrapper {
        flex-direction: column;
        margin-top: 0 !important;
    }

    .primary-page .problem-solving-container .content-wrapper,
    body.primary-problem-solving-page .content-wrapper {
        margin-top: 0 !important;
    }

    .topic-sidebar,
    .category-sidebar,
    .difficulty-sidebar {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    .back-button {
        margin-bottom: 0;
        font-size: 0.875rem;
    }

    .problem-actions {
        flex-direction: column;
    }

    .category-nav-wrapper {
        margin-bottom: 1.5rem;
        padding-bottom: 0.5rem;
        gap: 1rem;
    }

    .category-nav {
        gap: 0.375rem;
    }

    .category-nav-item {
        font-size: 0.875rem;
        padding: 0.625rem 1rem;
        flex: 1 1 auto;
        min-width: 0;
        text-align: center;
    }

    .difficulty-tabs {
        flex-wrap: wrap;
        gap: 0.375rem;
    }

    .difficulty-tab {
        flex: 1 1 auto;
        min-width: 0;
        padding: 0.5rem 1rem;
        font-size: 0.9375rem;
    }

    .type-toggle-wrapper {
        margin-bottom: 1rem;
    }
}

/* Small mobile - keep cards same size, grid shows 1 column */
@media (max-width: 480px) {
    .problem-solving-container {
        padding: 0.75rem;
    }

    .page-title {
        font-size: 1.5rem !important;
    }

    .page-header-section {
        padding: 0.875rem 1rem;
    }

    .year-tab {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }

    .topic-header,
    .subcategory-header {
        font-size: 1.25rem;
    }
}

/* Cards: grid adapts columns but card min-size stays 280px - no changes to .problem-card or grid template */