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

/* Sustally AI Master Stylesheet - PDF Accurate Design */
:root {
    /* Dark Mode Theme Tokens (Matches PDF) */
    --bg-main: #141416;
    /* Very dark grey, almost black */
    --bg-card: #1c1c20;
    --bg-sidebar: #0f0f11;
    --bg-input: #1a1a1e;
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --border-color: #27272a;
    --accent-purple: #9333ea;
    --accent-purple-hover: #7e22ce;
    --bubble-user: #27272a;
    --bubble-user-text: #ffffff;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
}

[data-theme="light"] {
    /* Light Mode Theme Tokens */
    --bg-main: #f4f4f5;
    --bg-card: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-input: #f4f4f5;
    /* Light grey input background */
    --text-primary: #18181b;
    --text-secondary: #52525b;
    --border-color: #e4e4e7;
    --accent-purple: #9333ea;
    --accent-purple-hover: #7e22ce;
    --bubble-user: #f4f4f5;
    --bubble-user-text: #18181b;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* --- THEME TOGGLE --- */
.theme-toggle-container {
    position: absolute;
    top: 20px;
    right: 36px;
    z-index: 1000;
}

.theme-toggle-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.4);
    width: 52px;
    height: 28px;
    border-radius: 14px;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

[data-theme="light"] .theme-toggle-btn {
    background: #ffffff;
    border: 2px solid #141416;
}

.theme-toggle-btn svg {
    width: 13px;
    height: 13px;
    z-index: 1;
}

.sun-icon {
    color: #ffffff;
}

[data-theme="light"] .sun-icon {
    color: #141416;
}

.moon-icon {
    color: #ffffff;
}

[data-theme="light"] .moon-icon {
    color: #141416;
}

.theme-toggle-thumb {
    position: absolute;
    top: 50%;
    left: 3px;
    width: 20px;
    height: 20px;
    background: #ffffff;
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    transform: translateY(-50%) translateX(24px);
    z-index: 2;
}

[data-theme="light"] .theme-toggle-thumb {
    background: #141416;
    transform: translateY(-50%) translateX(0px);
}


/* --- AUTH PAGES --- */
.auth-wrapper {
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: cEnter;
    justify-content: cEnter;
    padding: 20px;
}

.auth-card {
    position: relative;
    background-color: var(--bg-card);
    border-radius: 24px;
    padding: 36px;
    width: 100%;
    max-width: 560px;
    text-align: center;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.05);
}

.auth-card-close {
    position: absolute;
    top: 20px;
    right: 22px;
    font-size: 18px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.auth-card-close:hover {
    color: var(--text-primary);
    background-color: var(--border-color);
}

.brand-header {
    margin-bottom: 20px;
}

.brand-logo-img {
    height: 48px;
    width: auto;
    object-fit: contain;
}

[data-theme="light"] .brand-logo-img.dark-only {
    display: none;
}

[data-theme="dark"] .brand-logo-img.light-only {
    display: none;
}

.auth-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 12px;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 13.5px;
    margin-bottom: 24px;
    line-height: 1.5;
}

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

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    background-color: var(--bg-input);
    border: none;
    border-radius: var(--radius-md);
    padding: 12px 14px;
    color: var(--text-primary);
    font-size: 13.5px;
    outline: none;
    transition: background-color 0.2s;
}

.form-input:focus {
    background-color: var(--border-color);
}

.password-input-wrapper {
    position: relative;
    width: 100%;
}

.password-input-wrapper .form-input {
    padding-right: 44px;
}

.btn-eye-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    transition: color 0.2s;
}

.btn-eye-toggle:hover {
    color: var(--text-primary);
}

.btn-primary {
    width: 100%;
    background-color: var(--accent-purple);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px;
    font-size: 14.5px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 8px;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: var(--accent-purple-hover);
}

.auth-footer {
    margin-top: 24px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.auth-footer a {
    color: var(--accent-purple);
    text-decoration: underline;
    font-weight: 600;
}

/* --- MAIN CHAT APP --- */
.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
}

/* SIDEBAR */
.sidebar {
    width: 250px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 20px 16px;
    flex-shrink: 0;
}

.sidebar-header {
    margin-bottom: 6px;
    padding: 2px 0;
}

.sidebar-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 14px 0;
    opacity: 0.9;
}

.sidebar-actions-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-sidebar-action {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    background: transparent;
    color: var(--text-primary);
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    user-select: none;
    box-sizing: border-box;
}

.btn-sidebar-action:hover {
    background: var(--bg-card);
    border-color: var(--border-color);
}

