/* ==========================================
   RESET & BASE STYLES
   ========================================== */
:root {
    /* Color Palette - Premium Light Dashboard */
    --bg-main: #ebf0f8;
    --bg-surface: #ffffff;
    --bg-sidebar: #f8fafc;

    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;

    --border-color: #e2e8f0;

    --primary: #2563eb;
    --primary-dark: #1e3a8a;

    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 32px;

    --shadow-soft: 0 10px 40px -10px rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 20px rgba(255, 255, 255, 0.7);

    --transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);

    /* Dark theme extra surfaces */
    --bg-card: #ffffff;
    --bg-input: #f8fafc;
    --body-gradient-a: #e4e9f3;
    --body-gradient-b: #f6f8fb;
    --body-gradient-c: #e2e5f5;
    --main-overlay-a: rgba(239, 246, 255, 0.6);
    --main-overlay-b: rgba(250, 245, 255, 0.6);
    --app-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.10), 0 0 0 1px rgba(255, 255, 255, 0.5) inset;
}

/* ── DARK THEME ─────────────────────────── */
[data-theme="dark"] {
    --bg-main: #0b0f19;
    --bg-surface: #111827;
    --bg-sidebar: #0b0f19;

    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-light: #64748b;

    --border-color: #334155;

    --primary: #60a5fa;
    --primary-dark: #3b82f6;

    --shadow-soft: 0 10px 40px -10px rgba(0, 0, 0, 0.6);
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(96, 165, 250, 0.2);

    --bg-card: #1e293b;
    --bg-input: #0f172a;
    --body-gradient-a: #0b0f19;
    --body-gradient-b: #0f172a;
    --body-gradient-c: #0b0f19;
    --main-overlay-a: rgba(59, 130, 246, 0.05);
    --main-overlay-b: rgba(96, 165, 250, 0.05);
    --app-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(51, 65, 85, 0.8) inset;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', -apple-system, sans-serif;
    background: linear-gradient(135deg, var(--body-gradient-a) 0%, var(--body-gradient-b) 50%, var(--body-gradient-c) 100%);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: background 0.3s ease, color 0.3s ease;
}

/* Base App Layout */
.app-container {
    display: flex;
    width: 95vw;
    height: 92vh;
    max-width: 1600px;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--app-shadow);
    overflow: hidden;
    position: relative;
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

/* ==========================================
   SIDEBAR
   ========================================== */
.sidebar {
    width: 80px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 0;
    justify-content: space-between;
    z-index: 10;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.sidebar-top {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    align-items: center;
    width: 100%;
}

.sidebar-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.icon-btn,
.nav-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.nav-btn:hover {
    background: var(--bg-input);
    color: var(--text-main);
}

.active-icon {
    background: var(--text-main);
    color: var(--bg-surface);
}

[data-theme="dark"] .active-icon {
    background: var(--primary);
    color: #0d1117;
}

.active-icon:hover {
    background: var(--primary-dark);
    color: white;
}

.spacer {
    height: 1px;
    width: 40%;
    background: var(--border-color);
    margin: 0.5rem 0;
}

.logo-mark {
    font-size: 2rem;
    color: var(--text-main);
    transition: transform 0.3s ease, color 0.3s ease;
    cursor: pointer;
}

.logo-mark:hover {
    transform: rotate(90deg);
}

/* ── THEME TOGGLE BUTTON ─────────────────── */
.theme-toggle-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1.5px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.theme-toggle-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: rotate(20deg) scale(1.05);
}

.theme-toggle-btn .icon-moon,
.theme-toggle-btn .icon-sun {
    position: absolute;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Light mode: show moon, hide sun */
.theme-toggle-btn .icon-moon {
    opacity: 1;
    transform: scale(1);
}

.theme-toggle-btn .icon-sun {
    opacity: 0;
    transform: scale(0.5);
}

/* Dark mode: show sun, hide moon */
[data-theme="dark"] .theme-toggle-btn .icon-moon {
    opacity: 0;
    transform: scale(0.5);
}

[data-theme="dark"] .theme-toggle-btn .icon-sun {
    opacity: 1;
    transform: scale(1);
}

/* ==========================================
   MAIN CONTENT
   ========================================== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background: radial-gradient(circle at top right, var(--main-overlay-a) 0%, transparent 40%),
        radial-gradient(circle at bottom left, var(--main-overlay-b) 0%, transparent 40%);
    transition: background 0.3s ease;
}

/* Top Header */
.top-header {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    border-bottom: 1px solid var(--border-color);
    transition: border-color 0.3s ease;
}

.assistant-selector {
    background: transparent;
    border: none;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.assistant-selector:hover {
    background: var(--bg-input);
    color: var(--text-main);
}

.assistant-selector i.ph-sparkle {
    color: #cbd5e1;
    font-size: 1.1rem;
}

.daily-text {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

.upgrade-btn {
    background: var(--text-main);
    color: var(--bg-surface);
    border: none;
    border-radius: 50px;
    padding: 0.6rem 1.25rem;
    font-family: inherit;
    font-weight: 500;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

.upgrade-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.2);
}

/* Hero Section */
.hero-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 4vh;
}

.hero-content {
    max-width: 900px;
    width: 100%;
    position: relative;
}

.hero-title {
    font-size: 3rem;
    font-weight: 500;
    letter-spacing: -0.04em;
    color: var(--text-main);
    margin-bottom: 3rem;
    max-width: 600px;
    line-height: 1.1;
}

.greeting {
    color: var(--text-muted);
    font-weight: 400;
}

.main-text {
    font-weight: 600;
}

/* Robot Illustration */
.robot-illustration {
    position: absolute;
    right: 0;
    top: -50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: floating 4s ease-in-out infinite;
}

@keyframes floating {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-15px);
    }

    100% {
        transform: translateY(0px);
    }
}

