:root {
    --primary: #2563eb;
    --primary-light: #eff6ff;
    --secondary: #6366f1;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg-main: #f8fafc;
    --white: #ffffff;
    --text-dark: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1.25rem;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-dark);
    line-height: 1.5;
    min-height: 100vh;
}

/* Header & Navigation */
.top-header {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    cursor: pointer;
}

.top-nav {
    display: flex;
    gap: 1.5rem;
}

.top-nav .nav-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.top-nav .nav-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.top-nav .nav-item.active {
    background: var(--primary);
    color: var(--white);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.user-avatar:hover {
    border-color: var(--primary);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Layout */
.app-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.main-content {
    width: 100%;
}

.section-header {
    margin-bottom: 2rem;
}

.section-header h1 {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--text-dark);
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card h3 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
    border: 1px solid var(--border);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.water { background: #e0f2fe; color: #0ea5e9; }
.stat-icon.steps { background: #fef3c7; color: #d97706; }
.stat-icon.bmi { background: #dcfce7; color: #16a34a; }

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
}

.stat-progress {
    height: 8px;
    background: var(--bg-main);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.stat-tag {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.stat-tag.normal-weight { background: #dcfce7; color: #15803d; }
.stat-tag.overweight { background: #fef3c7; color: #b45309; }
.stat-tag.underweight { background: #fee2e2; color: #b91c1c; }

/* Dashboard Features */
.feature-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1.5rem;
    background: var(--primary-light);
    border: 1px solid var(--primary);
    border-radius: var(--radius-md);
    color: var(--primary);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.action-btn:hover {
    background: var(--primary);
    color: var(--white);
}

.action-btn i {
    font-size: 1.5rem;
}

/* Symptom Checker */
.search-box {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.search-box input {
    flex: 1;
    padding: 1rem 1.25rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 1rem;
}

.search-box button {
    padding: 0 1.5rem;
    background: var(--primary);
    color: var(--white);
    border-radius: var(--radius-md);
    font-weight: 700;
    border: none;
    cursor: pointer;
}

/* Chat Layout */
.chat-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
    height: calc(100vh - 12rem);
}

.chat-sidebar {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.category-list {
    margin-top: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.cat-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.2s;
}

.cat-item i { font-size: 0.5rem; }
.cat-item:hover { background: var(--bg-main); }
.cat-item.active { background: var(--primary-light); color: var(--primary); }

.chat-main {
    background: var(--white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.chat-box {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    background: #fdfdfd;
}

.message-bubble {
    padding: 1rem 1.25rem;
    border-radius: 1.25rem;
    max-width: 85%;
    line-height: 1.6;
    font-size: 1rem;
}

.chat.user { align-self: flex-end; }
.chat.user .message-bubble {
    background: var(--primary);
    color: var(--white);
    border-bottom-right-radius: 0.25rem;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.2);
}

.chat.ai { align-self: flex-start; }
.chat.ai .message-bubble {
    background: var(--bg-main);
    color: var(--text-dark);
    border-bottom-left-radius: 0.25rem;
}

.input-form {
    padding: 1.25rem 1.5rem;
    display: flex;
    gap: 1rem;
    border-top: 1px solid var(--border);
}

.input-form input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
}

.send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Typing Indicator */
.typing-indicator { display: flex; gap: 4px; padding: 4px; }
.typing-indicator span {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}
.typing-indicator span:nth-child(1) { animation-delay: -0.32s; }
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Tools Grid */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
}

.tool-card {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.tool-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-wrapper label {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-muted);
}

.input-wrapper input, .input-wrapper select, .input-wrapper textarea {
    padding: 0.875rem 1.125rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
}

/* Profile Layout */
.profile-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 2rem;
}

.profile-card .profile-header {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.profile-avatar {
    position: relative;
    width: 128px;
    height: 128px;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 30px;
    object-fit: cover;
}

.edit-avatar {
    position: absolute;
    bottom: -10px;
    right: -10px;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--white);
    border: 1px solid var(--border);
    color: var(--primary);
    cursor: pointer;
    box-shadow: var(--shadow-md);
}

.profile-info h2 { font-size: 1.75rem; margin-bottom: 0.25rem; }
.profile-badges { display: flex; gap: 0.75rem; margin-top: 1rem; }
.badge {
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    background: var(--primary-light);
    color: var(--primary);
}
.badge.premium { background: #fff7ed; color: #c2410c; }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.goal-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1.25rem 0;
}

.goal-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
}

.activity-log {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 1.5rem;
}

.log-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.log-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.log-details p { font-size: 0.9rem; font-weight: 700; }
.log-details span { font-size: 0.75rem; color: var(--text-muted); }

/* Common UI Elements */
.primary-btn {
    padding: 0.875rem 1.5rem;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius-md);
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

.primary-btn:hover { background: #1d4ed8; }

.secondary-btn {
    padding: 0.75rem 1rem;
    background: var(--bg-main);
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
}

.text-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-weight: 700;
    cursor: pointer;
}

.full-width { width: 100%; }
.mt-1 { margin-top: 1rem; }
.hidden { display: none !important; }

/* Result Boxes */
.result-box {
    margin-top: 1.5rem;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    animation: slideUp 0.3s ease;
}

.result-highlight {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.result-highlight .value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1024px) {
    .profile-layout, .feature-grid, .chat-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .header-container { padding: 0.75rem 1rem; }
    .top-nav span { display: none; }
    .form-grid { grid-template-columns: 1fr; }
}
