/* 🌑 BABEL x GROK - Absolute Dark Theme */
:root {
    --bg-app: #000000;
    --bg-sidebar: #000000;
    --bg-main: #000000;
    --bg-surface: #121212;
    --bg-input: #1a1a1a;
    --bg-input-hover: #222222;

    --text-primary: #ffffff;
    --text-secondary: #a3a3a3;
    --text-tertiary: #525252;

    --border-subtle: #27272a;
    --border-active: #3f3f46;

    --accent: #ffffff;
    --accent-hover: #e5e5e5;

    --recording: #ef4444;
    --sidebar-width: 260px;
    --input-max-width: 720px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-app);
    color: var(--text-primary);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    height: 100vh;
    overflow: hidden;
}

/* 🏗️ LAYOUT GRID */
.app-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* ▌ SIDEBAR */
.grok-sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    padding: 16px;
    flex-shrink: 0;
    transition: transform 0.3s ease;
    z-index: 50;
}

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

.sidebar-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.new-chat {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
}

.new-chat:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
    font-weight: 500;
}

.menu-item:hover,
.menu-item.active {
    background-color: var(--bg-surface);
    color: var(--text-primary);
}

.menu-item i {
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
}

.user-profile:hover {
    background-color: var(--bg-surface);
}

.avatar {
    width: 32px;
    height: 32px;
    background: #333;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 600;
}

.info {
    display: flex;
    flex-direction: column;
}

.info .name {
    font-size: 0.9rem;
    font-weight: 600;
}

.info .status {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* ▌ MAIN CONTENT */
.grok-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background-color: var(--bg-main);
}

.main-header {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid transparent;
    /* Hidden unless scrolled */
}

.model-badge {
    color: var(--text-secondary);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0.7;
}

/* CHAT STAGE */
.chat-stage {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 180px;
    /* Space for input bar */
    display: flex;
    flex-direction: column;
    align-items: center;
}

.chat-container {
    width: 100%;
    max-width: var(--input-max-width);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* EMPTY STATE */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-top: 10vh;
    animation: fadeIn 0.5s ease;
}

.grok-logo-hero {
    font-size: 4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    letter-spacing: -0.04em;
}

.grok-hero-text {
    color: var(--text-secondary);
    font-size: 1.2rem;
}

/* 🟢 INPUT AREA (The "Grok" Bar) */
.grok-input-wrapper {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px;
    padding-bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    background: linear-gradient(to top, var(--bg-main) 80%, transparent);
}

.grok-input-bar {
    width: 100%;
    max-width: var(--input-max-width);
    background-color: var(--bg-input);
    border-radius: 28px;
    /* Pill shape */
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-subtle);
    transition: all 0.2s;
    min-height: 64px;
}

.grok-input-bar:focus-within {
    border-color: var(--border-active);
    background-color: var(--bg-input-hover);
}

.input-icon {
    font-size: 1.2rem;
    color: var(--text-secondary);
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.input-icon:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.input-status-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.status-text {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 400;
}

/* ORB ACTION BUTTON */
.input-icon.action {
    background-color: transparent;
    color: var(--text-primary);
    width: 48px;
    height: 48px;
}

.input-icon.action:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.input-icon.action.recording {
    color: var(--recording);
    animation: pulse-red 1.5s infinite;
}

/* PRO CHIPS (Below Input) */
.grok-chips {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.chip-select-wrapper {
    position: relative;
    background: var(--bg-surface);
    border-radius: 8px;
    padding: 0 12px;
    height: 36px;
    display: flex;
    align-items: center;
    border: 1px solid var(--border-subtle);
    min-width: 100px;
}

.chip-select-wrapper i {
    font-size: 0.7rem;
    color: var(--text-secondary);
    pointer-events: none;
    margin-left: 8px;
}

.chip-select {
    appearance: none;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    width: 100%;
    cursor: pointer;
}

.chip-select option {
    background: #121212;
    color: white;
}

.chip-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
}

.chip-pill {
    height: 36px;
    padding: 0 16px;
    border-radius: 18px;
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.chip-pill:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.chip-pill.active {
    background: var(--text-primary);
    color: var(--bg-app);
    border-color: var(--text-primary);
}

.chip-divider {
    width: 1px;
    height: 20px;
    background: var(--border-subtle);
    margin: 0 8px;
}

/* MESSAGES */
.message-row {
    display: flex;
    width: 100%;
    margin-bottom: 24px;
}

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

.ai-row {
    justify-content: flex-start;
}

.bubble {
    max-width: 80%;
    padding: 12px 18px;
    border-radius: 18px;
    font-size: 1rem;
    line-height: 1.5;
}

.user-bubble {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
}

.ai-bubble {
    background: transparent;
    color: var(--text-primary);
    padding-left: 0;
}

/* BARS ANIMATION for Orb */
.bars {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 20px;
}

.bar {
    width: 3px;
    height: 100%;
    background: currentColor;
    border-radius: 2px;
}

@keyframes pulse-red {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* 📱 MOBILE RESPONSIVE */
@media (max-width: 768px) {
    .grok-sidebar {
        position: fixed;
        left: -100%;
        /* Hide */
        height: 100%;
        background: rgba(0, 0, 0, 0.95);
        backdrop-filter: blur(10px);
    }

    .grok-sidebar.open {
        left: 0;
    }

    .main-header {
        justify-content: flex-start;
        padding-left: 20px;
    }

    .grok-input-bar {
        border-radius: 24px;
    }

    .chip-pill span {
        display: none;
        /* Icon only on mobile */
    }
}
/*  MODAL SETTINGS (Grok Dark) */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    display: none; /* JS toggles display: flex */
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: #121212;
    border: 1px solid #333;
    border-radius: 16px;
    padding: 24px;
    width: 90%;
    max-width: 500px;
    color: white;
    position: relative;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.modal h2 { margin-bottom: 20px; font-size: 1.5rem; }

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #a3a3a3;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    background: #1a1a1a;
    border: 1px solid #333;
    padding: 12px;
    border-radius: 8px;
    color: white;
    font-size: 1rem;
}

.form-control:focus {
    border-color: white;
    outline: none;
}

.save-btn {
    width: 100%;
    background: white;
    color: black;
    font-weight: 700;
    padding: 12px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    margin-top: 16px;
}

.close-modal-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    color: #666;
    font-size: 1.2rem;
    cursor: pointer;
}
.close-modal-btn:hover { color: white; }



/* MICROPHONE ORB BUTTON */
#record-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a1a1a, #2d2d2d);
    border: 2px solid #444;
    cursor: pointer;
    transition: all 0.3s ease;
}

#record-btn i {
    font-size: 1.4rem;
    color: #ffffff;
}

#record-btn:hover {
    background: linear-gradient(135deg, #2d2d2d, #3d3d3d);
    border-color: #666;
    transform: scale(1.05);
}

#record-btn.recording {
    background: linear-gradient(135deg, #dc2626, #ef4444) !important;
    border-color: #f87171 !important;
    animation: pulse-record 1.5s infinite;
}

#record-btn.recording i {
    color: white;
}

@keyframes pulse-record {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { transform: scale(1.05); box-shadow: 0 0 20px 5px rgba(239, 68, 68, 0.3); }
}