.robot-img {
    width: 140px;
    height: 140px;
    filter: drop-shadow(0 15px 25px rgba(0, 0, 0, 0.1));
}

.chat-bubble {
    background: var(--bg-card);
    padding: 0.75rem 1.25rem;
    border-radius: 20px;
    border-bottom-right-radius: 4px;
    font-size: 0.85rem;
    color: var(--text-main);
    box-shadow: var(--shadow-sm);
    margin-bottom: 10px;
    position: relative;
    border: 1px solid var(--border-color);
}

.chat-bubble strong {
    font-weight: 600;
}

/* Cards */
.action-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 4rem;
}

.card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    position: relative;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-soft);
    border-color: var(--primary);
}

.card-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
    display: flex;
}

.card-desc {
    font-size: 1.05rem;
    color: var(--text-main);
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 2rem;
}

.card-label {
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 500;
    margin-top: auto;
}

/* ==========================================
   PROMPT AREA (Bottom)
   ========================================== */
.prompt-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
    position: relative;
    z-index: 20;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.prompt-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    padding: 0 0.5rem;
}

.pro-text {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 500;
}

.powered-text {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.input-wrapper {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border-radius: var(--radius-lg);
    padding: 0.5rem;
    transition: opacity 0.3s ease, background 0.3s ease;
}

.prompt-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.75rem 1rem;
    font-family: inherit;
    font-size: 1rem;
    color: var(--text-main);
    outline: none;
}

.prompt-input::placeholder {
    color: var(--text-light);
}

.btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-icon:hover {
    background: var(--border-color);
    color: var(--text-main);
}

.btn-submit {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--text-main);
    color: var(--bg-surface);
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    margin-left: 0.25rem;
}

.btn-submit:hover {
    background: var(--primary);
    transform: scale(1.05);
}

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    padding: 0 0.5rem;
}

.chip {
    padding: 0.5rem 1rem;
    border-radius: 50px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.chip:hover {
    background: var(--bg-input);
}

.active-chip {
    background: var(--text-main);
    color: var(--bg-surface);
    border-color: var(--text-main);
}

.active-chip:hover {
    background: var(--primary-dark);
}

.icon-only {
    padding: 0.5rem;
    width: 34px;
    justify-content: center;
}

/* ==========================================
   LOADING & ERROR STATES
   ========================================== */
.status-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    z-index: 30;
    color: var(--text-main);
    font-weight: 500;
}

[data-theme="dark"] .status-overlay {
    background: rgba(22, 27, 34, 0.92);
}

.spinner-ring {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

.error-overlay .error-text {
    color: #ef4444;
    font-weight: 500;
    margin-bottom: 1rem;
}

.retry-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-main);
    cursor: pointer;
    font-weight: 500;
    font-family: inherit;
    transition: var(--transition);
}

