/* ---------------------------
   Configurable variables
   --------------------------- */
:root {
    /* Main theme colors */
    --primary-color: #ffffff;
    --text-color: #1f2937;
    --nav-bg: rgba(255, 255, 255, 0.1);
    --nav-text: #1f2937;
    --nav-hover: rgba(0, 0, 0, 0.1);

    /* Gradient colors */
    --gradient-start: #ea580c;
    --gradient-mid: #fb923c;
    --gradient-end: #fed7aa;

    /* Background effect colors */
    --center-color-1: #fed7aa;
    /* inner glow */
    --center-color-2: #fb923c;
    /* mid */
    --center-color-3: #ea580c;
    /* outer warm */
    --outer-dark-1: #071226;
    --outer-dark-2: #081522;

    /* Effect controls */
    --glow-strength: 0.8;
    --vignette-darkness: 0.72;
    --star-color: rgba(255, 255, 255, 0.9);
    --star-density: 150;
}

[data-theme="dark"] {
    --primary-color: #0d0806;
    --text-color: #ffffff;
    --nav-bg: rgba(0, 0, 0, 0.1);
    --nav-text: #ffffff;
    --nav-hover: rgba(255, 255, 255, 0.1);
    --gradient-start: #3d2914;
    --gradient-mid: #2a1810;
    --gradient-end: #1a0f0a;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Base styles */
html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: "Forum", serif;
    color: var(--text-color);
    cursor: url('../Assets/light_badge_cursor.png'), auto;
    overflow-x: hidden;
    position: relative;
}

/* Background root container */
.bg-root {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Background layers */
.bg-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

/* Main glow effect - disabled */
.bg-layer.glow {
    display: none;
}

/* Vignette effect */
.bg-layer.vignette {
    background: radial-gradient(60% 65% at 50% 40%,
            rgba(0, 0, 0, 0) 0%,
            rgba(0, 0, 0, 0) 45%,
            rgba(0, 0, 0, var(--vignette-darkness)) 100%);
    mix-blend-mode: multiply;
}

/* Star speckles */
.bg-layer.specks {
    background-image:
        radial-gradient(circle at 20% 10%, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px),
        radial-gradient(circle at 70% 40%, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px),
        radial-gradient(circle at 40% 80%, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px);
    background-size: 6% 6%, 9% 9%, 7% 7%, 5% 5%;
    opacity: 0.9;
    filter: blur(0.4px);
    mix-blend-mode: screen;
}

/* Content container */
.content {
    position: relative;
    z-index: 1;
    background: transparent;
}

/* Light mode gradient - simplified */
body {
    background: var(--gradient-mid);
    height: 100vh;
}

/* Dark mode gradient - simplified */
[data-theme="dark"] body {
    background: var(--gradient-mid);
    cursor: url('../Assets/dark_badge_cursor.png'), auto;
}

/* Navbar Styles */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 8rem;
    color: var(--nav-text);
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 600;
}

.logo-icon {
    width: 2.5rem;
    height: 2.5rem;
    object-fit: contain;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-home-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--nav-text);
    cursor: pointer;
    transition: transform 0.3s ease, color 0.3s ease;
}

.nav-home-link:hover {
    transform: scale(1.05);
    color: #f59e0b;
}

.nav-home-link:hover i {
    color: #f59e0b;
}

.nav-left i {
    font-size: 1.75rem;
    color: #f59e0b;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem;
}

.back-button {
    background: none;
    border: 1px dashed var(--nav-text);
    padding: 0.5rem;
    border-radius: 50%;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--nav-text);
}

.back-button:hover {
    background-color: var(--nav-hover);
    transform: scale(1.1);
}

.back-button i {
    font-size: 1.2rem;
}

#dark-mode-toggle {
    background: none;
    border: 1px dashed var(--nav-text);
    padding: 0.5rem;
    border-radius: 50%;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

#dark-mode-toggle:hover {
    background-color: var(--nav-hover);
    transform: scale(1.1);
}

.theme-icon {
    width: 1.5rem;
    height: 1.5rem;
    object-fit: contain;
}

