/* ===== File Upload Area Styles ===== */
.upload-area {
    margin-bottom: 2rem;
}
.upload-drop-zone {
    border: 2px dashed var(--primary-purple);
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(156,39,176,0.04), rgba(123,31,162,0.03));
    padding: 2rem 1.5rem;
    text-align: center;
    transition: border-color 0.2s, background 0.2s;
    cursor: pointer;
    position: relative;
}
.upload-drop-zone.dragover {
    border-color: var(--primary-violet);
    background: linear-gradient(135deg, rgba(156,39,176,0.10), rgba(123,31,162,0.08));
}
.upload-icon {
    font-size: 2.5rem;
    color: var(--primary-purple);
    margin-bottom: 0.5rem;
}
.upload-text {
    font-size: 1.1rem;
    color: var(--primary-purple);
    margin-bottom: 0.2rem;
}
.upload-browse {
    color: var(--primary-violet);
    text-decoration: underline;
    cursor: pointer;
    font-weight: 600;
}
.upload-browse:hover {
    color: var(--dark-purple);
}
.upload-subtext {
    color: var(--medium);
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
}
.upload-file-list {
    margin-top: 1rem;
    text-align: left;
}
.upload-file-item {
    background: linear-gradient(135deg, rgba(156,39,176,0.07), rgba(123,31,162,0.05));
    border-left: 4px solid var(--primary-purple);
    border-radius: 8px;
    padding: 0.7rem 1rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-size: 1rem;
    color: var(--darker);
    box-shadow: 0 2px 8px rgba(156,39,176,0.04);
    cursor: pointer;
}
.upload-file-item:last-child {
    margin-bottom: 0;
}
.upload-file-icon {
    font-size: 1.2rem;
    color: var(--primary-purple);
}
.upload-file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.upload-file-size {
    color: var(--medium);
    font-size: 0.92rem;
    margin-left: 0.5rem;
}
.upload-file-spinner {
    font-size: 1rem;
    color: var(--primary-purple);
    display: none;
}
.upload-file-spinner.show {
    display: inline-block;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}
@media (max-width: 768px) {
    .upload-drop-zone {
        padding: 1.2rem 0.5rem;
    }
}
/* ===== Study Base Styles - Purple & Violet Theme ===== */

:root {
    /* Primary Purple & Violet Colors */
    --primary-purple: #9C27B0;
    --primary-violet: #7B1FA2;
    --dark-purple: #6A1B9A;
    --light-purple: #BA68C8;
    --violet-light: #CE93D8;
    
    /* Secondary Colors */
    --success: #4CAF50;
    --error: #F44336;
    --warning: #FF5722;
    --info: #2196F3;
    
    /* Neutral Colors */
    --white: #ffffff;
    --light: #f8f9fa;
    --medium: #999da3;
    --dark: #5f6368;
    --darker: #3c4043;
    --black: #000000;
    
    /* Spacing & Typography */
    --font-main: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    
    /* Effects */
    --transition: 0.3s ease;
    --glass-bg: rgba(255, 255, 255, 0.999);
    --glass-border: 1px solid rgba(255, 255, 255, 0.18);
}

