/* ==========================================================================
   GLOBAL RESET: Force normal font-style across all elements (Wipes Italics)
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

* {
    box-sizing: border-box;
}

body, input, textarea, button, select {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
*, *:before, *:after, i, em, blockquote, cite, var, address, .italic {
    font-style: normal !important;
}

:root {
    --sidebar-width: 240px;
    --sidebar-mini-width: 72px;
    --border-soft: #e9ecef;
    --text-soft: #6c757d;
    --bg-soft: #f7f8fa;
    --premium-shadow: 0 24px 60px rgba(15, 23, 42, 0.08);
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter;
    color: #111827;
    overflow: hidden;
}

.app-shell {
    display: flex;
    height: 100vh;
    width: 100%;
}

.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(24px);
    border-right: 1px solid var(--border-soft);
    transition: width 0.25s ease;
    display: flex;
    flex-direction: column;
    padding: 12px;
    position: relative;
    z-index: 10;
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-mini-width);
    padding: 12px 0;
    align-items: center;
}

.sidebar.collapsed .sidebar-header {
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    min-height: auto;
    margin-bottom: 12px;
}

.sidebar.collapsed .brand {
    justify-content: center;
    width: 100%;
    min-height: 44px;
}

.sidebar.collapsed .brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    margin-left: 0;
}

.sidebar.collapsed .brand-icon img {
    width: 22px;
    height: 22px;
}

.sidebar.collapsed .sidebar-toggle {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    margin: 0 auto;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 44px;
    margin-bottom: 18px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    min-width: 0;
}

.brand-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: #ffffff;
    border: 1px solid var(--border-soft);
    box-shadow: 0 12px 24px rgba(17, 24, 39, 0.08);
    flex-shrink: 0;
    overflow: hidden;
    margin-left: 10px;
}

.brand-icon img {
    width: 26px;
    height: 26px;
    object-fit: contain;
    display: block;
}

.brand-text {
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.2s ease;
}

.brand-text strong {
    display: block;
    font-size: 15px;
}

.brand-text span {
    font-size: 12px;
    color: var(--text-soft);
}

.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .chat-title,
.sidebar.collapsed .chat-meta,
.sidebar.collapsed .upgrade-card {
    opacity: 0;
    pointer-events: none;
    width: 0;
    overflow: hidden;
}

.sidebar-toggle {
    border: 1px solid var(--border-soft);
    background: white;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: #374151;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: #f3f4f6;
}

.new-chat-btn {
    border: 1px solid var(--border-soft);
    background: #ffffff;
    border-radius: 14px;
    height: 46px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 14px;
    font-weight: 600;
    color: #111827;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.04);
    transition: all 0.2s ease;
    width: 100%;
    margin-bottom: 14px;
}

.new-chat-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 34px rgba(15, 23, 42, 0.08);
}

.sidebar.collapsed .new-chat-btn {
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 14px;
    flex-shrink: 0;
    margin-left: auto;
    margin-right: auto;
}

.sidebar.collapsed .new-chat-btn span {
    display: none;
}

.nav-menu {
    display: grid;
    gap: 6px;
    margin-bottom: 18px;
}

.nav-item-custom {
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 12px;
    color: #4b5563;
    text-decoration: none;
    transition: all 0.2s ease;
    font-size: 14px;
    white-space: nowrap;
}

.nav-item-custom:hover,
.nav-item-custom.active {
    background: #f3f4f6;
    color: #111827;
}

.nav-item-custom i {
    font-size: 18px;
    flex-shrink: 0;
}

.sidebar.collapsed .nav-menu {
    width: 42px;
    justify-items: center;
    margin-left: auto;
    margin-right: auto;
}

.sidebar.collapsed .nav-item-custom {
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 14px;
}

.recent-label {
    font-size: 12px;
    font-weight: 700;
    color: #9ca3af;
    margin: 8px 0;
    padding-left: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.chat-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 2px;
}

.chat-list::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-list::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 999px;
}

.chat-history-item {
    border-radius: 13px;
    padding: 10px 12px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #374151;
    min-height: 44px;
}

.chat-history-item:hover {
    background: #f3f4f6;
}

.chat-history-item i {
    margin-top: 2px;
    color: #9ca3af;
    flex-shrink: 0;
}

.chat-title {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-meta {
    font-size: 11px;
    color: #9ca3af;
    white-space: nowrap;
}

.sidebar.collapsed .chat-list {
    width: 42px;
    padding-right: 0;
    margin-left: auto;
    margin-right: auto;
}

.sidebar.collapsed .chat-history-item {
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 14px;
}

.upgrade-card {
    background: linear-gradient(135deg, #ffffff, #f4f6fb);
    border: 1px solid var(--border-soft);
    border-radius: 18px;
    padding: 14px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.06);
    transition: opacity 0.2s ease;
}

.upgrade-card strong {
    display: block;
    font-size: 14px;
    margin-bottom: 4px;
}

.upgrade-card p {
    font-size: 12px;
    color: var(--text-soft);
    margin-bottom: 10px;
}

.main {
    flex: 1;
    min-width: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
}

.topbar {
    height: 64px;
    padding: 0 24px;
    border-bottom: 1px solid rgba(233, 236, 239, 0.75);
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(18px);
    position: relative;
    z-index: 3;
}

.topbar-inner {
    width: 100%;
    height: 100%;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.topbar-title {
    font-size: 15px;
    font-weight: 700;
}

.topbar-subtitle {
    font-size: 12px;
    color: var(--text-soft);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.topbar-new-chat-btn {
    border: 1px solid var(--border-soft);
    background: #ffffff;
    color: #111827;
    height: 36px;
    border-radius: 999px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
    transition: all 0.2s ease;
}

.topbar-new-chat-btn:hover {
    background: #f8f9fb;
    transform: translateY(-1px);
}

.profile-pill {
    border: 1px solid var(--border-soft);
    background: white;
    border-radius: 999px;
    padding: 5px 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.04);
}

.profile-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #111827;
    color: white;
    font-size: 12px;
    font-weight: 700;
}

.chat-area {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.chat-area::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 50% 18%, rgba(255, 190, 222, 0.14), transparent 24%),
        radial-gradient(circle at 26% 72%, rgba(255, 212, 235, 0.12), transparent 28%),
        radial-gradient(circle at 78% 66%, rgba(196, 168, 255, 0.10), transparent 24%);
    pointer-events: none;
    z-index: 0;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 32px 28px 230px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
}

.welcome-state {
    min-height: calc(100vh - 250px);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    transition: all 0.35s ease;
    margin-bottom: 125px
}

.welcome-inner {
    width: min(780px, 100%);
    text-align: center;
    animation: fadeUp 0.5s ease both;
}

.spark-icon {
    width: 68px;
    height: 68px;
    border-radius: 24px;
    margin: 0 auto 22px;
    display: grid;
    place-items: center;
    background: white;
    box-shadow: var(--premium-shadow);
    border: 1px solid var(--border-soft);
    overflow: hidden;
}

.spark-icon img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    display: block;
}

.welcome-inner h1 {
    font-size: clamp(32px, 5vw, 54px);
    letter-spacing: -0.055em;
    font-weight: 750;
    margin-bottom: 14px;
    color: #111827;
}

.welcome-inner p {
    color: var(--text-soft);
    font-size: 16px;
    max-width: 620px;
    margin: 0 auto 28px;
}

.suggestions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    width: min(720px, 100%);
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.suggestion-card {
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid var(--border-soft);
    border-radius: 18px;
    padding: 16px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 14px 38px rgba(15, 23, 42, 0.04);
}

.suggestion-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 22px 50px rgba(15, 23, 42, 0.08);
}

.suggestion-card strong {
    display: block;
    font-size: 14px;
    margin-bottom: 4px;
}

.suggestion-card span {
    color: var(--text-soft);
    font-size: 13px;
}

.message-stack {
    width: min(820px, 100%);
    display: none;
    flex-direction: column;
    gap: 24px;
    margin-bottom: 100px;
}

.message-stack.active {
    display: flex;
}

.message-row {
    display: flex;
    gap: 14px;
    width: 100%;
    animation: fadeUp 0.25s ease both;
}

.message-row.user {
    justify-content: flex-end;
}

.message-avatar {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    background: #ffffff;
    color: #111827;
    font-size: 14px;
    border: 1px solid var(--border-soft);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.message-row.user .message-avatar {
    order: 2;
    background: #f3f4f6;
    color: #111827;
    border: 1px solid var(--border-soft);
    box-shadow: none;
}

.message-bubble {
    max-width: 100%;
    border-radius: 22px;
    padding: 15px 17px;
    font-size: 10px;
    line-height: 1.55;
    background: white;
    border: 1px solid var(--border-soft);
    box-shadow: 0 16px 42px rgba(15, 23, 42, 0.05);
}

.message-row.user .message-bubble {
    background: #111827;
    color: white;
    border-color: #111827;
    box-shadow: 0 18px 46px rgba(17, 24, 39, 0.16);
}

.thinking-bubble {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #6b7280;
    font-weight: 500;
}

.thinking-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.thinking-dots span {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #9ca3af;
    animation: thinkingPulse 1.2s infinite ease-in-out;
}

.thinking-dots span:nth-child(2) {
    animation-delay: 0.15s;
}

.thinking-dots span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes thinkingPulse {

    0%,
    80%,
    100% {
        opacity: 0.35;
        transform: translateY(0);
    }

    40% {
        opacity: 1;
        transform: translateY(-4px);
    }
}

.composer-wrap {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 24px;
    display: flex;
    justify-content: center;
    pointer-events: none;
    background: linear-gradient(180deg,
            rgba(255, 250, 252, 0) 0%,
            rgba(255, 246, 250, 0.82) 36%,
            rgba(255, 244, 249, 0.96) 72%,
            rgba(255, 247, 251, 1) 100%);
    z-index: 2;
}

.composer {
    width: min(920px, 100%);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(24px);
    border: 1px solid var(--border-soft);
    border-radius: 28px;
    box-shadow: var(--premium-shadow);
    padding: 12px;
    pointer-events: auto;
    transition: all 0.35s ease;
}

.composer.centered {
    transform: none;
    z-index: 5;
}

.composer-mode-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px;
    margin-bottom: 8px;
    background: #f7f7f9;
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    width: max-content;
    max-width: 100%;
    overflow-x: auto;
    
    /* Hide scrollbar for Firefox */
    scrollbar-width: none; 
    
    /* Hide scrollbar for IE & Old Edge */
    -ms-overflow-style: none; 
}
.composer-mode-bar::-webkit-scrollbar {
    display: none;
}

