/* Nomi Dashboard - Minimal, Intentional Design */
/* "Every pixel must earn its place" - Jony Ive */

:root {
    /* Colors - Minimal Palette */
    --bg: #FAFAFA;
    --bg-secondary: #FFFFFF;
    --text: #1A1A1A;
    --text-secondary: #666666;
    --text-muted: #999999;
    --nomi: #0D7377;           /* Deep ocean teal - Nomi's color */
    --nomi-light: #E8F4F4;
    --success: #4CAF50;
    --warning: #FF9800;
    --error: #E57373;
    --border: #E5E5E5;

    /* Typography */
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Layout */
    --max-width: 800px;
    --radius: 12px;
    --radius-sm: 8px;
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Base */
html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

/* App Container */
.app {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--space-lg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Mode Tabs */
.mode-tabs {
    display: flex;
    gap: var(--space-sm);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-lg);
}

.mode-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-md);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font);
}

.mode-tab:hover {
    background: var(--bg-secondary);
    border-color: var(--text-muted);
}

.mode-tab.active {
    background: var(--nomi);
    border-color: var(--nomi);
    color: white;
}

.mode-time {
    font-size: 0.75rem;
    font-weight: 500;
    opacity: 0.7;
}

.mode-name {
    font-size: 0.875rem;
    font-weight: 500;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
}

/* Nomi Chat Section */
.nomi-section {
    flex-shrink: 0;
}

.chat-container {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
}

.chat-messages {
    padding: var(--space-lg);
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

/* Chat Messages */
.chat-message {
    display: flex;
    gap: var(--space-md);
    animation: fadeIn 0.3s ease;
}

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

.chat-message.nomi {
    flex-direction: row;
}

.chat-message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.chat-message.nomi .message-avatar {
    background: var(--nomi-light);
}

.chat-message.user .message-avatar {
    background: var(--border);
}

.message-content {
    flex: 1;
    padding: var(--space-md);
    border-radius: var(--radius-sm);
    max-width: 85%;
}

.chat-message.nomi .message-content {
    background: var(--nomi-light);
    border-bottom-left-radius: var(--space-xs);
}

.chat-message.user .message-content {
    background: var(--border);
    border-bottom-right-radius: var(--space-xs);
}

.message-content p {
    margin-bottom: var(--space-sm);
}

.message-content p:last-child {
    margin-bottom: 0;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: var(--space-sm);
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--nomi);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* Chat Input */
.chat-input-wrapper {
    display: flex;
    gap: var(--space-sm);
    padding: var(--space-md);
    border-top: 1px solid var(--border);
    background: var(--bg);
}

.chat-input {
    flex: 1;
    padding: var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 1rem;
    resize: none;
    outline: none;
    transition: border-color 0.2s ease;
}

.chat-input:focus {
    border-color: var(--nomi);
}

.chat-input::placeholder {
    color: var(--text-muted);
}

.send-btn {
    width: 44px;
    height: 44px;
    background: var(--nomi);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.send-btn:hover {
    background: #0a5c5f;
}

.send-btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
}

/* Content Section */
.content-section {
    flex: 1;
}

.mode-content {
    display: none;
}

.mode-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* Sources Grid */
.sources-grid {
    display: grid;
    gap: var(--space-md);
}

/* Source Card */
.source-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-lg);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-md);
    transition: border-color 0.2s ease;
}

.source-card:hover {
    border-color: var(--nomi);
}

.source-info {
    flex: 1;
    min-width: 0;
}

.source-name {
    font-weight: 600;
    margin-bottom: var(--space-xs);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.source-name a {
    color: var(--text);
    text-decoration: none;
}

.source-name a:hover {
    color: var(--nomi);
}

.source-meta {
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.source-status {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.active { background: var(--success); }
.status-dot.stale { background: var(--warning); }
.status-dot.dead { background: var(--error); }

.source-actions {
    display: flex;
    gap: var(--space-sm);
}

.action-btn {
    padding: var(--space-sm) var(--space-md);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn:hover {
    border-color: var(--text-muted);
}

.action-btn.delete:hover {
    border-color: var(--error);
    color: var(--error);
}

/* Empty & Locked States */
.empty-state,
.locked-state {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-secondary);
}

.empty-hint,
.locked-hint {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: var(--space-sm);
}

/* ============================================
   QUICK SIP - Headlines Grid
   ============================================ */

.quick-sip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border);
}

.quick-sip-stats {
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

.stat-separator {
    color: var(--text-muted);
}

.refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.875rem;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
}

.refresh-btn:hover {
    border-color: var(--nomi);
    color: var(--nomi);
}

.refresh-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.refresh-btn.loading svg {
    animation: spin 1s linear infinite;
}

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

/* Articles Grid */
.articles-grid {
    display: grid;
    gap: var(--space-md);
}

/* Article Card */
.article-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-lg);
    transition: all 0.2s ease;
    animation: fadeIn 0.3s ease;
}

.article-card:hover {
    border-color: var(--nomi);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(13, 115, 119, 0.1);
}

.article-source {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--nomi);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-xs);
}

.article-title {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    line-height: 1.4;
    margin-bottom: var(--space-sm);
}

.article-title:hover {
    color: var(--nomi);
}

.article-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.article-date {
    display: inline-flex;
    align-items: center;
}

/* Loading State for Quick Sip */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
}

.loading-state .typing-indicator {
    justify-content: center;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 600px) {
    .app {
        padding: var(--space-md);
    }

    .mode-tabs {
        flex-wrap: wrap;
    }

    .mode-tab {
        flex: 1 1 45%;
    }

    .mode-time {
        font-size: 0.7rem;
    }

    .mode-name {
        font-size: 0.8rem;
    }

    .source-card {
        flex-direction: column;
    }

    .source-actions {
        width: 100%;
        justify-content: flex-end;
    }

    /* Quick Sip responsive */
    .quick-sip-header {
        flex-direction: column;
        gap: var(--space-md);
        align-items: flex-start;
    }

    .refresh-btn {
        width: 100%;
        justify-content: center;
    }

    .article-card {
        padding: var(--space-md);
    }

    .article-title {
        font-size: 0.95rem;
    }
}