.dark-mode {
    --glass-bg: rgba(0, 0, 0, 0.6);
    --glass-border: 1px solid rgba(255, 255, 255, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background: linear-gradient(135deg, #f5f5ff 0%, #f3e9ff 50%, #ede7f6 100%);
    color: var(--darker);
    line-height: 1.5;
    overflow-x: hidden;
    transition: background 0.3s ease;
}

body.dark-mode {
    background: linear-gradient(135deg, #1c1026 0%, #2a1838 50%, #2c193c 100%);
    color: #e8eaed;
}

/* ===== Loading Screen ===== */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f5f5ff 0%, #f3e9ff 50%, #ede7f6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

body.dark-mode .loading-screen {
    background: linear-gradient(135deg, #100915 0%, #251532 50%, #352244 100%);
    color: #999999;
}

.loading-spinner {
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(156, 39, 176, 0.2);
    border-top: 4px solid var(--primary-purple);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-spinner p {
    color: var(--primary-purple);
    font-weight: 600;
}

/* ===== Floating Background ===== */
.floating-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.float-icon {
    position: absolute;
    opacity: 0.25;
    color: var(--primary-purple);
    animation: float 6s ease-in-out infinite;
    transition: opacity 0.3s ease;
}

.float-emoji {
    position: absolute;
    opacity: 0.18;
    font-size: 3rem;
    animation: float 12s ease-in-out infinite;
    will-change: transform;
    transition: opacity 0.3s ease;
}

body.dark-mode .float-icon {
    opacity: 0.35;
    color: #ce93d8;
}

body.dark-mode .float-emoji {
    opacity: 0.28;
}

.float-emoji:nth-child(2) { bottom: 0; left: 10%; animation-delay: 0s; }
.float-emoji:nth-child(4) { bottom: 0; right: 15%; animation-delay: 0.5s; }
.float-emoji:nth-child(6) { bottom: 0; left: 5%; animation-delay: 1s; }
.float-emoji:nth-child(8) { bottom: 0; right: 10%; animation-delay: 1.5s; }
.float-emoji:nth-child(10) { bottom: 0; left: 20%; animation-delay: 2s; }
.float-emoji:nth-child(12) { bottom: 0; right: 25%; animation-delay: 2.5s; }
.float-emoji:nth-child(14) { bottom: 0; left: 35%; animation-delay: 3s; }
.float-emoji:nth-child(16) { bottom: 0; right: 5%; animation-delay: 3.5s; }
.float-emoji:nth-child(18) { bottom: 0; left: 50%; animation-delay: 4s; }
.float-emoji:nth-child(20) { bottom: 0; right: 35%; animation-delay: 4.5s; }
.float-emoji:nth-child(22) { bottom: 0; left: 65%; animation-delay: 5s; }
.float-emoji:nth-child(24) { bottom: 0; right: 45%; animation-delay: 5.5s; }

@keyframes float {
    0% {
        transform: translateY(0px);
        opacity: 0.08;
    }
    100% {
        transform: translateY(-450px);
        opacity: 0;
    }
}

/* ===== App Container ===== */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Header ===== */
.app-header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(156, 39, 176, 0.1);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 8px 32px rgba(156, 39, 176, 0.08);
    transition: all 0.3s ease;
}

body.dark-mode .app-header {
    background: rgba(0, 0, 0, 0.6);
    border-bottom: 1px solid rgba(206, 147, 216, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.header-left h1 {
    color: var(--primary-purple);
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
}

.header-left p {
    color: var(--medium);
    font-size: 0.875rem;
}

.header-right {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.icon-btn {
    background: transparent;
    border: 2px solid var(--primary-purple);
    color: var(--primary-purple);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.icon-btn:hover {
    background: var(--primary-purple);
    color: var(--white);
    transform: scale(1.1);
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn.small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn.primary {
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-violet));
    color: var(--white);
}

.btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(156, 39, 176, 0.3);
}

.btn.secondary {
    background: transparent;
    border: 2px solid var(--primary-purple);
    color: var(--primary-purple);
}

.btn.secondary:hover {
    background: var(--primary-purple);
    color: var(--white);
}

/* ===== Main Content ===== */
.screen {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.screen.hidden {
    display: none;
}

.app-main {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* ===== Welcome Section ===== */
.welcome-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border-radius: 20px;
    border: 1px solid rgba(156, 39, 176, 0.1);
    box-shadow: 0 8px 32px rgba(156, 39, 176, 0.08);
    transition: all 0.3s ease;
}

body.dark-mode .welcome-section {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(206, 147, 216, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.welcome-text h1 {
    font-size: 2rem;
    color: var(--primary-purple);
    margin-bottom: 0.5rem;
}

.welcome-text p {
    color: var(--medium);
    font-size: 1rem;
}

.study-badge {
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-violet));
    color: var(--white);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 8px 20px rgba(156, 39, 176, 0.3);
}

.badge-icon {
    font-size: 2rem;
}

.badge-text {
    font-weight: 700;
    font-size: 1.1rem;
}

/* ===== Glass Card ===== */
.glass-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid rgba(156, 39, 176, 0.1);
    box-shadow: 0 8px 32px rgba(156, 39, 176, 0.08);
    transition: all 0.3s ease;
}

.glass-card:hover {
    box-shadow: 0 12px 40px rgba(156, 39, 176, 0.12);
    transform: translateY(-2px);
}

body.dark-mode .glass-card {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(206, 147, 216, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);

}

.section-header {
    margin-bottom: 1.5rem;
}

.section-header h2 {
    color: var(--primary-purple);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.section-subtitle {
    color: var(--medium);
    font-size: 0.875rem;
}

/* ===== Info Cards ===== */
.info-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.info-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(156, 39, 176, 0.15);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    transition: all var(--transition);
    box-shadow: 0 4px 15px rgba(156, 39, 176, 0.08);
}

.info-card:hover {
    transform: translateY(-6px);
    border-color: var(--primary-purple);
    box-shadow: 0 12px 30px rgba(156, 39, 176, 0.15);
}

.info-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.info-card h4 {
    color: var(--primary-purple);
    margin-bottom: 0.5rem;
}

.info-card p {
    color: var(--medium);
    font-size: 0.875rem;
}

/* ===== Search Box ===== */
.search-container {
    margin-bottom: 2rem;
}

.search-box {
    background: var(--white);
    border: 2px solid var(--primary-purple);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all var(--transition);
}

.search-box:focus-within {
    box-shadow: 0 0 0 4px rgba(156, 39, 176, 0.1);
}

.search-box i {
    color: var(--primary-purple);
    font-size: 1.2rem;
}

.search-box input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
    color: var(--darker);
}

/* ===== Courses Grid ===== */
.courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.course-card {
    background: linear-gradient(135deg, rgba(156, 39, 176, 0.08), rgba(123, 31, 162, 0.08));
    border: 2px solid rgba(156, 39, 176, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.course-card:hover {
    transform: translateY(-6px);
    border-color: var(--primary-purple);
    box-shadow: 0 12px 28px rgba(156, 39, 176, 0.25);
    background: linear-gradient(135deg, rgba(156, 39, 176, 0.15), rgba(123, 31, 162, 0.15));
}

.course-card.selected {
    border-color: var(--primary-purple);
    background: linear-gradient(135deg, rgba(156, 39, 176, 0.18), rgba(123, 31, 162, 0.18));
    box-shadow: 0 12px 28px rgba(156, 39, 176, 0.25);
}

.course-icon {
    font-size: 2.5rem;
}

.course-name {
    font-weight: 700;
    color: var(--primary-purple);
    font-size: 1.1rem;
}

.course-description {
    font-size: 0.85rem;
    color: var(--medium);
}

.course-stats {
    display: flex;
    justify-content: space-around;
    font-size: 0.85rem;
    color: var(--dark);
}

/* ===== Stats Section ===== */
.stats-section {
    margin-top: 2rem;
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background: linear-gradient(135deg, rgba(156, 39, 176, 0.05), rgba(123, 31, 162, 0.05));
    border: 2px solid rgba(156, 39, 176, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(156, 39, 176, 0.2);
}

.stat-icon {
    font-size: 2.5rem;
}

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--medium);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-purple);
}

/* ===== Study Interface ===== */
.study-card {
    min-height: 600px;
}

.study-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid rgba(156, 39, 176, 0.2);
}

.study-info {
    flex: 1;
}

.subject-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-purple);
    margin-bottom: 0.5rem;
}

.study-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#topicCounter {
    font-size: 0.875rem;
    color: var(--medium);
    font-weight: 600;
}

.progress-bar-mini {
    flex: 1;
    max-width: 200px;
    height: 8px;
    background: rgba(156, 39, 176, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill-mini {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-purple), var(--primary-violet));
    transition: width var(--transition);
}

.study-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    background: transparent;
    border: 2px solid var(--primary-purple);
    color: var(--primary-purple);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.action-btn:hover {
    background: var(--primary-purple);
    color: var(--white);
    transform: scale(1.1);
}

.action-btn.active {
    background: var(--primary-purple);
    color: var(--white);
}

/* ===== Content Container ===== */
.content-container {
    margin-bottom: 2rem;
}

.topic-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-purple);
    margin-bottom: 1.5rem;
}