.retry-btn:hover {
    background: var(--bg-input);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.hidden {
    display: none !important;
}

/* ===========================================
   RESPONSIVE — permanent vertical sidebar
   =========================================== */

/* ── ≤1100px: tighten layout ── */
@media (max-width: 1100px) {
    .app-container {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }

    .hero-title {
        font-size: 2.2rem;
    }

    .action-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .robot-illustration {
        display: none;
    }

    .prompt-container {
        max-width: 95%;
    }
}

/* ── ≤768px: sidebar stays left — just gets slimmer ── */
@media (max-width: 768px) {
    body {
        overflow: auto;
    }

    .app-container {
        width: 100vw;
        height: auto;
        min-height: 100vh;
        border-radius: 0;
        flex-direction: row;
        /* keep sidebar on the LEFT */
    }

    /* Slim sidebar — stays vertical, always visible */
    .sidebar {
        width: 56px;
        min-height: 100vh;
        flex-direction: column;
        padding: 1rem 0;
        border-right: 1px solid var(--border-color);
        position: sticky;
        top: 0;
        height: 100vh;
        z-index: 50;
        overflow: hidden;
    }

    .sidebar-top {
        gap: 1rem;
    }

    .sidebar-bottom {
        gap: 0.75rem;
    }

    /* Smaller icon buttons in slim sidebar */
    .icon-btn,
    .nav-btn,
    .theme-toggle-btn {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
    }

    .logo-mark {
        font-size: 1.5rem;
    }

    /* Username text in sidebar — visible on any width */
    .sidebar-username {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.2rem;
        font-size: 0.6rem;
        color: var(--text-light);
        text-align: center;
        max-width: 48px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        line-height: 1.2;
    }

    .main-content {
        flex: 1;
        min-width: 0;
        overflow-y: auto;
    }

    /* Slim header */
    .top-header {
        height: 56px;
        padding: 0 0.75rem;
    }

    /* Hide the text labels in the header on mobile — keep icons */
    .top-header .header-right span {
        display: none;
    }

    .top-header .daily-text {
        font-size: 0.82rem;
    }

    .assistant-selector {
        font-size: 0.82rem;
        padding: 0.4rem 0.5rem;
    }

    /* Hero */
    .hero-section {
        padding-top: 1.5vh;
    }

    .hero-content {
        padding: 0 0.75rem;
    }

    .hero-title {
        font-size: 1.6rem;
        margin-bottom: 1.25rem;
    }

    /* Cards: single column */
    .action-cards {
        grid-template-columns: 1fr;
        gap: 0.65rem;
        margin-bottom: 1.25rem;
    }

    .card {
        padding: 1rem;
    }

    .card-desc {
        font-size: 0.9rem;
        margin-bottom: 0.75rem;
    }

    /* Prompt container */
    .prompt-container {
        max-width: 100%;
        margin: 0 0.75rem 1rem;
        width: calc(100% - 1.5rem);
        padding: 0.85rem;
    }

    .prompt-header {
        flex-direction: column;
        gap: 0.2rem;
    }

    .powered-text {
        display: none;
    }

    /* Results & history scroll */
    .results-scroll {
        padding: 0.5rem 0.75rem 2rem;
    }

    .history-scroll {
        padding: 0.5rem 0.75rem 2rem;
    }

    /* History table → stacked card rows */
    .history-table thead {
        display: none;
    }

    .history-table,
    .history-table tbody,
    .history-row {
        display: block;
        width: 100%;
    }

    .history-row {
        border: 1px solid var(--border-color);
        border-radius: var(--radius-sm);
        margin-bottom: 0.65rem;
        padding: 0.65rem;
        background: var(--bg-card);
    }

    .history-row td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.3rem 0;
        font-size: 0.85rem;
        border: none;
    }

    .history-row td::before {
        content: attr(data-label);
        font-size: 0.7rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--text-light);
        min-width: 64px;
        flex-shrink: 0;
    }

    .claim-cell {
        display: block !important;
    }

    .claim-cell::before {
        display: none;
    }

    /* Auth */
    .auth-card {
        margin: 0.75rem;
        padding: 1.75rem 1.25rem;
        max-width: 100%;
    }
}

/* ── ≤480px: tightest size ── */
@media (max-width: 480px) {
    .hero-title {
        font-size: 1.25rem;
    }

    .card-icon {
        font-size: 1.4rem;
    }

    .card-desc {
        font-size: 0.85rem;
    }

    .prompt-input {
        font-size: 0.9rem;
    }

    .btn-icon {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    .btn-submit {
        width: 34px;
        height: 34px;
    }

    /* Evidence grid single column */
    .evidence-grid {
        grid-template-columns: 1fr !important;
        gap: 0.65rem;
    }

    .auth-card {
        padding: 1.25rem 0.85rem;
    }

    .auth-logo h1 {
        font-size: 1.1rem;
    }
}
/* Profile Menu */
.profile-menu-container {
    position: relative;
}

.profile-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    text-transform: uppercase;
}

.profile-btn:hover {
    opacity: 0.9;
    border-color: rgba(255, 255, 255, 0.2);
}

.profile-dropdown {
    position: absolute;
    bottom: 0;
    left: 100%;
    margin-left: 15px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    width: 180px;
    padding: 0.5rem 0;
    display: none;
    z-index: 9999;
    animation: slideUp 0.2s ease;
}

.profile-dropdown.open {
    display: block;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.dropdown-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.5rem;
}

.dropdown-username {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-main);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.15s ease;
    cursor: pointer;
}

.dropdown-item:hover {
    background: var(--bg-input);
    color: var(--primary);
}

.dropdown-item.danger:hover {
    color: #ef4444;
}
