/* Optional stylesheet for templates */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Symbols+2&display=swap');

body {
    font-family: 'Calibri', 'Noto Sans', 'Noto Sans Symbols 2', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #FFF5E6 0%, #FFE6E6 50%, #E6F3FF 100%);
    font-size: 17px;
}

/* Sunrise-inspired light palette */
.light {
    background: linear-gradient(135deg, #FFF5E6 0%, #FFE6E6 50%, #E6F3FF 100%);
}

.light .bg-light-primary {
    background: #FFFFFF;
}

.light .bg-light-secondary {
    background: #FFF8ED;
}

.light .bg-light-accent {
    background: #FFE5D0;
}

.light .text-light-primary {
    color: #2D2520;
}

.light .text-light-secondary {
    color: #5D4E47;
}

.light .text-light-muted {
    color: #8B7D75;
}

.light .border-light {
    border-color: #FFE0CC;
}

/* Gemini-like Auto-Hide Sidebar */
.gemini-sidebar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-right: 1px solid #FFE0CC;
    width: 280px;
    min-width: 280px;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    position: relative;
    z-index: 30;
    box-shadow: 2px 0 10px rgba(255, 155, 80, 0.1);
}

.gemini-sidebar.collapsed {
    width: 16px;
    min-width: 16px;
}

.gemini-sidebar.collapsed .sidebar-content {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.gemini-sidebar.collapsed::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.95) 0%, transparent 100%);
}

.sidebar-content {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.gemini-main {
    background: linear-gradient(135deg, #FFF5E6 0%, #FFE6E6 50%, #E6F3FF 100%);
    flex: 1;
    transition: margin-left 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.gemini-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #FFE0CC;
    height: 64px;
    box-shadow: 0 2px 10px rgba(255, 155, 80, 0.1);
}

.gemini-chat-container {
    background: transparent;
    scroll-padding-top: 80px;
    scroll-padding-bottom: 20px;
    scroll-behavior: smooth;
}

.gemini-chat-container img {
    max-width: 100%;
    height: auto;
}

/* Welcome Modal */
.welcome-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 245, 230, 0.95);
    backdrop-filter: blur(12px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.welcome-modal.show {
    opacity: 1;
    visibility: visible;
}

.welcome-content {
    background: #FFFFFF;
    border: 2px solid #FFE0CC;
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 25px 50px -12px rgba(255, 155, 80, 0.3);
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }

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

.context-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 245, 230, 0.9);
    backdrop-filter: blur(8px);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
}