.content-text {
    font-size: 1rem;
    line-height: 1.8;
    color: var(--darker);
}

.content-text h1, .content-text h2, .content-text h3 {
    color: var(--primary-purple);
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.content-text p {
    margin-bottom: 1rem;
}

.content-text ul, .content-text ol {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.content-text li {
    margin-bottom: 0.5rem;
}

.content-text code {
    background: rgba(156, 39, 176, 0.1);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

.content-text pre {
    background: rgba(156, 39, 176, 0.05);
    border-left: 4px solid var(--primary-purple);
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    margin-bottom: 1rem;
}

/* ===== File Content Interface ===== */
.file-content-card {
    min-height: 600px;
}

.file-meta {
    flex-wrap: wrap;
    gap: 0.75rem;
    color: var(--medium);
    font-size: 0.85rem;
}

.file-content-body {
    max-height: 520px;
    overflow: auto;
}

.file-content-loading {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--primary-purple);
}

.file-content-spinner {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(156, 39, 176, 0.2);
    border-top-color: var(--primary-purple);
    animation: spin 1s linear infinite;
}

.file-content-navigation {
    margin-top: 1.5rem;
}

.file-page-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    color: var(--medium);
    font-size: 0.85rem;
    min-width: 140px;
}

.file-page-status .progress-bar-mini {
    width: 140px;
}

.file-page-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    min-width: 200px;
    color: var(--medium);
    font-size: 0.85rem;
}

.file-page-quota {
    font-weight: 600;
    color: var(--primary-purple);
}

.file-page-purchase {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.file-page-price {
    font-weight: 600;
    color: var(--primary-purple);
}

.file-page-select {
    padding: 0.45rem 0.65rem;
    border-radius: 6px;
    border: 1px solid rgba(156, 39, 176, 0.3);
    background: rgba(156, 39, 176, 0.05);
    color: var(--darker);
    font-size: 0.85rem;
}

.file-buy-btn {
    padding: 0.5rem 0.85rem;
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .file-page-status .progress-bar-mini {
        width: 120px;
    }
}

.content-raw {
    background: rgba(156, 39, 176, 0.05);
    border-left: 4px solid var(--primary-purple);
    padding: 1rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    white-space: pre-wrap;
    color: var(--darker);
}

/* ===== Navigation ===== */
.navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.nav-btn {
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-violet));
    color: var(--white);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(156, 39, 176, 0.3);
}

.nav-btn:disabled {
    background: var(--medium);
    cursor: not-allowed;
    opacity: 0.5;
}

.topic-indicators {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.indicator {
    width: 32px;
    height: 32px;
    border: 2px solid rgba(156, 39, 176, 0.3);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    color: var(--dark);
}

.indicator:hover {
    border-color: var(--primary-purple);
    background: rgba(156, 39, 176, 0.1);
}

.indicator.active {
    background: var(--primary-purple);
    color: var(--white);
    border-color: var(--primary-purple);
}

.indicator.completed {
    background: rgba(76, 175, 80, 0.2);
    border-color: var(--success);
    color: var(--success);
}

/* ===== Submit Button ===== */
.submit-btn {
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-violet));
    color: var(--white);
    border: none;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}

