:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #db2777;
    --accent-color: #0d9488;
    --bg-gradient: linear-gradient(135deg, #f0fdf4, #e0e7ff, #fae8ff);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.8);
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    line-height: 1.6;
}

/* Background animated shapes */
.background-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
}

.shape {
    position: absolute;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 20s infinite alternate ease-in-out;
}

.shape-1 {
    width: 400px;
    height: 400px;
    background: var(--primary-color);
    top: -100px;
    left: -100px;
    border-radius: 50%;
}

.shape-2 {
    width: 500px;
    height: 500px;
    background: var(--secondary-color);
    bottom: -200px;
    right: -100px;
    border-radius: 50%;
    animation-delay: -5s;
}

.shape-3 {
    width: 300px;
    height: 300px;
    background: var(--accent-color);
    top: 40%;
    left: 60%;
    border-radius: 50%;
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, 50px) scale(1.2); }
}

/* Typography */
h1, h2, h3 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
}

.title-gradient {
    background: linear-gradient(to right, #818cf8, #c084fc, #f472b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
}

/* Layout */
.app-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    padding: 1rem 2rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.header-subtitle {
    font-weight: 800;
    font-size: 0.9rem;
    color: var(--primary-color);
    background: rgba(79, 70, 229, 0.1);
    padding: 0.4rem 0.8rem;
    border-radius: 12px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: -0.5px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.hidden {
    display: none !important;
}

/* Glassmorphism Card */
.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 3rem;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 35px 60px -15px rgba(0, 0, 0, 0.6);
}

.text-center {
    text-align: center;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

/* Forms */
.form-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 500px;
    margin: 0 auto;
    text-align: left;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

input, select {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid #cbd5e1;
    padding: 1rem;
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
    outline: none;
}

input:focus, select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
}

select option {
    background: white;
    color: var(--text-primary);
}

/* Buttons */
button {
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    border: none;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1.1rem;
    box-shadow: 0 4px 15px rgba(236, 72, 153, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 25px rgba(236, 72, 153, 0.5);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--text-secondary);
    color: var(--text-primary);
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
}

.btn-outline:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: 8px;
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(236, 72, 153, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(236, 72, 153, 0); }
    100% { box-shadow: 0 0 0 0 rgba(236, 72, 153, 0); }
}

/* Chat Screen */
.chat-box {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid var(--glass-border);
}

.message {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.avatar {
    font-size: 2rem;
    background: var(--glass-bg);
    padding: 0.5rem;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
}

.ai-message .text {
    background: rgba(99, 102, 241, 0.2);
    padding: 1rem;
    border-radius: 0 16px 16px 16px;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.evaluation-controls {
    text-align: center;
}

.evaluation-controls p {
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

input[type=range] {
    width: 100%;
    -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.1);
    height: 8px;
    border-radius: 4px;
    outline: none;
    padding: 0;
    margin-bottom: 0.5rem;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.8);
}

.range-labels {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

#range-value {
    font-weight: bold;
    color: white;
    font-size: 1.2rem;
}

/* Program Screen */
.action-bar {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.actions-right {
    display: flex;
    gap: 1rem;
}

.program-header {
    margin-bottom: 2rem;
}

.progress-container {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), var(--primary-color));
    border-radius: 4px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.countdown {
    color: var(--warning);
    font-weight: 600;
}

.program-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.day-card {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.02);
}

.day-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.06);
    border-color: var(--primary-color);
}

.day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.day-header h3 {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary-color);
    margin: 0;
}

.day-date {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.task-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.task-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.03);
    cursor: pointer;
    transition: background 0.2s;
}

.task-item:hover {
    background: rgba(0, 0, 0, 0.06);
}

.task-item.completed .task-text {
    text-decoration: line-through;
    color: var(--text-secondary);
    opacity: 0.7;
}

.task-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary-color);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.task-item.completed .task-checkbox {
    background: var(--success);
    border-color: var(--success);
}