.context-modal.show {
    opacity: 1;
    visibility: visible;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.context-panel {
    background: #FFFFFF;
    border: 2px solid #FFE0CC;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(255, 155, 80, 0.3);
}

.camera-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(45, 37, 32, 0.9);
    backdrop-filter: blur(8px);
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.camera-modal.show {
    opacity: 1;
    visibility: visible;
}

.context-button {
    background: linear-gradient(135deg, #FF9B50 0%, #FF7F50 100%);
    border: none;
    border-radius: 24px;
    padding: 12px 20px;
    color: white;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(255, 155, 80, 0.3);
}

.context-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(255, 155, 80, 0.4);
}

.context-button:disabled {
    background: #E0D5CD;
    color: #8B7D75;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.message-animation {
    animation: slideInUp 0.3s ease-out;
    transform-origin: bottom;
    margin-bottom: 1.5rem;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

.typing-indicator span {
    animation: typing 1.4s infinite ease-in-out;
    background: #FF9B50;
    border-radius: 50%;
    width: 8px;
    height: 8px;
    display: inline-block;
    margin: 0 2px;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

.scrollbar-hide::-webkit-scrollbar {
    width: 6px;
}

.scrollbar-hide::-webkit-scrollbar-track {
    background: #FFF8ED;
}

.scrollbar-hide::-webkit-scrollbar-thumb {
    background: #FFE0CC;
    border-radius: 3px;
}

.scrollbar-hide::-webkit-scrollbar-thumb:hover {
    background: #FFD4B8;
}

.prose-dark h3 {
    color: #2D2520;
    font-weight: 600;
    margin-bottom: 8px;
}

.prose-dark p {
    color: #2D2520;
    line-height: 1.8;
    margin-bottom: 16px;
    text-align: justify;
    font-size: 17px;
}

.prose-dark strong {
    color: #2D2520;
    font-weight: 600;
}

.prose-dark {
    color: #2D2520 !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-family: 'Calibri', 'Noto Sans', 'Noto Sans Symbols 2', 'Inter', sans-serif;
    font-size: 17px;
}

.hybrid-badge {
    background: linear-gradient(135deg, #FF9B50, #FF7F50);
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.semantic-badge {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 9px;
    font-weight: 600;
}

.keyword-badge {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 9px;
    font-weight: 600;
}

.pymupdf-badge {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
}

.question-type-badge {
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
}

.question-type-one_word {
    background: #fee2e2;
    color: #dc2626;
}

.question-type-2_marks {
    background: #fef3c7;
    color: #d97706;
}

.question-type-4_marks {
    background: #dbeafe;
    color: #2563eb;
}

.question-type-6_marks {
    background: #dcfce7;
    color: #16a34a;
}

.question-type-default {
    background: #f3f4f6;
    color: #6b7280;
}

.conversation-item {
    transition: all 0.2s ease;
    cursor: pointer;
    border-radius: 8px;
    margin: 2px 8px;
}

.conversation-item:hover {
    background: #FFF8ED;
}

.conversation-item.active {
    background: #FFE5D0;
    border-left: 3px solid #FF9B50;
}

.conversation-title {
    font-size: 14px;
    font-weight: 500;
    color: #2D2520;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-time {
    font-size: 12px;
    color: #8B7D75;
}

[x-cloak] {
    display: none !important;
}

.new-chat-btn {
    background: linear-gradient(135deg, #FF9B50 0%, #FF7F50 100%);
    border: 1px solid #FFE0CC;
    border-radius: 8px;
    padding: 8px 16px;
    color: white;
    font-weight: 500;
    transition: all 0.2s ease;
}

.new-chat-btn:hover {
    background: linear-gradient(135deg, #FF8A3D 0%, #FF6F3D 100%);
    transform: translateY(-1px);
}

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #5D4E47;
    margin-bottom: 6px;
}

.form-select {
    width: 100%;
    padding: 12px;
    background: #FFF8ED;
    border: 1px solid #FFE0CC;
    border-radius: 8px;
    color: #2D2520;
    font-size: 14px;
    transition: all 0.2s ease;
}

.form-select:focus {
    outline: none;
    border-color: #FF9B50;
    box-shadow: 0 0 0 3px rgba(255, 155, 80, 0.1);
}

.form-select:disabled {
    background: #FFFFFF;
    color: #8B7D75;
    cursor: not-allowed;
}

.apply-context-btn {
    background: linear-gradient(135deg, #FF9B50 0%, #FF7F50 100%);
    border: none;
    border-radius: 8px;
    padding: 12px 24px;
    color: white;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.apply-context-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(255, 155, 80, 0.4);
}

.apply-context-btn:disabled {
    background: #E0D5CD;
    color: #8B7D75;
    cursor: not-allowed;
    transform: none;
}

.scroll-to-bottom-btn {
    position: fixed;
    bottom: 140px;
    right: 32px;
    z-index: 20;
    background: linear-gradient(135deg, #FF9B50 0%, #FF7F50 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(255, 155, 80, 0.4);
    transition: all 0.3s ease;
}

.scroll-to-bottom-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 155, 80, 0.6);
}

@media (max-width: 768px) {
    .gemini-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 40;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .gemini-sidebar.show {
        transform: translateX(0);
    }

    .gemini-sidebar.collapsed {
        transform: translateX(-100%);
    }

    .scroll-to-bottom-btn {
        bottom: 120px;
        right: 16px;
        width: 40px;
        height: 40px;
    }
}

/* Gemini-style Loading Animation */
.gemini-loader-container {
    position: relative;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1rem 0;
}

.gemini-loader {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    padding: 3px;
    background: linear-gradient(135deg, #4285F4, #9B72CB, #EA4335, #FBBC04);
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: gemini-spin 1.5s linear infinite;
}

.gemini-logo-center {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: white;
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.gemini-logo-center img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.gemini-logo-center i {
    font-size: 18px;
    background: linear-gradient(135deg, #FF9B50 0%, #FF7F50 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

@keyframes gemini-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ========================================
   ChatGPT-Style Streaming Animations
   ======================================== */

/* Typing Cursor */
@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

.typing-cursor {
    display: inline-block;
    width: 2px;
    height: 1.2em;
    background: #FF9B50;
    margin-left: 3px;
    animation: blink 1s step-end infinite;
    vertical-align: text-bottom;
}

/* Smooth character fade-in */
@keyframes charFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.streaming-char {
    animation: charFadeIn 0.15s ease-out;
}

/* Message streaming container */
.streaming-message {
    position: relative;
    display: inline;
}

/* Smooth scroll behavior */
.gemini-chat-container {
    scroll-behavior: smooth;
}

/* Markdown rendering in streamed content */
.streaming-content {
    white-space: pre-wrap;
    word-wrap: break-word;
}