/* ========================================
   COURSE DASHBOARD - SPLIT SCREEN LAYOUT
======================================== */

.dashboard-container {
    display: flex;
    height: calc(100vh - 64px);
    /* Full height minus navbar */
    width: 100%;
    background-color: #fff;
}

/* ========================================
   LEFT SIDEBAR
======================================== */

.dashboard-sidebar {
    width: 30%;
    min-width: 350px;
    max-width: 430px;
    background-color: #f5f5f5;
    border-right: 1px solid #e5e7eb;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.dashboard-sidebar.collapsed {
    width: 80px;
    min-width: 80px;
    overflow: hidden;
}

.dashboard-sidebar.collapsed .progress-info,
.dashboard-sidebar.collapsed .sidebar-divider,
.dashboard-sidebar.collapsed .topic-info,
.dashboard-sidebar.collapsed .topic-name,
.dashboard-sidebar.collapsed .topic-progress {
    display: none !important;
}

.dashboard-sidebar.collapsed .topic-icon {
    margin: 0 auto;
}

.dashboard-sidebar.collapsed .topic-item {
    justify-content: center;
    padding: 16px 8px;
}

.dashboard-sidebar.collapsed .sidebar-header {
    justify-content: center;
}

.dashboard-sidebar.collapsed .sidebar-toggle svg {
    transform: rotate(180deg);
}

/* Sidebar Header with Progress */
.sidebar-header {
    padding: 24px;
    background-color: #f5f5f5;
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.sidebar-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    border-radius: 4px;
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.progress-info {
    flex: 1;
    min-width: 0;
}

.progress-text {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.progress-value {
    font-size: 2rem;
    font-weight: 700;
    color: #111827;
}

.progress-label {
    font-size: 1.25rem;
    font-weight: 400;
    color: #9ca3af;
}

.sidebar-divider {
    border: none;
    border-top: 1px solid #d1d5db;
    margin: 0 24px 16px 24px;
}

/* Topics Navigation */
.topics-nav {
    padding: 0 16px 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.topic-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px;
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
    cursor: pointer;
}

.topic-item:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

.topic-item.active {
    background-color: #c2eaff57;
    border-left: 4px solid #a8dcff;
}

/* Active topic - maintain radio button appearance for in-progress */
.topic-item.active .topic-icon svg circle[r="10"]:not([fill="#10b981"]) {
    stroke: #000000;
    fill: none;
}

.topic-item.active .topic-icon svg circle[r="6"] {
    fill: #000000;
}

/* Keep completed topics green even when active */
.topic-item.active .topic-icon svg circle[fill="#10b981"] {
    fill: #10b981;
    stroke: none;
}

.topic-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.topic-info {
    flex: 1;
    min-width: 0;
}

.topic-name {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 4px;
    line-height: 1.4;
}

.topic-progress {
    display: flex;
    align-items: baseline;
    gap: 4px;
    flex-wrap: wrap;
}

.progress-numbers {
    font-size: 0.875rem;
    font-weight: 600;
}

.progress-numbers.complete {
    color: #10b981;
}

.progress-numbers.partial {
    color: #f59e0b;
}

.progress-numbers.empty {
    color: #9ca3af;
}

.progress-text-small {
    font-size: 0.875rem;
    color: #9ca3af;
}

/* ========================================
   MAIN CONTENT AREA
======================================== */

.dashboard-main {
    flex: 1;
    overflow-y: auto;
    background-color: #fff;
    display: flex;
    flex-direction: column;
}

.exam-label {
    font-size: 0.9375rem;
    font-weight: 500;
    color: #111827;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.search-btn-wrapper {
    position: relative;
}

.search-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 32px;
    background: white;
    border: 0px solid #e5e7eb;
    border-radius: 100px;
    cursor: pointer;
    color: #111827;
    font-size: 0.9375rem;
    font-weight: 500;
    box-shadow: 0 0px 0px rgba(0, 0, 0, 0.06);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.search-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(194, 234, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
    z-index: 0;
}

.search-btn:hover::before {
    width: 300px;
    height: 300px;
}

.search-btn:hover {
    border-color: #c2eaff;
    color: #111827;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(194, 234, 255, 0.4);
}

.search-btn svg,
.search-btn span {
    position: relative;
    z-index: 1;
}

/* Search Dropdown */
.search-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 380px;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 24px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-20px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
}

.search-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.search-form {
    position: relative;
    margin-bottom: 16px;
}

.search-input {
    width: 100%;
    padding: 14px 52px 14px 20px;
    border: 2px solid #e5e7eb;
    border-radius: 100px;
    font-size: 0.9375rem;
    color: #111827;
    outline: none;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-input::placeholder {
    color: #9ca3af;
    font-weight: 400;
}

.search-input:focus {
    border-color: #c2eaff;
    box-shadow: 0 4px 16px rgba(194, 234, 255, 0.3);
    background: #fff;
}

.search-submit {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #c2eaff 0%, #a8dcff 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(194, 234, 255, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-submit:hover {
    background: linear-gradient(135deg, #a8dcff 0%, #8dd0ff 100%);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 12px rgba(194, 234, 255, 0.6);
}

.search-submit:active {
    transform: translateY(-50%) scale(0.95);
}

.search-submit svg {
    width: 18px;
    height: 18px;
    stroke: #111827;
    stroke-width: 2.5;
}

.search-results {
    font-size: 0.875rem;
    padding: 12px 16px;
    border-radius: 16px;
    display: none;
    animation: fadeInResult 0.3s ease-out;
}

@keyframes fadeInResult {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-results.show {
    display: block;
}

.search-results.success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    border: 2px solid #6ee7b7;
    font-weight: 500;
}

.search-results.error {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #991b1b;
    border: 2px solid #fca5a5;
    font-weight: 500;
}

.search-results.info {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
    border: 2px solid #93c5fd;
    font-weight: 500;
}

/* Search Navigation Buttons */
.search-navigation {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.search-nav-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    color: #111827;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.search-nav-btn:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
}

.search-nav-btn:active {
    transform: scale(0.98);
}

.search-nav-btn svg {
    flex-shrink: 0;
}

/* Search Highlight Styles */
.search-highlight {
    background: rgba(251, 191, 36, 0.4);
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: 600;
    color: #92400e;
    animation: highlightPulse 1.5s ease-in-out;
}

@keyframes highlightPulse {

    0%,
    100% {
        background: rgba(251, 191, 36, 0.4);
    }

    50% {
        background: rgba(251, 191, 36, 0.7);
    }
}

.search-highlight.current {
    background: rgba(251, 191, 36, 0.7);
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.3);
}

.trial-btn {
    padding: 10px 20px;
    background: #fff;
    border: 2px solid #111827;
    border-radius: 24px;
    color: #111827;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.trial-btn:hover {
    background: #111827;
    color: #fff;
}

.profile-menu-wrapper {
    position: relative;
}

.profile-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    background: transparent;
    padding: 0;
}

.profile-btn:hover {
    opacity: 0.8;
    transform: scale(1.05);
}

/* Profile Dropdown Menu */
.profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 200px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 100;
}