.sidebar-search-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 8px 10px;
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    box-sizing: border-box;
}

.sidebar-search-input {
    width: 100%;
    background-color: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
}

.sidebar-search-input::placeholder {
    color: var(--text-primary);
    opacity: 0.95;
}

.recents-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 6px 10px;
    margin-bottom: 6px;
}

.recents-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.recent-item-wrapper {
    position: relative;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background-color 0.2s;
}

.recent-item-wrapper:hover,
.recent-item-wrapper.active {
    background-color: var(--bg-card);
}

.recent-item-link {
    color: var(--text-secondary);
    font-size: 13px;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    display: block;
}

.recent-item-wrapper:hover .recent-item-link,
.recent-item-wrapper.active .recent-item-link {
    color: var(--text-primary);
}

.recent-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.recent-item-wrapper:hover .recent-actions {
    opacity: 1;
}

.btn-recent-action {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-recent-action:hover {
    color: var(--text-primary);
    background-color: var(--border-color);
}

.btn-recent-action.btn-delete:hover {
    color: #ef4444;
}

.recent-item-wrapper.active .active-indicator {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: var(--accent-purple);
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
}

/* MODAL OVERLAY & CARD */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    text-align: left;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.modal-subtitle {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 24px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-modal-cancel {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 16px;
    color: var(--text-primary);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-modal-cancel:hover {
    background-color: var(--border-color);
}

.btn-modal-danger {
    background-color: #ef4444;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    color: #ffffff;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-modal-danger:hover {
    opacity: 0.9;
}

/* GUEST MODE SIDEBAR ELEMENTS */
.guest-recents-banner {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 12.5px;
    line-height: 1.4;
    margin: 4px 0;
}

.guest-recents-banner svg {
    color: var(--accent-purple);
}

.btn-guest-login-sm {
    display: inline-block;
    margin-top: 4px;
    padding: 5px 14px;
    background-color: var(--accent-purple);
    color: #ffffff;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s;
}

.btn-guest-login-sm:hover {
    opacity: 0.9;
}

.no-recents-msg {
    color: var(--text-secondary);
    font-size: 12.5px;
    padding: 10px 12px;
    font-style: italic;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.user-profile-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background-color: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.user-profile-info {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: #8b5cf6;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-logout-icon {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    text-decoration: none;
    flex-shrink: 0;
}

.btn-logout-icon:hover {
    color: #ef4444;
    background-color: rgba(239, 68, 68, 0.1);
}

.btn-sidebar-logout {
    display: block;
    width: 100%;
    background-color: var(--accent-purple);
    color: #ffffff;
    text-align: center;
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.btn-sidebar-logout:hover {
    background-color: var(--accent-purple-hover);
    opacity: 0.95;
}

/* Desktop Defaults for Mobile-Only Elements */
.btn-sidebar-close {
    display: none;
}

.sidebar-backdrop {
    display: none;
}

.mobile-top-bar {
    display: none;
}

.mobile-theme-toggle-slot {
    display: none;
}

/* CHAT MAIN CONTENT */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.chat-scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.chat-scroll-area.has-prompts {
    justify-content: flex-start;
    padding-top: 36px;
}

.chat-scroll-area.has-messages {
    justify-content: flex-start;
    padding: 30px 20px 120px 20px;
}

.landing-hero {
    text-align: center;
    margin-top: 0;
    margin-bottom: 20px;
}

.landing-title {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.landing-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

/* CHAT THREAD */
.messages-container {
    width: 100%;
    max-width: 768px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.message-row {
    display: flex;
    width: 100%;
}

.message-row.user {
    justify-content: flex-end;
    margin-bottom: 16px;
}

.message-bubble-user {
    background-color: var(--bg-card);
    border: 1px solid var(--accent-purple);
    color: var(--text-primary);
    padding: 10px 20px;
    border-radius: 20px;
    max-width: 70%;
    font-size: 14px;
    line-height: 1.5;
}

.message-row.assistant {
    justify-content: flex-start;
    margin-bottom: 24px;
}

.message-bubble-assistant {
    color: var(--text-primary);
    max-width: 100%;
    font-size: 14.5px;
    line-height: 1.65;
}

.message-bubble-assistant h1,
.message-bubble-assistant h2,
.message-bubble-assistant h3,
.message-bubble-assistant strong {
    color: var(--text-primary);
    font-weight: 600;
}

.message-bubble-assistant p {
    margin-bottom: 12px;
}

.message-bubble-assistant ul {
    margin-left: 20px;
    margin-bottom: 12px;
}

.message-bubble-assistant li {
    margin-bottom: 6px;
}

/* SESSION INPUT WRAPPER AT BOTTOM */
.session-input-wrapper {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px 20px 12px 20px;
    background: linear-gradient(to top, var(--bg-main) 75%, transparent 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 100;
    pointer-events: none;
}

.session-input-wrapper.hidden {
    display: none;
}

.session-chat-box,
.chat-disclaimer {
    pointer-events: auto;
}

.session-chat-box {
    width: 100%;
    max-width: 768px;
    height: 52px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 26px;
    padding: 6px 8px 6px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.session-chat-input {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
}

.chat-disclaimer {
    font-size: 11px;
    color: var(--text-secondary);
    text-align: center;
}

/* PROMPT SUGGESTION CARDS */
.prompt-cards-container {
    width: 100%;
    max-width: 640px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px auto 40px auto;
}

.prompt-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 18px;
    color: var(--text-primary);
    font-size: 13.5px;
    line-height: 1.45;
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: background-color 0.2s;
}

.prompt-card:hover {
    background-color: var(--bg-input);
}

/* FLOATING INPUT CONTAINER */
.input-floating-wrapper {
    position: relative;
    width: 100%;
    max-width: 768px;
    margin: 16px auto 0 auto;
}

.input-floating-wrapper.active-session-input {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    padding: 0 20px;
}

.chat-input-box {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    min-height: 100px;
    justify-content: space-between;
    transition: height 0.15s ease;
}

.chat-textarea {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
    resize: none;
    width: 100%;
    min-height: 44px;
    max-height: 300px;
    padding: 4px 8px;
    overflow-y: hidden;
    line-height: 1.5;
}

.chat-input-controls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 0 4px;
}

.industry-select {
    background-color: var(--bg-card);
    border: 1px solid var(--accent-purple);
    box-shadow: 0 0 10px rgba(124, 58, 237, 0.4);
    border-radius: 20px;
    padding: 6px 26px 6px 14px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
}

[data-theme="light"] .industry-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2318181b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

.industry-select:hover,
.industry-select:focus {
    box-shadow: 0 0 14px rgba(124, 58, 237, 0.6);
}

.btn-send {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--accent-purple);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    flex-shrink: 0;
}

.btn-send:hover {
    background-color: var(--accent-purple-hover);
}

@media (max-width: 768px) {
    .app-container {
        overflow-x: hidden;
    }

    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        height: 100vh;
        z-index: 2000;
        transition: left 0.3s ease;
        box-shadow: 0 0 20px rgba(0,0,0,0.1);
    }

    .sidebar.active {
        left: 0;
    }

    .chat-main {
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }

    .chat-scroll-area {
        padding: 16px 12px 100px 12px;
        box-sizing: border-box;
        width: 100%;
    }

    .landing-title {
        font-size: 22px;
        flex-wrap: wrap;
        text-align: center;
    }

    .landing-subtitle {
        font-size: 13px;
    }

    .input-floating-wrapper {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .chat-input-box {
        padding: 12px 14px;
        min-height: 100px;
        box-sizing: border-box;
        width: 100%;
    }

    .chat-input-controls {
        gap: 8px;
        flex-wrap: wrap;
        justify-content: space-between;
    }

    .industry-select {
        font-size: 12px;
        padding: 5px 8px 5px 12px;
        max-width: calc(100% - 44px);
    }

    .chat-header-bar {
        display: flex !important;
        justify-content: flex-start !important;
        padding-left: 16px;
        font-size: 22px;
        color: var(--text-primary);
    }

    .theme-toggle-container {
        top: 11px !important;
        right: 16px !important;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .prompt-cards-container {
        flex-direction: column;
        width: 100%;
        max-width: 100%;
    }

    .prompt-card {
        max-width: 100%;
        box-sizing: border-box;
    }
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    position: absolute;
    top: 16px;
    left: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px;
    color: var(--text-primary);
    cursor: pointer;
    z-index: 1000;
}

.chat-header-bar {
    display: none;
    width: 100%;
    height: 50px;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
}

/* Responsive Display Helper Classes */
.mobile-only {
    display: none !important;
}

.desktop-only {
    display: inline-flex !important;
}

/* TOAST NOTIFICATION POPUP (Rich Desktop Card / Crisp Mobile Pill) */
.toast-notification {
    position: fixed;
    top: 72px;
    right: 36px;
    background-color: var(--bg-card);
    border: 1px solid rgba(16, 185, 129, 0.45);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10000;
    animation: toastCardSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    pointer-events: auto;
}

[data-theme="light"] .toast-notification {
    background: #ffffff;
    border: 1px solid rgba(16, 185, 129, 0.5);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.toast-notification.fade-out {
    animation: toastCardFadeOut 0.3s ease forwards;
}

.toast-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background-color: rgba(16, 185, 129, 0.16);
    color: #10b981;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.toast-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #10b981;
    box-shadow: 0 0 6px #10b981;
    flex-shrink: 0;
}

.toast-message {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    letter-spacing: -0.1px;
}

.toast-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    padding: 2px 4px;
    margin-left: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
    line-height: 1;
}

.toast-close:hover {
    color: var(--text-primary);
    background-color: var(--border-color);
}

@keyframes toastCardSlideIn {
    from {
        opacity: 0;
        transform: translateY(-16px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes toastCardFadeOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-12px) scale(0.95);
    }
}
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-15px) scale(0.95);
    }
}

/* ==========================================================================
   MODAL DIALOGS (Rename, Delete, Guest Safety Warning)
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 20px;
    animation: modalOverlayFadeIn 0.2s ease-out;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    padding: 26px 28px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.5);
    animation: modalCardPopIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.3;
}

.modal-subtitle {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-bottom: 22px;
}

.modal-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.btn-modal-cancel {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-modal-cancel:hover {
    background: var(--bg-input);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.btn-modal-danger {
    background: #ef4444;
    border: 1px solid #dc2626;
    color: #ffffff;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-modal-danger:hover {
    background: #dc2626;
}

.form-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.form-input:focus {
    border-color: var(--accent-purple);
}

@keyframes modalOverlayFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes modalCardPopIn {
    from {
        opacity: 0;
        transform: scale(0.94) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* ==========================================================================
   MOBILE RESPONSIVE STYLES (VIVO Y56, Android, iOS, Tablets <= 768px)
   ========================================================================== */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden !important;
        width: 100% !important;
        height: 100% !important;
        height: 100dvh !important;
        position: relative !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .app-container {
        width: 100% !important;
        max-width: 100vw !important;
        height: 100% !important;
        height: 100dvh !important;
        overflow-x: hidden !important;
        position: relative !important;
        display: flex !important;
        flex-direction: column !important;
    }

    /* Mobile Fixed Drawer Sidebar */
    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        width: 290px !important;
        max-width: 84vw !important;
        height: 100% !important;
        height: 100dvh !important;
        background-color: var(--bg-sidebar) !important;
        z-index: 3000 !important;
        transform: translateX(-100%) !important;
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1) !important;
        box-shadow: none !important;
        padding: 16px 14px !important;
        padding-bottom: max(14px, env(safe-area-inset-bottom, 14px)) !important;
        display: flex !important;
        flex-direction: column !important;
        box-sizing: border-box !important;
    }

    .sidebar.active {
        transform: translateX(0) !important;
        box-shadow: 16px 0 40px rgba(0, 0, 0, 0.75) !important;
    }

    .sidebar-header {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 0 !important;
        margin-bottom: 8px !important;
    }

    .brand-logo-wrapper {
        display: flex;
        align-items: center;
    }

    .btn-sidebar-close {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: transparent !important;
        border: 1px solid var(--border-color) !important;
        color: var(--text-secondary) !important;
        width: 32px !important;
        height: 32px !important;
        border-radius: 8px !important;
        font-size: 15px !important;
        cursor: pointer !important;
        transition: all 0.2s ease !important;
    }

    .btn-sidebar-close:hover {
        color: var(--text-primary) !important;
        background-color: var(--bg-card) !important;
    }

    /* Backdrop Overlay when Sidebar is open */
    .sidebar-backdrop {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100% !important;
        height: 100dvh !important;
        background: rgba(0, 0, 0, 0.68) !important;
        backdrop-filter: blur(4px) !important;
        -webkit-backdrop-filter: blur(4px) !important;
        z-index: 2900 !important;
        display: none !important;
        opacity: 0 !important;
        transition: opacity 0.25s ease !important;
    }

    .sidebar-backdrop.active {
        display: block !important;
        opacity: 1 !important;
    }

    /* Recents List Scrollable without pushing footer */
    .recents-list {
        flex: 1 1 auto !important;
        min-height: 80px !important;
        max-height: calc(100dvh - 310px) !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* Sidebar Footer Always Fully Visible at Bottom */
    .sidebar-footer {
        margin-top: auto !important;
        flex-shrink: 0 !important;
        padding-top: 12px !important;
        padding-bottom: max(10px, env(safe-area-inset-bottom, 10px)) !important;
        border-top: 1px solid var(--border-color) !important;
        background-color: var(--bg-sidebar) !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
    }

    .user-profile-card {
        padding: 9px 12px !important;
        border-radius: 10px !important;
    }

    .btn-sidebar-logout {
        padding: 9px 12px !important;
        font-size: 13px !important;
    }

    /* Mobile Top App Header Bar */
    .mobile-top-bar {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        height: 54px !important;
        min-height: 54px !important;
        padding: 0 16px !important;
        background: var(--bg-sidebar) !important;
        border-bottom: 1px solid var(--border-color) !important;
        flex-shrink: 0 !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 100 !important;
        box-sizing: border-box !important;
    }

    .mobile-hamburger-btn {
        background: transparent !important;
        border: none !important;
        color: var(--text-primary) !important;
        cursor: pointer !important;
        padding: 6px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 6px !important;
        z-index: 2 !important;
    }

    .mobile-brand-title {
        position: absolute !important;
        left: 50% !important;
        top: 50% !important;
        transform: translate(-50%, -50%) !important;
        font-size: 16px !important;
        font-weight: 600 !important;
        color: var(--text-primary) !important;
        letter-spacing: -0.2px !important;
        text-align: center !important;
        white-space: nowrap !important;
        pointer-events: none !important;
    }

    /* Chat Main Content on Mobile */
    .chat-main {
        width: 100% !important;
        max-width: 100vw !important;
        height: calc(100dvh - 54px) !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        position: relative !important;
    }

    /* Theme Toggle Button adjusted inside Mobile Header */
    .theme-toggle-container {
        display: none !important;
    }

    .mobile-theme-toggle-slot {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        z-index: 2 !important;
    }

    .mobileThemeToggleBtn {
        width: 44px !important;
        height: 26px !important;
        padding: 0 4px !important;
    }

    .theme-toggle-thumb {
        width: 18px !important;
        height: 18px !important;
    }

    [data-theme="dark"] .theme-toggle-thumb {
        transform: translateY(-50%) translateX(18px) !important;
    }

    .chat-scroll-area {
        padding: 16px 14px 80px 14px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .chat-scroll-area.has-messages {
        padding: 16px 14px 100px 14px !important;
    }

    .landing-title {
        font-size: 22px !important;
    }

    .landing-subtitle {
        font-size: 13px !important;
    }

    .input-floating-wrapper {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 8px !important;
    }

    .chat-input-box {
        width: 100% !important;
        max-width: 100% !important;
        padding: 12px 14px !important;
    }

    .prompt-cards-container {
        width: 100% !important;
        padding: 0 8px !important;
        gap: 8px !important;
    }

    .prompt-card {
        padding: 12px 14px !important;
        font-size: 12.5px !important;
    }

    .session-input-wrapper {
        padding: 0 10px 12px 10px !important;
        padding-bottom: max(12px, env(safe-area-inset-bottom, 12px)) !important;
    }

    .messages-container {
        width: 100% !important;
        gap: 16px !important;
    }

    .message-bubble-user {
        max-width: 88% !important;
        font-size: 13.5px !important;
        padding: 10px 14px !important;
    }

    .message-bubble-assistant {
        max-width: 95% !important;
        font-size: 13.5px !important;
        padding: 14px !important;
    }

    /* Mobile Recents: Always show Rename & Delete action buttons on touchscreens */
    .recent-actions {
        opacity: 1 !important;
        gap: 4px !important;
        flex-shrink: 0 !important;
    }

    .btn-recent-action {
        padding: 5px !important;
        color: var(--text-secondary) !important;
        opacity: 0.85 !important;
    }

    .btn-recent-action:active {
        opacity: 1 !important;
        color: var(--text-primary) !important;
    }

    .btn-recent-action.btn-delete:active {
        color: #ef4444 !important;
    }

    .recent-item-link {
        font-size: 13px !important;
        padding-right: 4px !important;
    }

    /* Mobile Responsive Display Helpers */
    .desktop-only {
        display: none !important;
    }

    .mobile-only {
        display: inline-flex !important;
    }

    /* Toast Notification on Mobile (Ultra-Crisp Micro Badge) */
    .toast-notification {
        top: 60px !important;
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        border-radius: 20px !important;
        max-width: 80vw !important;
        padding: 4px 10px !important;
        gap: 6px !important;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35) !important;
        background: rgba(18, 18, 20, 0.92) !important;
        border: 1px solid rgba(16, 185, 129, 0.35) !important;
    }

    [data-theme="light"] .toast-notification {
        background: rgba(255, 255, 255, 0.96) !important;
    }

    .toast-message {
        font-size: 11px !important;
    }
}