@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');
@import url('tutor.css');

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: #f8fafc;
    background-image:
        radial-gradient(at 0% 0%, rgba(124, 58, 237, 0.03) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(59, 130, 246, 0.03) 0px, transparent 50%);
    background-attachment: fixed;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Outfit', sans-serif;
}

.dark body {
    background-color: #020617;
    /* Deepest Navy */
    background-image:
        radial-gradient(at 0% 0%, rgba(124, 58, 237, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(59, 130, 246, 0.05) 0px, transparent 50%);
    color: #e2e8f0;
}

/* Glassmorphism Utilities */
.glass-panel {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.dark .glass-panel {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.glass-card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 2px 4px -1px rgba(0, 0, 0, 0.02);
}

.dark .glass-card {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.03);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

.page-section {
    display: none;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.page-section:not(.hidden) {
    display: block;
}

#confirm-modal,
#edit-modal,
#ai-loading-modal,
#syllabus-modal,
#exam-modal {
    z-index: 100;
}

.modal-box {
    animation: scaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.dark ::-webkit-scrollbar-thumb {
    background: #334155;
}

.heatmap-grid {
    display: grid;
    grid-template-columns: repeat(53, 1fr);
    gap: 3px;
}

.heatmap-cell {
    padding-top: 100%;
    border-radius: 4px;
    /* Softer corners */
    transition: transform 0.1s;
}

.heatmap-cell:hover {
    transform: scale(1.2);
    z-index: 10;
}

select optgroup {
    font-weight: bold;
    font-style: normal;
    color: #64748b;
}

.dark select optgroup {
    color: #94a3b8;
}

/* Improved Drag Styles */
.draggable-item {
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s;
    cursor: grab;
}

.draggable-item:active {
    cursor: grabbing;
    transform: scale(1.02);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* Lecture Item Drag Styles */
.lecture-item {
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.lecture-item:active {
    cursor: grabbing;
}

/* Drag Handle Animations */
.drag-handle {
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.lecture-item:hover .drag-handle,
.lecture-item:active .drag-handle {
    transform: scale(1.2);
}

.drag-handle:active {
    transform: scale(0.9);
}

/* Touch Feedback */
@media (hover: none) and (pointer: coarse) {
    .lecture-item:active {
        transform: scale(0.98);
        background-color: rgba(99, 102, 241, 0.05);
    }

    .drag-handle {
        opacity: 1;
        color: #94a3b8;
    }
}

/* Drop Indicators */
.drop-above {
    border-top: 4px solid #6366f1 !important;
    background: linear-gradient(to bottom, rgba(99, 102, 241, 0.1) 0%, transparent 100%);
}

.drop-below {
    border-bottom: 4px solid #6366f1 !important;
    background: linear-gradient(to top, rgba(99, 102, 241, 0.1) 0%, transparent 100%);
}

.category-drop-zone {
    min-height: 20px;
    transition: background-color 0.2s;
}

.category-drag-over {
    background-color: rgba(139, 92, 246, 0.1);
    border: 2px dashed #8b5cf6 !important;
}

/* Markdown Styles for AI Response */
.prose p {
    margin-bottom: 0.5em;
}

.prose ul {
    list-style-type: disc;
    padding-left: 1.2em;
    margin-bottom: 0.5em;
}

.prose strong {
    color: #8b5cf6;
}

.dark .prose strong {
    color: #a78bfa;
}

/* Mobile Responsiveness Fixes */
@media (max-width: 768px) {

    /* Prevent horizontal scroll */
    body {
        overflow-x: hidden;
        max-width: 100vw;
    }

    /* Ensure main content area doesn't overflow */
    main {
        overflow-x: hidden;
        max-width: 100%;
    }

    /* Home menu container - prevent horizontal scroll */
    #smart-queue-container {
        max-width: 100%;
        overflow-x: hidden;
    }

    /* Home menu cards - better mobile spacing and layout */
    #smart-queue-container .glass-card {
        padding: 16px !important;
        /* Override md:p-6, give more breathing room than p-3 */
        margin-bottom: 12px;
    }

    /* Card content layout improvements */
    #smart-queue-container .glass-card .flex {
        gap: 12px !important;
        /* Ensure consistent spacing */
    }

    /* Text sizing improvements for mobile */
    #smart-queue-container h3 {
        font-size: 15px !important;
        /* Slightly larger than base for readability */
        line-height: 1.4;
    }

    #smart-queue-container p {
        font-size: 11px !important;
        /* Improve small text readability */
    }

    /* Button sizing - prevent cramming */
    #smart-queue-container button {
        min-width: 36px;
        min-height: 36px;
        padding: 8px;
    }

    /* Icon containers - ensure they don't shrink too much */
    #smart-queue-container .w-10,
    #smart-queue-container .h-10 {
        width: 40px !important;
        height: 40px !important;
        flex-shrink: 0;
    }

    /* Ensure text truncation works properly on mobile */
    #smart-queue-container .truncate {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100%;
    }

    /* Better spacing for intake section on mobile */
    #smart-queue-container .mb-8 {
        margin-bottom: 16px !important;
    }

    /* Improve button row layout to prevent overlap */
    #smart-queue-container .flex.items-center.gap-2 {
        gap: 8px !important;
        flex-wrap: nowrap;
    }

    /* Ensure card doesn't cause horizontal overflow */
    #smart-queue-container>* {
        max-width: 100%;
        box-sizing: border-box;
    }
}