/* Content Styles */
.content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-color);
    width: 100%;
}

h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

h1 img {
    width: 2.8rem;
    height: 2.8rem;
    object-fit: contain;
}

.quote {
    font-size: 1.2rem;
    font-style: italic;
    max-width: 600px;
    line-height: 1.6;
    margin: 0 auto 2rem auto;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

/* Chat Container */
.chat-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 750px;
    height: 500px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    margin: 0 auto;
    flex-shrink: 0;
}

[data-theme="dark"] .chat-container {
    background: rgba(20, 20, 20, 0.95);
    color: #f3f4f6;
}

/* Chat Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Message Styles */
.message {
    display: flex;
    flex-direction: row;
    animation: slideIn 0.3s ease;
    width: 100%;
    margin-bottom: 8px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user-message {
    justify-content: flex-end;
}

.message.ai-message {
    justify-content: flex-start;
}

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 12px;
    word-wrap: break-word;
    line-height: 1.5;
    font-size: 0.95rem;
    white-space: normal;
    word-break: break-word;
}

.user-message .message-content {
    background: linear-gradient(135deg, #ea580c, #fb923c);
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-message .message-content {
    background: #f3f4f6;
    color: #1f2937;
    border-bottom-left-radius: 4px;
}

[data-theme="dark"] .ai-message .message-content {
    background: #374151;
    color: #f3f4f6;
}

/* Loading indicator */
.message.loading .message-content {
    display: flex;
    gap: 4px;
    align-items: center;
}

.loading-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #1f2937;
    animation: bounce 1.4s infinite;
}

[data-theme="dark"] .loading-dot {
    background: #f3f4f6;
}

.loading-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        opacity: 0.5;
        transform: translateY(0);
    }

    40% {
        opacity: 1;
        transform: translateY(-8px);
    }
}

/* Chat Input Area */
.chat-input-area {
    display: flex;
    gap: 10px;
    padding: 15px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

[data-theme="dark"] .chat-input-area {
    background: #1f2937;
    border-top-color: #374151;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 25px;
    font-size: 0.95rem;
    outline: none;
    transition: all 0.3s ease;
    font-family: "Forum", serif;
}

.chat-input:focus {
    border-color: #ea580c;
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.1);
}

[data-theme="dark"] .chat-input {
    background: #374151;
    color: #f3f4f6;
    border-color: #4b5563;
}

[data-theme="dark"] .chat-input:focus {
    border-color: #fb923c;
    box-shadow: 0 0 0 3px rgba(251, 146, 60, 0.1);
}

.send-button {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ea580c, #fb923c);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.send-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(234, 88, 12, 0.3);
}

.send-button:active {
    transform: scale(0.95);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Scrollbar styling */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

[data-theme="dark"] .chat-messages::-webkit-scrollbar-thumb {
    background: #4b5563;
}

[data-theme="dark"] .chat-messages::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/* Suggestions Container */
.suggestions-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem;
    margin-top: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 152, 0, 0.2);
}

.suggestions-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #ff9800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.suggestions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.suggestion-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    background: rgba(255, 152, 0, 0.08);
    border: 1px solid rgba(255, 152, 0, 0.3);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.8rem;
    font-family: "Forum", serif;
    color: var(--text-color);
    font-weight: 500;
}

.suggestion-btn:hover {
    background: rgba(255, 152, 0, 0.15);
    border-color: rgba(255, 152, 0, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.15);
}

.suggestion-btn:active {
    transform: translateY(0);
}

.suggestion-icon {
    font-size: 1.5rem;
}

.suggestion-text {
    text-align: center;
    line-height: 1.3;
}

.suggestion-loading {
    text-align: center;
    padding: 1rem;
    color: #ff9800;
    font-size: 0.9rem;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

[data-theme="dark"] .suggestions-container {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 152, 0, 0.25);
}

[data-theme="dark"] .suggestion-btn {
    background: rgba(255, 152, 0, 0.1);
    border-color: rgba(255, 152, 0, 0.35);
    color: #f3f4f6;
}