.profile-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.profile-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: #111827;
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.2s;
}

.profile-dropdown-item:hover {
    background: #f3f4f6;
    color: #2563eb;
}

.profile-dropdown-item svg {
    flex-shrink: 0;
    stroke: currentColor;
}

.profile-dropdown-divider {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 8px 0;
}

.profile-dropdown-item.logout {
    color: #dc2626;
}

.profile-dropdown-item.logout:hover {
    background: #fee2e2;
    color: #dc2626;
}

/* Topic Content */
.topic-content {
    padding: 48px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.topic-title {
    font-size: 2rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 32px;
    text-align: center;
}

/* Subtopics List */
.subtopics-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.subtopic-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 32px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    transition: all 0.2s;
}

.subtopic-row:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.subtopic-info {
    flex: 1;
    min-width: 0;
    margin-right: 24px;
}

.subtopic-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 8px;
}

.subtopic-stats {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.stats-numbers {
    font-size: 0.9375rem;
    font-weight: 600;
}

.stats-numbers.complete {
    color: #10b981;
}

.stats-numbers.partial {
    color: #f59e0b;
}

.stats-numbers.empty {
    color: #6b7280;
}

.stats-label {
    font-size: 0.9375rem;
    color: #9ca3af;
}

/* Subtopic Action Buttons */
.subtopic-actions {
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

.btn-theory,
.btn-test {
    padding: 12px 32px;
    border-radius: 24px;
    font-size: 0.9375rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    white-space: nowrap;
}

.btn-theory {
    background: #87cefa;
    color: #fff;
    border: 2px solid #87cefa;
}

.btn-theory:hover {
    background: #a8dcff;
    border-color: #a8dcff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(194, 234, 255, 0.6);
}

.btn-test {
    padding: 12px 32px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 100px;
    font-size: 0.9375rem;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    text-decoration: none;
}

.btn-test::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(194, 234, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.btn-test:hover::before {
    width: 300px;
    height: 300px;
}

.btn-test:hover {
    border-color: #c2eaff;
    color: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(194, 234, 255, 0.4);
}

.btn-test.active {
    background: #c2eaff;
    border-color: #c2eaff;
    color: #111827;
    box-shadow: 0 4px 16px rgba(194, 234, 255, 0.6);
}

.btn-test.active::before {
    display: none;
}

.btn-theory:disabled,
.btn-test:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    border: 2px solid #e5e7eb;
    cursor: not-allowed;
}

.btn-theory:disabled:hover,
.btn-test:disabled:hover {
    transform: none;
    box-shadow: none;
    background: #e5e7eb;
    color: #9ca3af;
}

/* Topic Introduction (No Topic Selected) */
.topic-intro {
    padding: 48px;
    text-align: center;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
}

.intro-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 16px;
}

.intro-text {
    font-size: 1.125rem;
    color: #6b7280;
    margin-bottom: 32px;
}

.no-subtopics {
    padding: 48px;
    text-align: center;
    color: #9ca3af;
    font-size: 1.125rem;
}

/* ========================================
   RESPONSIVE DESIGN - TABLET
======================================== */
@media (max-width: 1024px) {
    .dashboard-sidebar {
        width: 280px;
        min-width: 280px;
    }

    .sidebar-header {
        padding: 20px;
    }

    .progress-value {
        font-size: 1.75rem;
    }

    .progress-label {
        font-size: 1.125rem;
    }

    .topics-nav {
        padding: 0 12px 20px 12px;
    }

    .topic-item {
        padding: 14px;
        gap: 14px;
    }

    .topic-name {
        font-size: 0.9375rem;
    }

    .topic-content {
        padding: 32px;
    }

    .subtopic-row {
        padding: 20px 24px;
    }

    .subtopic-name {
        font-size: 1.0625rem;
    }

    .btn-theory,
    .btn-test {
        padding: 10px 24px;
        font-size: 0.875rem;
    }

    .search-dropdown {
        width: 300px;
    }

    .profile-dropdown {
        width: 190px;
    }
}

/* ========================================
   RESPONSIVE DESIGN - MOBILE
======================================== */
@media (max-width: 768px) {
    .dashboard-container {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 64px);
    }

    /* Sidebar becomes horizontal on mobile */
    .dashboard-sidebar {
        width: 100%;
        min-width: 100%;
        max-width: 100%;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
        max-height: 50vh;
        overflow-y: auto;
    }

    .dashboard-sidebar.collapsed {
        max-height: none;
        overflow: visible;
        width: 100%;
        min-width: 100%;
    }

    /* Mobile-specific: On collapse, only hide topics-nav, keep progress visible */
    .dashboard-sidebar.collapsed .progress-info,
    .dashboard-sidebar.collapsed .sidebar-divider {
        display: flex !important;
    }

    .dashboard-sidebar.collapsed .topics-nav {
        display: none !important;
    }

    /* Override desktop collapsed behavior for topic items on mobile */
    .dashboard-sidebar.collapsed .topic-info,
    .dashboard-sidebar.collapsed .topic-name,
    .dashboard-sidebar.collapsed .topic-progress {
        display: block !important;
    }

    /* Keep purchase button visible and styled when collapsed */
    .dashboard-sidebar.collapsed .btn.btn-success,
    .dashboard-sidebar.collapsed .progress-text {
        display: flex !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    /* Center button text */
    .dashboard-sidebar .btn.btn-success {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        text-align: center;
    }

    /* Ensure sidebar header has enough height for button */
    .dashboard-sidebar.collapsed .sidebar-header {
        min-height: auto;
        padding: 16px;
    }

    /* Make sure progress-info wraps properly */
    .dashboard-sidebar.collapsed .progress-info {
        flex-wrap: wrap;
    }

    .sidebar-header {
        padding: 16px;
        position: sticky;
        top: 0;
        background: #f5f5f5;
        z-index: 5;
    }

    .progress-value {
        font-size: 1.5rem;
    }

    .progress-label {
        font-size: 1rem;
    }

    .sidebar-toggle svg {
        width: 20px;
        height: 20px;
        transform: rotate(90deg);
        transition: transform 0.3s ease;
    }

    .dashboard-sidebar.collapsed .sidebar-toggle svg {
        transform: rotate(-90deg);
    }

    .topics-nav {
        padding: 0 12px 16px 12px;
    }

    .topic-item {
        padding: 12px;
        gap: 12px;
    }

    .topic-name {
        font-size: 0.9375rem;
        line-height: 1.3;
    }

    .topic-progress {
        font-size: 0.875rem;
    }

    /* Main content */
    .dashboard-main {
        min-height: 50vh;
    }

    .topic-content {
        padding: 24px 20px;
    }

    .topic-title {
        font-size: 1.5rem;
        margin-bottom: 24px;
    }

    .subtopics-list {
        gap: 12px;
    }

    .subtopic-row {
        flex-direction: column;
        align-items: flex-start;
        padding: 16px;
        gap: 12px;
    }

    .subtopic-info {
        margin-right: 0;
        width: 100%;
    }

    .subtopic-name {
        font-size: 1rem;
        margin-bottom: 6px;
    }

    .subtopic-stats {
        font-size: 0.875rem;
    }

    .subtopic-actions {
        width: 100%;
        gap: 10px;
    }

    .btn-theory,
    .btn-test {
        flex: 1;
        padding: 11px 20px;
        text-align: center;
        font-size: 0.875rem;
    }

    /* Intro section */
    .topic-intro {
        padding: 32px 20px;
    }

    .intro-title {
        font-size: 1.75rem;
    }

    .intro-text {
        font-size: 1rem;
    }

    /* Search and Profile */
    .search-dropdown {
        width: 280px;
        right: 0;
    }

    .search-nav-btn {
        font-size: 0.8125rem;
        padding: 7px 10px;
        gap: 4px;
    }

    .search-nav-btn svg {
        width: 14px;
        height: 14px;
    }

    .search-btn span {
        display: none;
    }

    .profile-dropdown {
        width: 180px;
        right: 0;
    }

    /* Alerts */
    .dashboard-main .alert {
        margin: 20px auto;
        width: calc(100% - 40px);
        padding: 12px 16px;
        font-size: 0.9375rem;
    }
}

/* ========================================
   RESPONSIVE DESIGN - SMALL MOBILE
======================================== */
@media (max-width: 480px) {

    /* Sidebar */
    .sidebar-header {
        padding: 12px;
    }

    .progress-value {
        font-size: 1.25rem;
    }

    .progress-label {
        font-size: 0.875rem;
    }

    .sidebar-toggle {
        padding: 6px;
    }

    .sidebar-toggle svg {
        width: 18px;
        height: 18px;
        transform: rotate(90deg);
        transition: transform 0.3s ease;
    }

    .dashboard-sidebar.collapsed .sidebar-toggle svg {
        transform: rotate(-90deg);
    }

    /* Mobile-specific: On collapse, only hide topics-nav, keep progress visible */
    .dashboard-sidebar.collapsed {
        max-height: none;
        overflow: visible;
    }

    .dashboard-sidebar.collapsed .progress-info,
    .dashboard-sidebar.collapsed .sidebar-divider {
        display: flex !important;
    }

    .dashboard-sidebar.collapsed .topics-nav {
        display: none !important;
    }

    /* Override desktop collapsed behavior for topic items on mobile */
    .dashboard-sidebar.collapsed .topic-info,
    .dashboard-sidebar.collapsed .topic-name,
    .dashboard-sidebar.collapsed .topic-progress {
        display: block !important;
    }

    /* Keep purchase button visible and styled when collapsed */
    .dashboard-sidebar.collapsed .btn.btn-success,
    .dashboard-sidebar.collapsed .progress-text {
        display: flex !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    /* Center button text */
    .dashboard-sidebar .btn.btn-success {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        text-align: center;
    }

    /* Ensure sidebar header has enough height for button */
    .dashboard-sidebar.collapsed .sidebar-header {
        min-height: auto;
        padding: 12px;
    }

    /* Make sure progress-info wraps properly */
    .dashboard-sidebar.collapsed .progress-info {
        flex-wrap: wrap;
    }

    .topics-nav {
        padding: 0 8px 12px 8px;
    }

    .topic-item {
        padding: 10px;
        gap: 10px;
    }

    .topic-icon svg {
        width: 20px;
        height: 20px;
    }

    .topic-name {
        font-size: 0.875rem;
        line-height: 1.3;
    }

    .progress-numbers,
    .progress-text-small {
        font-size: 0.8125rem;
    }

    /* Main content */
    .topic-content {
        padding: 20px 12px;
    }

    .topic-title {
        font-size: 1.25rem;
        margin-bottom: 20px;
        line-height: 1.3;
    }

    .subtopics-list {
        gap: 10px;
    }

    .subtopic-row {
        padding: 12px;
        gap: 10px;
        border-radius: 10px;
    }

    .subtopic-name {
        font-size: 0.9375rem;
        line-height: 1.3;
        margin-bottom: 4px;
    }

    .subtopic-stats {
        font-size: 0.8125rem;
    }

    .stats-numbers,
    .stats-label {
        font-size: 0.8125rem;
    }

    .subtopic-actions {
        gap: 8px;
    }

    .btn-theory,
    .btn-test {
        padding: 10px 16px;
        font-size: 0.8125rem;
        border-radius: 20px;
    }

    /* Intro section */
    .topic-intro {
        padding: 24px 12px;
    }

    .intro-title {
        font-size: 1.5rem;
        line-height: 1.3;
    }

    .intro-text {
        font-size: 0.9375rem;
    }

    /* Search */
    .search-btn {
        font-size: 0.8125rem;
        padding: 6px 10px;
    }

    .search-btn svg {
        width: 18px;
        height: 18px;
    }

    .search-dropdown {
        width: calc(100vw - 24px);
        right: -12px;
        max-width: 280px;
    }

    .search-input {
        font-size: 0.875rem;
        padding: 9px 38px 9px 12px;
    }

    .search-submit {
        width: 30px;
        height: 30px;
    }

    .search-results {
        font-size: 0.8125rem;
        padding: 7px 10px;
    }

    .search-nav-btn {
        font-size: 0.75rem;
        padding: 6px 8px;
        gap: 3px;
    }

    .search-nav-btn svg {
        width: 12px;
        height: 12px;
    }

    /* Profile */
    .profile-btn svg {
        width: 28px;
        height: 28px;
    }

    .profile-dropdown {
        width: 160px;
        right: -12px;
    }

    .profile-dropdown-item {
        font-size: 0.875rem;
        padding: 8px 10px;
        gap: 10px;
    }

    .profile-dropdown-item svg {
        width: 18px;
        height: 18px;
    }

    /* Alerts */
    .dashboard-main .alert {
        margin: 16px auto;
        width: calc(100% - 24px);
        padding: 10px 14px;
        font-size: 0.875rem;
        line-height: 1.4;
    }
}

/* ========================================
   RESPONSIVE DESIGN - EXTRA SMALL MOBILE
======================================== */
@media (max-width: 360px) {
    .sidebar-toggle svg {
        transform: rotate(90deg);
        transition: transform 0.3s ease;
    }

    .dashboard-sidebar.collapsed .sidebar-toggle svg {
        transform: rotate(-90deg);
    }

    /* Mobile-specific: On collapse, only hide topics-nav, keep progress visible */
    .dashboard-sidebar.collapsed {
        max-height: none;
        overflow: visible;
    }

    .dashboard-sidebar.collapsed .progress-info,
    .dashboard-sidebar.collapsed .sidebar-divider {
        display: flex !important;
    }

    .dashboard-sidebar.collapsed .topics-nav {
        display: none !important;
    }

    /* Override desktop collapsed behavior for topic items on mobile */
    .dashboard-sidebar.collapsed .topic-info,
    .dashboard-sidebar.collapsed .topic-name,
    .dashboard-sidebar.collapsed .topic-progress {
        display: block !important;
    }

    /* Keep purchase button visible and styled when collapsed */
    .dashboard-sidebar.collapsed .btn.btn-success,
    .dashboard-sidebar.collapsed .progress-text {
        display: flex !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    /* Center button text */
    .dashboard-sidebar .btn.btn-success {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        text-align: center;
    }

    /* Ensure sidebar header has enough height for button */
    .dashboard-sidebar.collapsed .sidebar-header {
        min-height: auto;
    }

    /* Make sure progress-info wraps properly */
    .dashboard-sidebar.collapsed .progress-info {
        flex-wrap: wrap;
    }

    .progress-value {
        font-size: 1.125rem;
    }

    .progress-label {
        font-size: 0.8125rem;
    }

    .topic-name {
        font-size: 0.8125rem;
    }

    .subtopic-name {
        font-size: 0.875rem;
    }

    .btn-theory,
    .btn-test {
        padding: 9px 14px;
        font-size: 0.75rem;
    }

    .search-dropdown {
        width: calc(100vw - 24px);
        max-width: 260px;
    }
}

/* ========================================
   TOUCH-FRIENDLY INTERACTIONS
======================================== */
@media (hover: none) and (pointer: coarse) {

    /* Touch devices */
    .topic-item,
    .subtopic-row,
    .btn-theory,
    .btn-test,
    .search-btn,
    .profile-btn,
    .sidebar-toggle {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
    }

    .topic-item:active {
        transform: scale(0.98);
    }

    .subtopic-row:active {
        transform: scale(0.99);
    }

    /* Ensure minimum touch target sizes */
    .btn-theory,
    .btn-test,
    .search-btn,
    .profile-btn,
    .sidebar-toggle,
    .search-submit {
        min-height: 44px;
        min-width: 44px;
    }
}

/* ========================================
   DARK THEME STYLES
======================================== */
[data-theme="dark"] .dashboard-container {
    background-color: #1e293b;
}

[data-theme="dark"] .dashboard-sidebar {
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    border-right: 1px solid #334155;
}

[data-theme="dark"] .sidebar-header {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

[data-theme="dark"] .progress-value {
    color: #f1f5f9;
    text-shadow: 0 0 20px rgba(168, 220, 255, 0.3);
}

[data-theme="dark"] .progress-label {
    color: #94a3b8;
}

[data-theme="dark"] .sidebar-divider {
    border-top: 1px solid #334155;
}

[data-theme="dark"] .sidebar-toggle {
    color: #94a3b8;
}

[data-theme="dark"] .sidebar-toggle:hover {
    background-color: rgba(148, 163, 184, 0.1);
    color: #f1f5f9;
}

[data-theme="dark"] .topic-item {
    color: #e2e8f0;
}

[data-theme="dark"] .topic-item:hover {
    background-color: rgba(148, 163, 184, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .topic-item.active {
    background: linear-gradient(135deg, rgba(168, 220, 255, 0.15) 0%, rgba(194, 234, 255, 0.1) 100%);
    border-left: 4px solid #60a5fa;
    box-shadow: 0 4px 16px rgba(96, 165, 250, 0.2);
}

[data-theme="dark"] .topic-name {
    color: #f1f5f9;
}

[data-theme="dark"] .progress-text-small {
    color: #64748b;
}

[data-theme="dark"] .dashboard-main {
    background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
}

[data-theme="dark"] .exam-label {
    color: #f1f5f9;
}

[data-theme="dark"] .search-btn {
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
    border: 2px solid #475569;
    color: #f1f5f9;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .search-btn:hover {
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
    border-color: #60a5fa;
    box-shadow: 0 6px 20px rgba(96, 165, 250, 0.4);
}

[data-theme="dark"] .search-dropdown {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 2px solid #334155;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .search-input {
    background: #0f172a;
    border: 2px solid #334155;
    color: #f1f5f9;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .search-input::placeholder {
    color: #64748b;
}

[data-theme="dark"] .search-input:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2), inset 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .search-submit {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    box-shadow: 0 4px 12px rgba(96, 165, 250, 0.4);
}

[data-theme="dark"] .search-submit:hover {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    box-shadow: 0 6px 20px rgba(96, 165, 250, 0.6);
}

[data-theme="dark"] .search-nav-btn {
    background: #0f172a;
    border: 1px solid #334155;
    color: #f1f5f9;
}

[data-theme="dark"] .search-nav-btn:hover {
    background: #1e293b;
    border-color: #475569;
}

[data-theme="dark"] .trial-btn {
    background: #1e293b;
    border: 2px solid #60a5fa;
    color: #f1f5f9;
    box-shadow: 0 4px 12px rgba(96, 165, 250, 0.2);
}

[data-theme="dark"] .trial-btn:hover {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    color: #fff;
    box-shadow: 0 6px 20px rgba(96, 165, 250, 0.5);
}

[data-theme="dark"] .profile-dropdown {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid #334155;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .profile-dropdown-item {
    color: #f1f5f9;
}

[data-theme="dark"] .profile-dropdown-item:hover {
    background: rgba(148, 163, 184, 0.15);
    color: #60a5fa;
}

[data-theme="dark"] .profile-dropdown-divider {
    border-top: 1px solid #334155;
}

[data-theme="dark"] .profile-dropdown-item.logout {
    color: #f87171;
}

[data-theme="dark"] .profile-dropdown-item.logout:hover {
    background: rgba(248, 113, 113, 0.15);
    color: #fca5a5;
}

[data-theme="dark"] .topic-content {
    background: transparent;
}

[data-theme="dark"] .topic-title {
    color: #f1f5f9;
    text-shadow: 0 2px 10px rgba(168, 220, 255, 0.2);
}

[data-theme="dark"] .subtopic-row {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid #334155;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .subtopic-row:hover {
    border-color: #475569;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 20px rgba(96, 165, 250, 0.15);
    transform: translateY(-3px);
}

[data-theme="dark"] .subtopic-name {
    color: #f1f5f9;
}

[data-theme="dark"] .stats-label {
    color: #64748b;
}

[data-theme="dark"] .stats-numbers.empty {
    color: #64748b;
}

[data-theme="dark"] .btn-theory {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    border: 2px solid #60a5fa;
    color: #fff;
    box-shadow: 0 4px 12px rgba(96, 165, 250, 0.4);
}

[data-theme="dark"] .btn-theory:hover {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border-color: #3b82f6;
    box-shadow: 0 6px 20px rgba(96, 165, 250, 0.6);
}

[data-theme="dark"] .btn-test {
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%);
    border: 2px solid #475569;
    color: #f1f5f9;
}

[data-theme="dark"] .btn-test:hover {
    background: linear-gradient(135deg, #475569 0%, #334155 100%);
    border-color: #60a5fa;
    color: #fff;
    box-shadow: 0 4px 16px rgba(96, 165, 250, 0.3);
}

[data-theme="dark"] .btn-test.active {
    background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    border-color: #60a5fa;
    color: #fff;
    box-shadow: 0 6px 20px rgba(96, 165, 250, 0.5);
}

[data-theme="dark"] .btn-theory:disabled,
[data-theme="dark"] .btn-test:disabled {
    background: #0f172a;
    color: #475569;
    border: 2px solid #334155;
    box-shadow: none;
}

[data-theme="dark"] .topic-intro {
    background: transparent;
}

[data-theme="dark"] .intro-title {
    color: #f1f5f9;
    text-shadow: 0 2px 20px rgba(168, 220, 255, 0.3);
}

[data-theme="dark"] .intro-text {
    color: #94a3b8;
}

[data-theme="dark"] .no-subtopics {
    color: #64748b;
}

/* ========================================
   PREVENT HORIZONTAL SCROLL
======================================== */
body {
    overflow-x: hidden;
}

.dashboard-container,
.dashboard-sidebar,
.dashboard-main,
.topic-content,
.subtopics-list {
    max-width: 100%;
    overflow-x: hidden;
}

/* ========================================
   IMPROVED TEXT READABILITY ON MOBILE
======================================== */
@media (max-width: 768px) {
    * {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }

    .topic-name,
    .subtopic-name,
    .topic-title {
        word-break: break-word;
        hyphens: auto;
    }
}

/* ========================================
   ALERT STYLES (Override for dashboard)
======================================== */
.dashboard-main .alert {
    margin: 24px auto;
    max-width: 1200px;
    width: calc(100% - 96px);
}

@media (max-width: 768px) {
    .dashboard-main .alert {
        margin: 20px auto;
        width: calc(100% - 40px);
    }
}

@media (max-width: 480px) {
    .dashboard-main .alert {
        margin: 16px auto;
        width: calc(100% - 24px);
    }
}