.mode-pill {
    border: 0;
    background: transparent;
    color: #5b6471;
    height: 34px;
    border-radius: 999px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.mode-pill:hover {
    background: #ffffff;
    color: #111827;
}

.mode-pill.active {
    background: #ffffff;
    color: #111827;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.composer-surface {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
}

.composer-meta-row {
    display: none;
}

.composer-meta-row.active {
    display: block;
}

.composer textarea {
    width: 100%;
    border: 0;
    outline: 0;
    resize: none;
    min-height: 54px;
    max-height: 160px;
    padding: 12px 14px;
    font-size: 15px;
    line-height: 1.5;
    background: transparent;
    color: #111827;
}

.composer textarea::placeholder {
    color: #9ca3af;
}

.composer-actions,
.composer-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 4px 4px 2px;
}

.composer-footer {
    margin-top: 0;
}

.tool-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.tool-btn {
    border: 1px solid var(--border-soft);
    background: #ffffff;
    color: #4b5563;
    height: 36px;
    border-radius: 999px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.tool-btn:hover {
    background: #f8f4f7;
    color: #111827;
}

.composer-configs {
    flex: 1;
    min-width: 0;
}

.config-row {
    display: none;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.config-row.active {
    display: flex;
}

.config-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #4f5662;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.config-chip i {
    font-size: 15px;
    opacity: 0.9;
}

.inline-toggle {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    user-select: none;
    color: #4f5662;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.inline-toggle input {
    display: none;
}

.inline-toggle-slider {
    width: 42px;
    height: 24px;
    border-radius: 999px;
    background: #eceef2;
    border: 1px solid #d7dce3;
    position: relative;
    transition: all 0.2s ease;
}

.inline-toggle-slider::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #b6b8bf;
    transition: all 0.2s ease;
}