[data-theme="dark"] .suggestion-btn:hover {
    background: rgba(255, 152, 0, 0.18);
    border-color: rgba(255, 152, 0, 0.6);
}

/* Tablet Responsive (768px - 1023px) */
@media screen and (min-width: 768px) and (max-width: 1023px) {
    .navbar {
        padding: 1.5rem 3.75rem;
        /* 60px */
    }

    .content {
        padding: 0 1.875rem;
        /* 30px left-right */
    }

    .chat-container {
        margin: 0 5.625rem;
        /* 90px left-right margin for chatbox */
        max-width: calc(100% - 11.25rem);
        /* Adjust max-width to account for margins */
    }
}

/* Responsive */
@media (max-width: 768px) {

    /* MOBILE-OPTIMIZED LAYOUT */
    body {
        height: 100vh;
        overflow: hidden;
    }

    /* Compact Header */
    .navbar {
        padding: 0.5rem 1rem;
        background: rgba(0, 0, 0, 0.05);
        backdrop-filter: blur(10px);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .nav-left {
        gap: 0.4rem;
        font-size: 1rem;
    }

    .logo-icon {
        width: 1.5rem;
        height: 1.5rem;
    }

    .logo-text {
        font-size: 1rem;
        font-weight: 600;
    }

    .nav-right {
        gap: 0.5rem;
        padding: 0;
    }

    .back-button,
    #dark-mode-toggle {
        width: 1.8rem;
        height: 1.8rem;
        padding: 0.3rem;
        border-width: 1px;
    }

    .back-button i {
        font-size: 0.9rem;
    }

    .theme-icon {
        width: 1rem;
        height: 1rem;
    }

    /* Compact Title Section */
    .content {
        padding: 0;
        height: calc(100vh - 60px);
        display: flex;
        flex-direction: column;
    }

    h1 {
        font-size: 1.3rem;
        margin: 0.5rem 0 0.3rem 0;
        padding: 0 1rem;
    }

    h1 img {
        width: 1.5rem;
        height: 1.5rem;
    }

    .quote {
        font-size: 0.8rem;
        margin: 0 1rem 0.8rem 1rem;
        line-height: 1.4;
    }

    /* MODERN CHAT CONTAINER - Like ChatGPT Mobile */
    .chat-container {
        max-width: 100%;
        width: 100%;
        height: calc(100vh - 140px);
        background: transparent !important;
        border-radius: 0;
        box-shadow: none;
        margin: 0;
        display: flex;
        flex-direction: column;
        position: relative;
    }

    [data-theme="dark"] .chat-container {
        background: transparent !important;
    }

    /* Seamless Chat Messages - No Box Background */
    .chat-messages {
        flex: 1;
        overflow-y: auto;
        padding: 0.5rem 1rem 80px 1rem;
        background: transparent;
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    /* Message Bubbles */
    .message {
        margin-bottom: 6px;
    }

    .message-content {
        max-width: 85%;
        padding: 10px 14px;
        font-size: 0.9rem;
        line-height: 1.4;
        border-radius: 16px;
    }

    .user-message .message-content {
        background: linear-gradient(135deg, #ea580c, #fb923c);
        color: white;
        border-bottom-right-radius: 4px;
        box-shadow: 0 2px 8px rgba(234, 88, 12, 0.2);
    }

    .ai-message .message-content {
        background: rgba(255, 255, 255, 0.95);
        color: #1f2937;
        border-bottom-left-radius: 4px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }

    [data-theme="dark"] .ai-message .message-content {
        background: rgba(55, 65, 81, 0.95);
        color: #f3f4f6;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }

    /* BOTTOM-FIXED INPUT - Like ChatGPT Mobile */
    .chat-input-area {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 12px 16px 20px 16px;
        background: transparent;
        backdrop-filter: none;
        border-top: none;
        box-shadow: none;
        z-index: 1000;
        display: flex;
        gap: 8px;
        align-items: center;
    }

    [data-theme="dark"] .chat-input-area {
        background: transparent;
        border-top: none;
        box-shadow: none;
    }

    /* Modern Input Field */
    .chat-input {
        flex: 1;
        padding: 12px 16px;
        border: 1.5px solid rgba(0, 0, 0, 0.1);
        border-radius: 24px;
        font-size: 0.9rem;
        background: rgba(255, 255, 255, 0.9);
        color: #1f2937;
        transition: all 0.2s ease;
    }

    .chat-input:focus {
        border-color: #ea580c;
        background: white;
        box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.08);
    }

    [data-theme="dark"] .chat-input {
        background: rgba(55, 65, 81, 0.9);
        color: #f3f4f6;
        border-color: rgba(255, 255, 255, 0.15);
    }

    [data-theme="dark"] .chat-input:focus {
        border-color: #fb923c;
        background: #374151;
        box-shadow: 0 0 0 3px rgba(251, 146, 60, 0.08);
    }

    /* Modern Send Button */
    .send-button {
        width: 42px;
        height: 42px;
        min-width: 42px;
        border-radius: 50%;
        background: linear-gradient(135deg, #ea580c, #fb923c);
        box-shadow: 0 4px 12px rgba(234, 88, 12, 0.25);
        font-size: 1rem;
    }

    .send-button:active {
        transform: scale(0.92);
    }

    /* Suggestions - Mobile Optimized (Below Answers) */
    .suggestions-container {
        padding: 1rem;
        margin: 1rem 0 0.5rem 0;
        background: rgba(255, 255, 255, 0.1);
        border-radius: 12px;
        border: 1px solid rgba(255, 152, 0, 0.2);
        width: 100%;
        display: block;
    }

    [data-theme="dark"] .suggestions-container {
        background: rgba(0, 0, 0, 0.2);
        border-color: rgba(255, 152, 0, 0.25);
    }

    .suggestions-label {
        font-size: 0.75rem;
        margin-bottom: 0.75rem;
        display: block;
        text-align: left;
        color: #ff9800;
    }

    .suggestions-grid {
        display: flex;
        flex-direction: column;
        gap: 0.6rem;
        width: 100%;
    }

    .suggestion-btn {
        padding: 0.9rem 1rem;
        font-size: 0.8rem;
        border-radius: 10px;
        text-align: left;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        background: rgba(255, 152, 0, 0.1);
        border: 1px solid rgba(255, 152, 0, 0.3);
    }

    [data-theme="dark"] .suggestion-btn {
        background: rgba(255, 152, 0, 0.12);
        border-color: rgba(255, 152, 0, 0.35);
    }

    .suggestion-btn:active {
        transform: scale(0.98);
        background: rgba(255, 152, 0, 0.18);
    }

    .suggestion-text {
        text-align: left;
        flex: 1;
        line-height: 1.4;
    }

    .suggestion-icon {
        font-size: 1.1rem;
        margin-left: 0.5rem;
        flex-shrink: 0;
    }

    /* Smooth Scrolling */
    .chat-messages {
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
    }

    /* Hide scrollbar on mobile for cleaner look */
    .chat-messages::-webkit-scrollbar {
        width: 3px;
    }

    .chat-messages::-webkit-scrollbar-track {
        background: transparent;
    }

    .chat-messages::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.15);
        border-radius: 10px;
    }

    [data-theme="dark"] .chat-messages::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.15);
    }

    /* Loading Animation - Mobile Optimized */
    .loading-dot {
        width: 6px;
        height: 6px;
    }

    /* Prevent body scroll when chat is active */
    body.chat-active {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }

    /* Safe area for notched devices (iPhone X+) */
    @supports (padding: max(0px)) {
        .chat-input-area {
            padding-bottom: max(20px, env(safe-area-inset-bottom));
        }
    }
}

/* Extra Small Devices (< 375px) */
@media (max-width: 374px) {
    .navbar {
        padding: 0.4rem 0.8rem;
    }

    .logo-text {
        font-size: 0.9rem;
    }

    h1 {
        font-size: 1.1rem;
    }

    .quote {
        font-size: 0.75rem;
    }

    .chat-input {
        font-size: 0.85rem;
        padding: 10px 14px;
    }

    .send-button {
        width: 38px;
        height: 38px;
        min-width: 38px;
    }
}