/* WelDiary Brand Kit CSS */
:root {
    /* Brand Colors */
    --bg-primary: #121212;
    --bg-secondary: #000000;
    --bg-card: #1C1C1C;
    --border-color: #2F2F2F;

    --text-primary: #F5F5F5;
    --text-secondary: #A0A0A0;
    /* Softened from #6A6A6A for dark mode contrast */
    --text-muted: #666666;

    /* Accents */
    --accent-primary: #0E8F5A;
    /* Deep Calm Green */
    --accent-secondary: #6BCF9B;
    /* Soft Leaf */

    /* Mapped accent aliases (brand-green aligned) */
    --accent-purple: #0E8F5A;
    --accent-blue: #6BCF9B;

    /* Status Colors (Muted/Calm) */
    --status-error: #CF6679;
    --status-success: #0E8F5A;

    /* Spacing */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    font-weight: 400;
    /* Regular */
}

/* Background - Clean, no gradient noise per brand */
.bg-gradient {
    display: none;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.5rem 2rem;
    position: relative;
    z-index: 1;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    margin-bottom: 1.25rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
}

.logo-text {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    /* SemiBold per brand kit */
    font-size: 1.5rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.logo-img {
    height: 32px;
    /* Adjusted for balance */
    width: auto;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9375rem;
    /* ~15px */
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 48px;
    /* Brand kit rule */
    padding: 0 1.5rem;
    border-radius: var(--radius-md);
    /* 12px */
    font-size: 0.9375rem;
    /* ~15px */
    font-weight: 500;
    /* Medium */
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: #0b7a4d;
    /* Slightly darker */
    transform: translateY(-1px);
}

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.btn-success {
    background: var(--accent-primary);
    color: white;
}

/* Grid Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
    /* Section Gap */
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    /* 16px */
    padding: 24px;
    /* Card Padding */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    /* Soft shadow */
    border: none;
    /* "Avoid borders unless necessary" */
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 1.25rem;
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.stat-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    background: rgba(255, 255, 255, 0.05);
    /* Neutral icons */
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 600;
    /* SemiBold */
    color: var(--text-primary);
}

.stat-unit {
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-left: 4px;
}

/* Type Colors - Simplify to brand palette or neutrals */
.text-green {
    color: var(--accent-secondary);
}

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

/* History Table */
.section-title {
    font-size: 1.125rem;
    /* ~18px */
    font-weight: 500;
    /* Medium */
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-primary);
}

.section-title span {
    color: var(--accent-secondary);
    /* Icon color */
}

.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th {
    text-align: left;
    padding: 1rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.history-table td {
    padding: 1rem 0.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.history-table tr:last-child td {
    border-bottom: none;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-green {
    background: rgba(14, 143, 90, 0.2);
    color: var(--accent-secondary);
}

/* Chat Container */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 600px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.chat-header {
    padding: 1.5rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chat-avatar {
    width: 44px;
    height: 44px;
    /* Touch area size */
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border: 1px solid var(--border-color);
}

.online-dot {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    background: var(--accent-primary);
    border-radius: 50%;
    border: 2px solid var(--bg-card);
}

.chat-title {
    font-weight: 500;
    font-size: 1rem;
    color: var(--text-primary);
}

.chat-subtitle {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    max-width: 85%;
    padding: 1rem 1.25rem;
    border-radius: 16px;
    font-size: 0.9375rem;
    line-height: 1.5;
}

.message-user {
    align-self: flex-end;
    background: var(--accent-primary);
    /* Deep Calm Green */
    color: white;
    border-bottom-right-radius: 4px;
}

.message-bot {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.05);
    /* Soft dark gray */
    color: var(--text-primary);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
}

.chat-input-container {
    padding: 1.5rem;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
}

.chat-form {
    display: flex;
    gap: 0.75rem;
}

.chat-input {
    flex: 1;
    padding: 0 1.25rem;
    height: 48px;
    background: var(--bg-primary);
    /* Darker than card */
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9375rem;
    outline: none;
    transition: border-color 0.2s;
}

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

.chat-send {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: var(--accent-primary);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.chat-send:hover {
    background: #0b7a4d;
}

/* Tabs */
.tab-container {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.tab-btn.active {
    color: var(--accent-primary);
    background: rgba(14, 143, 90, 0.1);
}

.tab-content {
    display: none;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Utilities / Login */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 3rem;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.3);
}

.login-title {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.login-subtitle {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.google-btn {
    width: 100%;
    padding: 1rem 1.5rem;
    background: white;
    color: #333;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.google-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.google-btn img {
    width: 20px;
    height: 20px;
}

.login-icon {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: rgba(14, 143, 90, 0.1);
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin: 0 auto 1.5rem;
    border: 1px solid var(--accent-primary);
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 2rem;
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.4);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background 0.2s;
    font-size: 1.5rem;
    line-height: 1;
}

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

/* Loading spinner */
.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--accent-primary);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

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

.text-center {
    text-align: center;
}

.mt-1 {
    margin-top: 0.25rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

/* Quick Actions Panel */
.quick-actions {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    justify-content: center;
}

.quick-actions .btn {
    flex: 1;
    max-width: 200px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .container {
        padding: 0.5rem 1rem;
    }

    .header {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .user-info {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .user-info .btn {
        height: 40px;
        padding: 0 0.75rem;
        font-size: 0.8125rem;
    }

    .user-name {
        display: none;
    }

    .tab-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab-btn {
        white-space: nowrap;
        font-size: 0.75rem;
        padding: 0.75rem 1rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .chat-container {
        height: calc(100vh - 220px);
    }

    .modal {
        margin: 0.5rem;
        padding: 1.5rem;
        max-height: 90vh;
    }
}