.task-item.completed .task-checkbox::after {
    content: '✓';
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.task-text {
    font-size: 0.95rem;
    line-height: 1.4;
}

.tag {
    display: inline-block;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin-top: 4px;
    font-weight: bold;
}

.tag-tyt { background: rgba(99, 102, 241, 0.2); color: #818cf8; }
.tag-ayt { background: rgba(236, 72, 153, 0.2); color: #f472b6; }
.tag-deneme { background: rgba(34, 197, 94, 0.2); color: #4ade80; }

.ai-recommendation {
    display: flex;
    gap: 1rem;
    background: rgba(20, 184, 166, 0.1);
    border: 1px solid rgba(20, 184, 166, 0.3);
    padding: 1.5rem;
    border-radius: 16px;
    align-items: center;
}

.ai-recommendation .icon {
    font-size: 2rem;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 600px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 20px;
    display: flex;
    justify-content: space-around;
    padding: 0.5rem 1rem;
    z-index: 1000;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

.nav-item {
    background: transparent;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    font-size: 0.85rem;
}

.nav-item .nav-icon {
    font-size: 1.4rem;
    transition: transform 0.2s;
}

.nav-item:hover, .nav-item.active {
    color: white;
}

.nav-item.active {
    background: rgba(99, 102, 241, 0.2);
}

.nav-item:hover .nav-icon {
    transform: translateY(-2px);
}

/* PDF Specific Styles */
.hidden-in-web {
    display: none;
}

.jpeg-export-mode {
    width: 900px !important;
    max-width: none !important;
    background: white !important;
    padding: 20px !important;
    box-sizing: border-box !important;
    margin: 0 !important;
}

.jpeg-export-mode .program-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr 1fr !important; /* 3 Columns */
    gap: 20px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.jpeg-export-mode .day-card {
    width: 100% !important;
    padding: 20px !important;
    border-radius: 12px !important;
    margin: 0 !important;
    box-shadow: none !important;
    border: 1px solid #e2e8f0 !important;
    box-sizing: border-box !important;
    background-color: #f8fafc !important;
}

.jpeg-export-mode .day-header h3 {
    font-size: 18px !important;
    white-space: normal !important;
    text-align: left !important;
    margin-bottom: 15px !important;
    word-break: keep-all !important;
    color: #0f172a !important;
}

.jpeg-export-mode .task-item {
    padding: 8px !important;
    margin-bottom: 8px !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 8px !important;
    background: white !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
}

.jpeg-export-mode .task-text {
    font-size: 14px !important;
    line-height: 1.4 !important;
    word-break: break-word !important;
    width: 100% !important;
}

.jpeg-export-mode .time-badge,
.jpeg-export-mode .tag {
    font-size: 11px !important;
    padding: 4px 6px !important;
    display: inline-block !important;
}

.pdf-footer {
    text-align: right;
    margin-top: 10px;
    padding-right: 10px;
    color: #38bdf8; /* Light Blue */
    font-weight: bold;
    font-size: 0.9rem;
}/* Calendar Grid for Routines */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
    margin-top: 15px;
}
.calendar-col {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}
.calendar-col-header {
    background: #10b981;
    color: white;
    text-align: center;
    padding: 8px;
    font-weight: bold;
    font-size: 0.9rem;
}
.calendar-col .task-list {
    padding: 5px;
    list-style: none;
    margin: 0;
}
.calendar-col .task-item {
    flex-direction: column;
    align-items: flex-start;
    padding: 8px;
    margin-bottom: 5px;
    gap: 5px;
    border-bottom: 1px solid #e2e8f0;
}
.calendar-col .task-item:last-child {
    border-bottom: none;
}

@media (max-width: 768px) {
    .calendar-grid {
        grid-template-columns: 1fr; /* Stack vertically on small screens */
    }
}

@media print {
    @page {
        size: portrait; /* Aktif Konular and Kuyruk are portrait */
        margin: 10mm;
    }
    
    @page landscapePage {
        size: landscape; /* Weekly routines are landscape */
    }

    body, .app-container {
        background: white !important;
        margin: 0 !important;
        padding: 0 !important;
        max-width: 100% !important;
    }
    
    /* Hide everything that isn't the PDF content */
    body > *:not(.app-container) { display: none !important; }
    .app-container > *:not(#screen-weekly) { display: none !important; }
    #screen-weekly > *:not(#pdf-content) { display: none !important; }
    
    .bottom-nav, .action-bar, button {
        display: none !important;
    }
    
    .hidden-in-web {
        display: block !important;
    }

    #pdf-content {
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
    }
    
    .program-header {
        display: none !important;
    }

    /* Print 1 column per page for 3 separate pages */
    #pdf-content .program-grid {
        display: block !important;
        width: 100% !important;
    }
    
    .day-card {
        width: 100% !important;
        height: 98vh !important; /* Force to take full height of the printed page */
        display: flex !important;
        flex-direction: column !important;
        break-inside: avoid !important;
        border: 2px solid #1e293b !important;
        border-radius: 8px !important;
        padding: 20px !important;
        background: #f8fafc !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        page-break-after: always !important;
        margin-bottom: 0 !important;
        box-sizing: border-box !important;
    }

    .day-card:last-child {
        page-break-after: auto !important;
        page: landscapePage; /* Force the 3rd page to be landscape */
    }

    .print-page-header {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        margin-bottom: 20px !important;
        padding-bottom: 10px !important;
        border-bottom: 2px solid #e2e8f0 !important;
    }
    
    .print-page-header h2 {
        font-size: 18px !important;
        color: #0f172a !important;
        margin: 0 0 5px 0 !important;
        font-weight: 800 !important;
    }
    
    .print-page-header h3 {
        font-size: 14px !important;
        color: #475569 !important;
        margin: 0 !important;
        font-weight: 600 !important;
    }

    .print-page-footer {
        display: flex !important;
        justify-content: space-between !important;
        align-items: flex-end !important;
        margin-top: auto !important; /* Pushes footer to the bottom */
        padding-top: 15px !important;
        border-top: 2px solid #e2e8f0 !important;
        font-size: 12px !important;
        color: #334155 !important;
    }
    
    .print-page-footer div {
        line-height: 1.4 !important;
    }
    
    .calendar-grid {
        display: grid !important;
        grid-template-columns: repeat(7, 1fr) !important; /* 7 columns horizontally when printing */
        gap: 5px !important;
    }
    
    .calendar-col {
        border: 1px solid #000 !important;
    }

    .calendar-col-header {
        color: black !important;
        border-bottom: 1px solid #000 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .day-header h3 {
        color: black !important;
        border-bottom: 1px solid #000 !important;
        padding-bottom: 5px !important;
        margin-bottom: 10px !important;
    }

    .pdf-footer {
        position: relative !important;
        text-align: right !important;
        margin-top: 30px !important;
        color: black !important;
        font-weight: bold !important;
    }
    
    .background-shapes {
        display: none !important;
    }
    .glass-card {
        background: white !important;
        border: 1px solid #ccc !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
    }
    .title-gradient {
        background: none !important;
        -webkit-text-fill-color: black !important;
        color: black !important;
    }
    .task-item {
        background: #f8fafc !important;
        border: 1px solid #e2e8f0 !important;
        color: black !important;
    }
    .tag-tyt, .tag-ayt, .tag-deneme {
        background: #e2e8f0 !important;
        color: #333 !important;
    }
    .action-bar {
        display: none !important;
    }
    .hidden-in-web {
        display: block !important;
        text-align: center;
        margin-bottom: 2rem;
        border-bottom: 2px solid #333;
        padding-bottom: 1rem;
    }
}

/* WIZARD & ACCORDION STYLES */
.wizard-progress {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    position: relative;
}
.wizard-progress::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--glass-border);
    z-index: 0;
}
.step {
    background: #e2e8f0;
    border: 2px solid #cbd5e1;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    position: relative;
    z-index: 1;
    color: var(--text-secondary);
    transition: all 0.3s;
}
.step.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}
.two-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.wizard-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 1rem;
}
.mt-2 { margin-top: 2rem; }

