/* ============================================================================
   nest.ai - Clean White Theme (matching NestDaddy)
   ============================================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #f1f3f5;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --accent-color: #2563eb;
    --accent-hover: #1d4ed8;
    --border-color: #dee2e6;
    --message-user-bg: #e7f3ff;
    --message-ai-bg: #f8f9fa;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    display: flex;
}

/* ============================================================================
   MOBILE HEADER (Hidden on desktop)
   ============================================================================ */

.mobile-header {
    display: none;
    background: var(--bg-secondary);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
    gap: 12px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

.mobile-menu-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
}

.mobile-header .logo {
    font-size: 18px;
    font-weight: 600;
    flex: 1;
}

.mobile-model-select {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 14px;
    cursor: pointer;
}

/* ============================================================================
   DESKTOP SIDEBAR
   ============================================================================ */

.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 20px 12px;
}

.sidebar-header h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.subtitle {
    font-size: 12px;
    color: var(--text-secondary);
}

.models-section {
    margin-top: 24px;
    flex: 1;
    overflow-y: auto;
}

.models-section h3 {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}

.models-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.model-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.model-item:hover {
    background: var(--bg-tertiary);
}

.model-item.active {
    background: var(--bg-tertiary);
    border-left: 3px solid var(--accent-color);
}

.model-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
    flex-shrink: 0;
}

.model-item.active .model-indicator {
    background: var(--accent-color);
}

.model-name {
    font-size: 14px;
    font-weight: 500;
}

.model-desc {
    font-size: 11px;
    color: var(--text-secondary);
}

.new-chat-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 12px;
    transition: background 0.2s;
}

.new-chat-btn:hover {
    background: var(--accent-hover);
}

.sidebar-footer {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-footer a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    padding: 6px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.sidebar-footer a:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* ============================================================================
   CHAT CONTAINER
   ============================================================================ */

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.chat-header {
    background: var(--bg-secondary);
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
}

.chat-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.chat-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 60px 24px;
}

.welcome-message h2 {
    font-size: 32px;
    margin-bottom: 12px;
}

.welcome-message > p {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.features {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 32px;
}

.feature-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    max-width: 200px;
    text-align: center;
}

.feature-icon {
    font-size: 36px;
    margin-bottom: 12px;
}

.feature-title {
    font-weight: 600;
    margin-bottom: 8px;
}

.feature-desc {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Chat Messages */
.message {
    margin-bottom: 24px;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-user {
    display: flex;
    justify-content: flex-end;
}

.message-user .message-content {
    background: var(--message-user-bg);
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    border-bottom-right-radius: 4px;
}

.message-ai {
    display: flex;
    gap: 12px;
}

.message-ai .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.message-ai .message-content {
    background: var(--message-ai-bg);
    padding: 12px 16px;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    max-width: 70%;
}

.message-model {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.message-text {
    line-height: 1.6;
    white-space: pre-wrap;
}

.typing-indicator {
    display: inline-block;
}

.typing-indicator span {
    animation: blink 1.4s infinite;
    margin: 0 2px;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes blink {
    0%, 60%, 100% { opacity: 0; }
    30% { opacity: 1; }
}

/* ============================================================================
   CHAT INPUT
   ============================================================================ */

.chat-input-container {
    background: var(--bg-secondary);
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

#chatInput {
    flex: 1;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 200px;
    overflow-y: auto;
}

#chatInput:focus {
    outline: none;
    border-color: var(--accent-color);
}

.send-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.send-btn:hover {
    background: var(--accent-hover);
}

.send-btn:disabled {
    background: var(--bg-tertiary);
    cursor: not-allowed;
}

/* ============================================================================
   MOBILE RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
    body {
        flex-direction: column;
    }

    .mobile-header {
        display: flex;
    }

    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        width: 280px;
        z-index: 200;
        transition: left 0.3s ease;
    }

    .sidebar.open {
        left: 0;
    }

    .chat-container {
        margin-top: 60px;
        height: calc(100vh - 60px);
    }

    .chat-header {
        display: none;
    }

    .chat-messages {
        padding: 16px;
    }

    .message-user .message-content,
    .message-ai .message-content {
        max-width: 85%;
    }

    .features {
        flex-direction: column;
        align-items: center;
    }

    .welcome-message {
        padding: 40px 16px;
    }

    .welcome-message h2 {
        font-size: 24px;
    }
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 150;
}

.sidebar-overlay.show {
    display: block;
}