.submit-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(156, 39, 176, 0.4);
}

/* ===== Footer ===== */
footer {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-top: var(--glass-border);
    padding: 1.5rem;
    text-align: center;
    color: var(--medium);
    font-size: 0.875rem;
}

footer div {
    margin-top: 0.5rem;
    font-size: 0.75rem;
}

/* ===== Profile Modal ===== */
.profile-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: stretch;
    justify-content: flex-end;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.profile-modal.hidden {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.profile-modal-content {
    background: var(--white);
    max-width: 450px;
    width: 100%;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    animation: slideInRight 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

.profile-modal-header {
    padding: 1.5rem;
    border-bottom: 2px solid rgba(156, 39, 176, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: var(--white);
    z-index: 10;
}

.profile-modal-header h2 {
    color: var(--primary-purple);
    font-size: 1.5rem;
}

.close-profile-btn {
    background: transparent;
    border: none;
    font-size: 2rem;
    color: var(--medium);
    cursor: pointer;
    transition: all var(--transition);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close-profile-btn:hover {
    background: rgba(156, 39, 176, 0.1);
    color: var(--primary-purple);
}

.profile-header-section {
    padding: 2rem 1.5rem;
    background: linear-gradient(135deg, rgba(156, 39, 176, 0.05), rgba(123, 31, 162, 0.05));
    border-bottom: 2px solid rgba(156, 39, 176, 0.1);
}

.profile-picture-container {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.profile-picture-large {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-violet));
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
    box-shadow: 0 8px 20px rgba(156, 39, 176, 0.3);
}

.profile-info {
    text-align: center;
}

.profile-info h3 {
    font-size: 1.5rem;
    color: var(--darker);
    margin-bottom: 0.25rem;
}

.profile-email {
    color: var(--medium);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.motivational-quote {
    background: var(--white);
    border-left: 4px solid var(--primary-purple);
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    align-items: start;
    gap: 0.75rem;
    margin-top: 1rem;
}

.motivational-quote i {
    color: var(--primary-purple);
    font-size: 1.2rem;
    margin-top: 0.2rem;
}

.motivational-quote span {
    flex: 1;
    font-style: italic;
    color: var(--darker);
    font-size: 0.9rem;
    line-height: 1.5;
}

.profile-metrics-section {
    padding: 1.5rem;
    border-bottom: 2px solid rgba(156, 39, 176, 0.1);
}

.profile-metrics-section h3 {
    color: var(--primary-purple);
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.metric-card {
    background: linear-gradient(135deg, rgba(156, 39, 176, 0.05), rgba(123, 31, 162, 0.05));
    border: 2px solid rgba(156, 39, 176, 0.2);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
}

.metric-card.small {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.metric-card .metric-icon {
    font-size: 2rem;
}

.metric-card .metric-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.metric-card .metric-label {
    font-size: 0.75rem;
    color: var(--medium);
    margin-bottom: 0.5rem;
}

.metric-card .metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-purple);
}

.metric-card .metric-subtext {
    font-size: 0.75rem;
    color: var(--medium);
}

.study-history-section {
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
    min-height: 500px;
}

.study-history-section h3 {
    color: var(--primary-purple);
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.history-item {
    background: linear-gradient(135deg, rgba(156, 39, 176, 0.05), rgba(123, 31, 162, 0.05));
    border-left: 4px solid var(--primary-purple);
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-item-info h4 {
    color: var(--darker);
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.history-item-date {
    font-size: 0.75rem;
    color: var(--medium);
}

.history-item-score {
    text-align: right;
}

.history-score {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-purple);
}

.history-total {
    display: block;
    font-size: 0.75rem;
    color: var(--medium);
}

.empty-message {
    text-align: center;
    color: var(--medium);
    font-style: italic;
    padding: 2rem;
}

.profile-modal-footer {
    padding: 1.5rem;
    border-top: 2px solid rgba(156, 39, 176, 0.1);
    position: sticky;
    bottom: 0;
    background: var(--white);
}

/* ===== Utility Classes ===== */
.text-center {
    text-align: center;
}

.hidden {
    display: none !important;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .app-header {
        position: static;
        padding: 1rem;
    }

    .app-main {
        padding: 1rem;
    }

    .welcome-section {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .info-cards {
        grid-template-columns: 1fr;
    }

    .courses-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .stats-container {
        grid-template-columns: 1fr;
    }

    .navigation {
        flex-direction: column;
    }

    .topic-indicators {
        order: -1;
        width: 100%;
    }

    .profile-modal-content {
        max-width: 100%;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== Dark Mode Adjustments ===== */
body.dark-mode .glass-card,
body.dark-mode .info-card,
body.dark-mode .stat-card,
body.dark-mode .course-card,
body.dark-mode .search-box {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(206, 147, 216, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

body.dark-mode .info-card {
    background: linear-gradient(135deg, rgba(217, 66, 244, 0.08), rgba(217, 66, 244, 0.04));
    border: 1px solid rgba(217, 66, 244, 0.2);
    
}

body.dark-mode .info-card:hover {
    border-color: var(--primary);
    box-shadow: 0 8px 24px rgba(217, 66, 244, 0.12);
}

body.dark-mode .search-box input {
    color: #e8eaed;
}

body.dark-mode .search-box input::placeholder {
    color: #a8a8a8;
    opacity: 1;
}

body.dark-mode .search-box i {
    color: #ce93d8;
}

body.dark-mode .btn.small {
    background-color: rgba(200, 150, 220, 0.15);
    border: 1px solid rgba(206, 147, 216, 0.3);
    color: #d4a5ff;
}

body.dark-mode .btn.small:hover {
    background-color: rgba(200, 150, 220, 0.25);
}

body.dark-mode .profile-modal-content,
body.dark-mode .profile-modal-header,
body.dark-mode .profile-modal-footer {
    background: #1a0d1f;
}

body.dark-mode .content-text,
body.dark-mode .topic-title,
body.dark-mode .profile-info h3 {
    color: #e8eaed;
}

body.dark-mode .motivational-quote {
    background: rgba(255, 255, 255, 0.05);
}

/* ===== AI CHAT STYLES ===== */

/* AI Buddy Button */
.ai-buddy-button {
    position: fixed;
    bottom: 110px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #CE93D8, #9C27B0, #6A1B9A);
    background-size: 200% 200%;
    color: white;
    border: none;
    box-shadow: 0 4px 20px rgba(156, 39, 176, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: all 0.3s ease;
    font-size: 1.5rem;
    animation: aiPulse 2s ease-in-out infinite, gradientShift 4s ease infinite;
}

@keyframes aiPulse {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(156, 39, 176, 0.4);
    }
    50% {
        box-shadow: 0 4px 30px rgba(156, 39, 176, 0.6), 0 0 20px rgba(207, 147, 216, 0.3);
    }
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.ai-buddy-button:hover {
    transform: scale(1.1) rotate(10deg);
    box-shadow: 0 6px 35px rgba(156, 39, 176, 0.5), 0 0 25px rgba(207, 147, 216, 0.4);
}

.ai-buddy-button i {
    animation: robotBounce 1s ease-in-out infinite;
}

@keyframes robotBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    /* backdrop-filter: blur(4px); */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    animation: modalFadeIn 0.3s ease-in-out forwards;
}

/* Side panel variant for AI chat */
.modal.side-panel {
    justify-content: flex-end;
    align-items: stretch;
    animation: none;
    background-color: rgba(0, 0, 0, 0.3);
    /* backdrop-filter: blur(4px); */
    opacity: 1;
}

.modal.side-panel .modal-content {
    animation: slideInRight 0.4s ease-in-out forwards;
    border-radius: 0;
    width: 100%;
    max-width: 450px;
    max-height: 100vh;
    margin: 0;
}

.modal.hidden {
    display: none;
}

.modal.hidden.side-panel .modal-content {
    animation: slideOutRight 0.4s ease-in-out forwards;
}

@keyframes modalFadeIn {
    to {
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* AI Chat Panel Styles */
.ai-chat-panel {
    display: flex;
    position: fixed;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
}

.ai-chat-panel .modal-header {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #CE93D8 0%, #9C27B0 50%, #6A1B9A 100%);
    color: white;
    padding: 1.5rem;
    border-bottom: none;
}

@keyframes gradientFlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.ai-header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.ai-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    animation: aiGlow 2s ease-in-out infinite;
}

@keyframes aiGlow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    }
}

.ai-chat-panel .modal-header h2 {
    margin: 0;
    font-size: 1.3rem;
    color: white;
}

.ai-status {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
}

.ai-chat-panel .icon-btn {
    color: white;
    border: none;
}

.ai-chat-panel .icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.ai-chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: var(--glass-bg);
    min-height: 0;
}

/* Custom scrollbar for AI chat */
.ai-chat-body::-webkit-scrollbar {
    width: 8px;
}

.ai-chat-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}

.ai-chat-body::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #CE93D8, #9C27B0, #6A1B9A);
    border-radius: 10px;
    transition: all 0.3s ease;
}

.ai-chat-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #E1BEE7, #BA68C8, #9C27B0);
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-message {
    display: flex;
    gap: 0.75rem;
    animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.1rem;
}

.message-avatar.ai {
    background: linear-gradient(135deg, #CE93D8, #9C27B0, #6A1B9A);
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
    color: white;
}

.message-avatar.user {
    background: linear-gradient(135deg, #E1BEE7, #BA68C8);
    color: white;
}

.message-content {
    max-width: 75%;
    padding: 0.875rem 1.125rem;
    border-radius: 16px;
    line-height: 1.5;
    word-wrap: break-word;
}

/* Markdown formatting in messages */
.message-content h1,
.message-content h2,
.message-content h3 {
    margin: 0.75rem 0 0.5rem 0;
    font-weight: 600;
    line-height: 1.3;
}

.message-content h1 { font-size: 1.5rem; }
.message-content h2 { font-size: 1.25rem; }
.message-content h3 { font-size: 1.1rem; }

.message-content h1:first-child,
.message-content h2:first-child,
.message-content h3:first-child {
    margin-top: 0;
}

.message-content strong {
    font-weight: 600;
    color: inherit;
}

.message-content em {
    font-style: italic;
}

.message-content code {
    background: rgba(0, 0, 0, 0.08);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
}

.message-content pre {
    background: rgba(0, 0, 0, 0.05);
    border-left: 3px solid var(--primary-purple);
    padding: 0.75rem;
    border-radius: 6px;
    overflow-x: auto;
    margin: 0.5rem 0;
}

.message-content pre code {
    background: none;
    padding: 0;
    display: block;
    white-space: pre;
}

.message-content ul,
.message-content ol {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.message-content ul {
    list-style-type: disc;
}

.message-content ol {
    list-style-type: decimal;
}

.message-content li {
    margin: 0.25rem 0;
    line-height: 1.6;
}

.chat-message.ai .message-content {
    background: linear-gradient(135deg, rgba(206, 147, 216, 0.08), rgba(156, 39, 176, 0.08), rgba(106, 27, 154, 0.04));
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
    border: 1px solid rgba(156, 39, 176, 0.2);
    color: var(--darker);
    border-bottom-left-radius: 4px;
}

.chat-message.user .message-content {
    background: linear-gradient(135deg, #BA68C8, #9C27B0, #7B1FA2);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-time {
    font-size: 0.75rem;
    color: var(--medium);
    margin-top: 0.25rem;
    display: block;
}

.chat-message.user .message-time {
    text-align: right;
    color: rgba(255, 255, 255, 0.7);
}

/* Read More/Less functionality */
.read-more-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.message-text-truncated {
    display: block;
    max-height: 180px;
    overflow: hidden;
    position: relative;
    line-height: 1.5;
}

/* Gradient fade-out effect at bottom of truncated text */
.message-text-truncated::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(to bottom, transparent, #ffffff80);
    pointer-events: none;
}

body.dark-mode .message-text-truncated::after {
    background: linear-gradient(to bottom, transparent, rgba(20, 20, 35, 0.92));
}

body.dark-mode .chat-message.ai .message-text-truncated::after {
    background: linear-gradient(to bottom, transparent, rgba(106, 27, 154, 0.35));
}

body.dark-mode .chat-message.user .message-text-truncated::after {
    background: linear-gradient(to bottom, transparent, rgba(123, 31, 162, 0.85));
}

.message-text-full {
    display: none;
    line-height: 1.5;
    word-wrap: break-word;
}

.read-more-btn {
    align-self: flex-start;
    background: none;
    border: none;
    color: rgb(244, 66, 241);
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 500;
    padding: 0.25rem 0;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    
}

.read-more-btn:hover {
    color: #ff003c;
    transform: translateX(2px);
}

.read-more-btn:active {
    transform: translateX(0);
}

.typing-indicator {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 0;
    animation: messageSlideIn 0.3s ease-out;
}

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 0.875rem 1.125rem;
    background: linear-gradient(135deg, rgba(206, 147, 216, 0.15), rgba(156, 39, 176, 0.15));
    border: 1px solid rgba(156, 39, 176, 0.25);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, #CE93D8, #9C27B0, #6A1B9A);
    animation: typingBounce 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-8px);
    }
}

.ai-chat-footer {
    flex-shrink: 0;
    padding: 1rem 1.5rem;
    background: var(--glass-bg);
    border-top: var(--glass-border);
}

.chat-input-container {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

#chatInput {
    flex: 1;
    padding: 0.875rem 1rem;
    border-radius: 12px;
    border: var(--glass-border);
    background: rgba(255, 255, 255, 0.9);
    font-family: var(--font-main);
    font-size: 0.95rem;
    resize: none;
    max-height: 120px;
    transition: all 0.2s ease;
}

#chatInput:focus {
    outline: none;
    border-color: #4285F4;
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1);
}

.send-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #CE93D8, #9C27B0, #6A1B9A);
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(156, 39, 176, 0.4), 0 2px 8px rgba(106, 27, 154, 0.3);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.send-btn i {
    font-size: 1rem;
}

.scroll-to-bottom-btn {
    position: absolute;
    bottom: 80px;
    right: 1.5rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #c17aff, #bd2eff);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(189, 46, 255, 0.4);
    transition: all 0.3s ease;
    z-index: 10;
    font-size: 1rem;
}

.scroll-to-bottom-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(192, 46, 255, 0.6);
}

.scroll-to-bottom-btn:active {
    transform: scale(0.95);
}

/* Dark mode adjustments */
body.dark-mode .ai-chat-body {
    background: rgba(0, 0, 0, 0.6);
}

body.dark-mode .ai-chat-body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .ai-chat-body::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #CE93D8, #9C27B0, #6A1B9A);
}

body.dark-mode .ai-chat-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #E1BEE7, #BA68C8, #9C27B0);
}

body.dark-mode .chat-message.ai .message-content {
    background: linear-gradient(135deg, rgba(206, 147, 216, 0.12), rgba(156, 39, 176, 0.15), rgba(106, 27, 154, 0.08));
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
    border-color: rgba(156, 39, 176, 0.3);
    color: #e8eaed;
}

body.dark-mode .message-content code {
    background: rgba(255, 255, 255, 0.1);
}

body.dark-mode .message-content pre {
    background: rgba(255, 255, 255, 0.05);
    border-left-color: #5294ff;
}

body.dark-mode #chatInput {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    color: #e8eaed;
}

body.dark-mode .typing-dots {
    background: linear-gradient(135deg, rgba(206, 147, 216, 0.2), rgba(156, 39, 176, 0.2));
    border-color: rgba(156, 39, 176, 0.35);
}

body.dark-mode .ai-chat-footer {
    background: rgba(0, 0, 0, 0.6);
    border-top-color: rgba(255, 255, 255, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
    .ai-buddy-button {
        bottom: 100px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }

    .message-content {
        max-width: 85%;
    }

    .ai-chat-panel .modal-header {
        padding: 1rem;
    }

    .ai-header-content {
        gap: 0.75rem;
    }
}

/* ===== HELP BUTTON STYLES ===== */

/* Help Button */
.help-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--info);
    color: white;
    border: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: all 0.3s ease;
}

.help-button:hover {
    transform: scale(1.1);
    background-color: #1976d2;
}

.help-button svg {
    width: 24px;
    height: 24px;
}

/* Help Dialog */
.help-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.help-dialog-content {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: var(--glass-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 500px;
    padding: var(--space-lg);
    position: relative;
}

.close-help {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--dark);
    transition: all 0.2s ease;
}

.close-help:hover {
    transform: scale(1.2);
    color: var(--primary-purple);
}

.help-dialog-content h3 {
    color: var(--primary-purple);
    margin-bottom: var(--space-md);
    font-size: 1.5rem;
}

.help-dialog-content p {
    color: var(--dark);
    margin-bottom: var(--space-md);
    line-height: 1.6;
}

.developer-info {
    margin-top: var(--space-md);
    padding: var(--space-md);
    background-color: rgba(156, 39, 176, 0.05);
    border-radius: 8px;
    border-left: 3px solid var(--primary-purple);
}

.developer-info p {
    margin-bottom: var(--space-sm);
    color: var(--darker);
}

.developer-info a {
    display: block;
    color: var(--info);
    text-decoration: none;
    transition: all 0.2s ease;
    margin-top: var(--space-sm);
    font-weight: 500;
}

.developer-info a:hover {
    color: var(--primary-purple);
    text-decoration: underline;
}

body.dark-mode .help-dialog-content {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
}

body.dark-mode .close-help {
    color: #e8eaed;
}

body.dark-mode .close-help:hover {
    color: var(--primary-purple);
}

body.dark-mode .help-dialog-content h3 {
    color: var(--primary-purple);
}

body.dark-mode .help-dialog-content p {
    color: #e8eaed;
}

body.dark-mode .developer-info {
    background-color: rgba(156, 39, 176, 0.08);
    border-left-color: var(--primary-purple);
}

body.dark-mode .developer-info p {
    color: #e8eaed;
}

body.dark-mode .developer-info a {
    color: #64b5f6;
}

body.dark-mode .developer-info a:hover {
    color: var(--primary-purple);
}

.help-dialog.hidden {
    display: none;
}

@media (max-width: 768px) {
    .help-button {
        bottom: 30px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }

    .help-dialog-content {
        width: 95%;
        max-width: 90vw;
        padding: 1.5rem 1rem;
    }
}

/* ===== App Switcher ===== */
.wiggle {
    animation: wiggle 2s ease-in-out infinite;
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    10%, 30%, 50%, 70%, 90% { transform: rotate(-10deg); }
    20%, 40%, 60%, 80% { transform: rotate(10deg); }
}

.app-switcher-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.app-switcher-content {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
}

.dark-mode .app-switcher-content {
    background: var(--glass-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.app-switcher-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.app-switcher-header h3 {
    font-size: 1.5rem;
    color: var(--darker);
    margin: 0;
}

.dark-mode .app-switcher-header h3 {
    color: var(--white);
}

.close-dialog {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--dark);
    cursor: pointer;
    padding: 0.5rem;
    transition: transform 0.2s ease, color 0.2s ease;
}

.close-dialog:hover {
    transform: scale(1.1);
    color: var(--primary-purple);
}

.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.app-card {
    background: var(--white);
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    text-decoration: none;
    color: var(--darker);
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.dark-mode .app-card {
    background: rgba(255, 255, 255, 0.05);
    color: var(--white);
}

.app-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.app-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    color: white;
}

.app-icon.blue-gradient {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.app-icon.amber-gradient {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
}

.app-icon.purple-gradient {
    background: linear-gradient(135deg, #8b5cf6, #a78bfa);
}

.app-card h4 {
    font-size: 1.2rem;
    margin: 0 0 0.5rem 0;
}

.app-card p {
    font-size: 0.9rem;
    color: var(--dark);
    margin: 0;
}

.dark-mode .app-card p {
    color: var(--medium);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .app-switcher-content {
        padding: 1.5rem;
    }

    .app-grid {
        grid-template-columns: 1fr;
    }

    .wiggle {
        animation: wiggle 1.5s ease-in-out infinite;
    }
}

/* .modal-text {
    overflow-y: scroll;
    max-height: 50px;
} */

@media (max-width: 600px) {
  .modal-text {
    overflow-y: auto;
    max-height: 120px;
    -webkit-overflow-scrolling: touch;
  }
}

/* ===== Bookmark Panel Styles ===== */
.bookmark-panel {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    background: var(--white);
}

.bookmark-panel .modal-header {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #CE93D8 0%, #9C27B0 50%, #6A1B9A 100%);
    color: white;
    padding: 1.5rem;
    border-bottom: none;
}

.bookmark-panel .modal-header h2 {
    margin: 0;
    font-size: 1.3rem;
    color: white;
}

.bookmark-panel .icon-btn {
    color: white;
    border: none;
}

.bookmark-panel .icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.bookmark-panel-search {
    padding: 1rem 1.5rem 0.5rem 1.5rem;
    background: var(--glass-bg);
    border-bottom: 1px solid rgba(156, 39, 176, 0.08);
}

.bookmark-search-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--white);
    border: 2px solid var(--primary-purple);
    border-radius: 12px;
    padding: 0.75rem 1.25rem;
    transition: all var(--transition);
}

.bookmark-search-box:focus-within {
    box-shadow: 0 0 0 4px rgba(156, 39, 176, 0.1);
}

.bookmark-search-box i {
    color: var(--primary-purple);
    font-size: 1.1rem;
}

.bookmark-search-box input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
    color: var(--darker);
    background: transparent;
}

.bookmark-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.5rem;
    background: var(--glass-bg);
}