.inline-toggle input:checked+.inline-toggle-slider {
    background: linear-gradient(135deg, rgba(245, 130, 180, 0.24), rgba(180, 135, 255, 0.24));
    border-color: #d7b2d9;
}

.inline-toggle input:checked+.inline-toggle-slider::after {
    left: 21px;
    background: #cc5f99;
}

.send-btn {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 15px;
    background: #111827;
    color: white;
    display: grid;
    place-items: center;
    transition: all 0.2s ease;
    box-shadow: 0 12px 28px rgba(17, 24, 39, 0.2);
    flex-shrink: 0;
}

.send-btn:hover {
    transform: translateY(-1px);
    background: #000000;
}

.small-sidebar-toggle {
    display: none;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

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

@media (max-width: 900px) {
    body {
        overflow: hidden;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        width: 240px;
        box-shadow: 30px 0 80px rgba(15, 23, 42, 0.12);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .sidebar.collapsed {
        width: 240px;
        padding: 12px;
        align-items: stretch;
    }

    .sidebar.collapsed .sidebar-header {
        flex-direction: row;
        justify-content: space-between;
        gap: 10px;
        min-height: 44px;
        margin-bottom: 18px;
    }

    .sidebar.collapsed .brand {
        justify-content: flex-start;
        width: auto;
        min-height: 44px;
    }

    .sidebar.collapsed .sidebar-toggle {
        width: 38px;
        height: 38px;
        border-radius: 12px;
        margin: 0;
    }

    .sidebar.collapsed .brand-text,
    .sidebar.collapsed .nav-label,
    .sidebar.collapsed .chat-title,
    .sidebar.collapsed .chat-meta,
    .sidebar.collapsed .upgrade-card {
        opacity: 1;
        width: auto;
        pointer-events: auto;
    }

    .sidebar.collapsed .new-chat-btn span {
        display: inline;
    }

    .sidebar.collapsed .new-chat-btn,
    .sidebar.collapsed .nav-item-custom,
    .sidebar.collapsed .chat-history-item {
        justify-content: flex-start;
        width: 100%;
        height: 42px;
        padding-inline: 12px;
        border-radius: 12px;
    }

    .sidebar.collapsed .nav-menu,
    .sidebar.collapsed .chat-list {
        width: 100%;
    }

    .small-sidebar-toggle {
        display: grid;
    }

    .topbar {
        padding: 0 16px;
    }

    .suggestions {
        grid-template-columns: 1fr;
    }

    .composer.centered {
        transform: none;
    }

    .welcome-inner p {
        margin-bottom: 28px;
    }

    .tool-btn span {
        display: none;
    }

    .message-bubble {
        max-width: 100%;
    }
}

@media (max-width: 575px) {
    .chat-messages {
        padding-inline: 14px;
    }

    .composer-wrap {
        padding: 14px;
    }

    .welcome-inner h1 {
        font-size: 34px;
    }

    .profile-pill span,
    .topbar-new-chat-btn span {
        display: none;
    }

    .topbar-new-chat-btn {
        width: 36px;
        padding: 0;
        justify-content: center;
    }
}