/* Accordion */
.topic-accordion-container {
    text-align: left;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 10px;
}
.accordion-item {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    margin-bottom: 0.5rem;
    overflow: hidden;
}
.accordion-header {
    padding: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.02);
}
.accordion-header:hover {
    background: rgba(0, 0, 0, 0.05);
}
.accordion-body {
    padding: 1rem;
    display: none;
    flex-direction: column;
    gap: 0.5rem;
    border-top: 1px solid var(--glass-border);
}
.accordion-body.open {
    display: flex;
}
.topic-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
}
.topic-checkbox input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Timeline & Sortable */
.time-badge {
    font-size: 0.8rem;
    background: rgba(79, 70, 229, 0.1);
    padding: 2px 6px;
    border-radius: 6px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 4px;
    display: inline-block;
}
.drag-handle {
    cursor: grab;
    font-size: 1.2rem;
    opacity: 0.5;
}
.drag-handle:active {
    cursor: grabbing;
}
.task-item {
    align-items: center;
}
.sortable-ghost {
    opacity: 0.4;
    background: var(--primary-color);
}

/* ===== MOBILE RESPONSIVE ===== */

@media screen and (max-width: 768px) {
    /* Global overflow prevention */
    html, body {
        overflow-x: hidden;
        width: 100%;
    }

    .app-container {
        padding: 0.75rem;
        max-width: 100%;
    }

    /* Header */
    header {
        flex-direction: column;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
        margin-bottom: 1.5rem;
        border-radius: 16px;
        text-align: center;
    }

    .logo h1 {
        font-size: 1.1rem;
    }

    .user-info {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }

    .header-subtitle {
        font-size: 0.75rem;
        padding: 0.3rem 0.6rem;
    }

    /* Glass Card */
    .glass-card {
        padding: 1.25rem;
        border-radius: 16px;
    }

    .glass-card:hover {
        transform: none;
    }

    /* Typography */
    .title-gradient {
        font-size: 1.3rem;
        margin-bottom: 0.75rem;
    }

    .subtitle {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }

    /* Forms */
    .form-grid {
        max-width: 100%;
        gap: 1rem;
    }

    .two-cols {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .two-cols > div {
        grid-column: span 1 !important;
    }

    input, select {
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    /* Buttons */
    .btn-primary {
        padding: 0.75rem 1.25rem;
        font-size: 0.95rem;
        width: 100%;
        text-align: center;
    }

    .btn-outline {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    /* Action bar */
    .action-bar {
        flex-direction: column;
        gap: 0.5rem;
    }

    .action-bar button {
        width: 100%;
        text-align: center;
    }

    /* Program grid - single column on mobile */
    .program-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Day cards */
    .day-card {
        padding: 1rem;
        border-radius: 12px;
    }

    .day-card:hover {
        transform: none;
    }

    .day-header h3 {
        font-size: 0.95rem;
    }

    /* Tasks */
    .task-item {
        gap: 0.5rem;
        padding: 0.5rem;
        flex-wrap: nowrap;
    }

    .task-text {
        font-size: 0.85rem;
        line-height: 1.35;
        word-break: break-word;
        overflow-wrap: break-word;
        min-width: 0;
    }

    .time-badge {
        font-size: 0.7rem;
        padding: 2px 4px;
        white-space: nowrap;
    }

    .tag {
        font-size: 0.65rem;
        padding: 1px 4px;
    }

    /* Wizard progress steps */
    .wizard-progress {
        gap: 0.25rem;
        margin-bottom: 1.5rem;
    }

    .step {
        padding: 0.35rem 0.6rem;
        font-size: 0.7rem;
    }

    .wizard-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .wizard-actions button {
        width: 100%;
    }

    /* Accordion (topic selection & progress) */
    .topic-accordion-container {
        padding-right: 0;
    }

    .accordion-header {
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    .accordion-body {
        padding: 0.75rem;
    }

    .topic-checkbox {
        font-size: 0.82rem;
        gap: 0.4rem;
    }

    .topic-checkbox input {
        width: 16px;
        height: 16px;
    }

    /* Chat box */
    .chat-box {
        padding: 1rem;
    }

    .message {
        gap: 0.5rem;
    }

    .avatar {
        font-size: 1.5rem;
        padding: 0.3rem;
    }

    .ai-message .text {
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    .evaluation-controls p {
        font-size: 0.95rem;
    }

    /* Bottom Nav */
    .bottom-nav {
        width: 95%;
        bottom: 10px;
        padding: 0.4rem 0.5rem;
        border-radius: 16px;
    }

    .nav-item {
        padding: 0.4rem 0.5rem;
        font-size: 0.7rem;
        gap: 2px;
    }

    .nav-item .nav-icon {
        font-size: 1.1rem;
    }

    /* Countdown */
    .countdown {
        font-size: 0.9rem !important;
    }

    .countdown small {
        font-size: 0.75rem !important;
    }

    /* History Tab */
    #history-container {
        margin-top: 1rem;
    }

    /* Exam Results */
    #exam-results-container {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    .exam-result-item {
        background: rgba(255, 255, 255, 0.4);
        padding: 1rem;
        border-radius: 12px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }

    .exam-result-info {
        display: flex;
        flex-direction: column;
    }

    .exam-result-title {
        font-weight: 700;
        color: var(--text-dark);
        font-size: 1rem;
    }

    .exam-result-date {
        font-size: 0.8rem;
        color: var(--text-light);
    }

    .exam-result-score {
        background: var(--primary-color);
        color: white;
        padding: 0.5rem 1rem;
        border-radius: 20px;
        font-weight: bold;
        font-size: 1.1rem;
    }

    /* Progress bar */
    .progress-container {
        margin: 0.75rem 0;
    }

    /* PDF footer */
    .pdf-footer {
        font-size: 0.8rem;
    }

    /* AI recommendation */
    .ai-recommendation {
        flex-direction: column;
        padding: 1rem;
        text-align: center;
        gap: 0.5rem;
    }

    /* Drag handle */
    .drag-handle {
        font-size: 1rem;
    }

    /* Ensure all content stays in bounds */
    *, *::before, *::after {
        max-width: 100%;
    }

    img, video, iframe {
        max-width: 100%;
        height: auto;
    }
}

/* Extra small phones */
@media screen and (max-width: 380px) {
    .app-container {
        padding: 0.5rem;
    }

    header {
        padding: 0.5rem 0.75rem;
    }

    .logo h1 {
        font-size: 0.95rem;
    }

    .glass-card {
        padding: 1rem;
        border-radius: 14px;
    }

    .title-gradient {
        font-size: 1.1rem;
    }

    .btn-primary {
        padding: 0.65rem 1rem;
        font-size: 0.85rem;
    }

    .nav-item {
        padding: 0.3rem 0.35rem;
        font-size: 0.65rem;
    }

    .nav-item .nav-icon {
        font-size: 1rem;
    }

    .step {
        padding: 0.25rem 0.4rem;
        font-size: 0.6rem;
    }

    .task-text {
        font-size: 0.8rem;
    }

    .accordion-header {
        font-size: 0.82rem;
        padding: 0.6rem;
    }
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.modal-overlay.hidden {
    display: none;
}
.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 1rem;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}
.modal-header {
    font-size: 1.25rem;
    font-weight: bold;
    margin-bottom: 1rem;
    color: var(--text-color);
}
.modal-body {
    margin-bottom: 1.5rem;
}
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