.bookmark-item {
    background: linear-gradient(135deg, rgba(156, 39, 176, 0.05), rgba(123, 31, 162, 0.05));
    border-left: 4px solid var(--primary-purple);
    border-radius: 10px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(156, 39, 176, 0.05);
}

.bookmark-item:last-child {
    margin-bottom: 0;
}

.bookmark-item:hover {
    background: linear-gradient(135deg, rgba(156, 39, 176, 0.12), rgba(123, 31, 162, 0.10));
    box-shadow: 0 4px 16px rgba(156, 39, 176, 0.10);
}

.bookmark-title {
    font-weight: 700;
    color: var(--primary-purple);
    font-size: 1.05rem;
    margin-bottom: 0.2rem;
}

.bookmark-note {
    color: var(--medium);
    font-size: 0.95rem;
    margin-bottom: 0.1rem;
}

.bookmark-meta {
    display: flex;
    gap: 1.2rem;
    font-size: 0.85rem;
    color: var(--dark);
    margin-top: 0.1rem;
}

.bookmark-meta span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.bookmark-empty-message {
    text-align: center;
    color: var(--medium);
    font-style: italic;
    padding: 2rem 0.5rem;
}

/* Custom scrollbar for bookmark panel */
.bookmark-list::-webkit-scrollbar {
    width: 8px;
}
.bookmark-list::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 10px;
}
.bookmark-list::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #CE93D8, #9C27B0, #6A1B9A);
    border-radius: 10px;
    transition: all 0.3s ease;
}
.bookmark-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #E1BEE7, #BA68C8, #9C27B0);
}

/* Responsive */
@media (max-width: 768px) {
    .bookmark-panel .modal-header {
        padding: 1rem;
    }
    .bookmark-panel-search {
        padding: 0.75rem 1rem 0.5rem 1rem;
    }
    .bookmark-list {
        padding: 1rem 1rem;
    }
}

/* Dark mode adjustments for bookmark panel */
body.dark-mode .bookmark-panel {
    background: #1a0d1f;
}
body.dark-mode .bookmark-panel .modal-header {
    background: linear-gradient(135deg, #2d1a3d 0%, #7B1FA2 100%);
    color: #e8eaed;
}
body.dark-mode .bookmark-panel-search {
    background: rgba(0, 0, 0, 0.6);
    border-bottom: 1px solid rgba(156, 39, 176, 0.15);
}
body.dark-mode .bookmark-search-box {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--primary-purple);
}
body.dark-mode .bookmark-search-box input {
    color: #e8eaed;
}
body.dark-mode .bookmark-list {
    background: rgba(0, 0, 0, 0.6);
}
body.dark-mode .bookmark-item {
    background: linear-gradient(135deg, rgba(156, 39, 176, 0.10), rgba(123, 31, 162, 0.10));
    color: #e8eaed;
    border-left-color: var(--primary-purple);
}
body.dark-mode .bookmark-item:hover {
    background: linear-gradient(135deg, rgba(156, 39, 176, 0.18), rgba(123, 31, 162, 0.15));
}
body.dark-mode .bookmark-title {
    color: #e1bee7;
}
body.dark-mode .bookmark-note {
    color: #b39ddb;
}
body.dark-mode .bookmark-meta {
    color: #b39ddb;
}
body.dark-mode .bookmark-empty-message {
    color: #b39ddb;
}

