/* ===============================================
   MOUNJAPING BLACK APP - MAIN STYLES
   Mobile-First Design
   =============================================== */

:root {
    /* Apple-inspired Color System */
    --primary: #34C759;
    --primary-dark: #28a745;
    --primary-light: rgba(52, 199, 89, 0.12);
    --primary-50: rgba(52, 199, 89, 0.06);
    --secondary: #007AFF;
    --secondary-light: rgba(0, 122, 255, 0.12);
    --accent: #FF9500;
    --accent-light: rgba(255, 149, 0, 0.12);
    --danger: #FF3B30;
    --danger-light: rgba(255, 59, 48, 0.12);
    --success: #34C759;
    --warning: #FF9500;
    
    /* Sophisticated Neutrals */
    --text: #1D1D1F;
    --text-secondary: #86868B;
    --text-muted: #AEAEB2;
    --white: #FFFFFF;
    --gray-50: #FBFBFD;
    --gray-100: #F5F5F7;
    --gray-200: #E8E8ED;
    --gray-300: #D2D2D7;
    --gray-400: #AEAEB2;
    --gray-500: #86868B;
    --gray-800: #1D1D1F;
    --gray-900: #000000;
    
    /* Refined Gradients */
    --gradient-primary: linear-gradient(180deg, #3DDC84 0%, #34C759 100%);
    --gradient-secondary: linear-gradient(180deg, #5AC8FA 0%, #007AFF 100%);
    --gradient-accent: linear-gradient(180deg, #FFD60A 0%, #FF9500 100%);
    --gradient-dark: linear-gradient(180deg, #2C2C2E 0%, #1D1D1F 100%);
    
    /* Apple-style Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.16);
    
    /* Smooth Border Radius */
    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-full: 9999px;
    
    /* Generous Spacing */
    --space-xs: 6px;
    --space-sm: 12px;
    --space-md: 20px;
    --space-lg: 28px;
    --space-xl: 40px;
    --space-2xl: 56px;
    
    /* Layout */
    --safe-top: env(safe-area-inset-top);
    --safe-bottom: env(safe-area-inset-bottom);
    --nav-height: 84px;
    --header-height: 56px;
}

/* ===============================================
   RESET & BASE
   =============================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html {
    font-size: 17px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', sans-serif;
    background: var(--gray-100);
    color: var(--text);
    line-height: 1.47;
    letter-spacing: -0.022em;
    min-height: 100vh;
    min-height: 100dvh;
    overscroll-behavior: none;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

button {
    font-family: inherit;
    border: none;
    background: none;
    cursor: pointer;
    outline: none;
    transition: all 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
}

button:active {
    transform: scale(0.97);
    opacity: 0.9;
}

input, textarea {
    font-family: inherit;
    border: none;
    outline: none;
    font-size: 17px;
    color: var(--text);
}

input::placeholder, textarea::placeholder {
    color: var(--text-muted);
}

img {
    max-width: 100%;
    height: auto;
}

.hidden {
    display: none !important;
}

/* ===============================================
   SPLASH SCREEN
   =============================================== */

.splash-screen {
    position: fixed;
    inset: 0;
    background: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.splash-screen.fade-out {
    opacity: 0;
    visibility: hidden;
}

.splash-content {
    text-align: center;
    color: var(--text);
}

.splash-logo {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
}

.logo-icon {
    width: 100%;
    height: 100%;
    color: var(--primary);
}

@keyframes pulseScale {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.02); opacity: 0.9; }
}

.splash-content h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 8px;
    color: var(--text);
}

.splash-content p {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 40px;
}

.splash-loader {
    width: 32px;
    height: 32px;
    margin: 0 auto;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ===============================================
   APP CONTAINER
   =============================================== */

.app-container {
    min-height: 100vh;
    min-height: 100dvh;
}

/* ===============================================
   ONBOARDING
   =============================================== */

.onboarding-screen {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    padding: var(--space-lg);
    padding-top: calc(var(--safe-top) + var(--space-2xl));
    padding-bottom: calc(var(--safe-bottom) + var(--space-lg));
    background: var(--white);
}

.onboarding-step {
    display: none;
    flex-direction: column;
    flex: 1;
    animation: fadeSlideIn 0.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.onboarding-step.active {
    display: flex;
}

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

.onboarding-illustration {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl) 0;
}

.welcome-icon {
    font-size: 5rem;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.onboarding-step h1,
.onboarding-step h2 {
    color: var(--text);
    text-align: center;
    margin-bottom: var(--space-md);
    font-weight: 700;
    letter-spacing: -0.03em;
}

.onboarding-step h1 {
    font-size: 2rem;
}

.onboarding-step h2 {
    font-size: 1.75rem;
}

.onboarding-step > p {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
}

.step-description {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: var(--space-lg);
}

.form-group {
    margin-bottom: var(--space-xl);
}

.input-field {
    width: 100%;
    padding: 16px 20px;
    font-size: 17px;
    font-weight: 400;
    border: none;
    border-radius: var(--radius);
    background: var(--gray-100);
    transition: all 0.2s ease;
    text-align: center;
}

.input-field:focus {
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(52, 199, 89, 0.2);
}

.input-hint {
    display: block;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: var(--space-sm);
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.option-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-lg);
    border: none;
    border-radius: var(--radius-lg);
    background: var(--gray-100);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.option-card:active {
    transform: scale(0.98);
}

.option-card input {
    display: none;
}

.option-card:has(input:checked) {
    background: var(--primary);
    box-shadow: 0 4px 16px rgba(52, 199, 89, 0.3);
}

.option-card:has(input:checked) .option-label {
    color: var(--white);
}

.option-icon {
    font-size: 2rem;
    margin-bottom: var(--space-sm);
}

.option-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-align: center;
}

.checkbox-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s ease;
}

.checkbox-item:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-50);
}

.checkbox-item input {
    width: 22px;
    height: 22px;
    accent-color: var(--primary);
}

.checkbox-text {
    font-size: 1rem;
    color: var(--text);
}

.btn-primary {
    width: 100%;
    padding: 16px 24px;
    background: var(--primary);
    color: var(--white);
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    border-radius: var(--radius);
    transition: all 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
    margin-top: auto;
    box-shadow: 0 2px 8px rgba(52, 199, 89, 0.3);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 16px rgba(52, 199, 89, 0.4);
}

.btn-primary:active {
    transform: scale(0.98);
    box-shadow: 0 1px 4px rgba(52, 199, 89, 0.2);
}

.btn-text {
    width: 100%;
    padding: var(--space-md);
    color: var(--text-muted);
    font-size: 1rem;
    margin-top: var(--space-md);
}

/* ===============================================
   MAIN APP
   =============================================== */

.main-app {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--gray-50);
}

/* Header */
.app-header {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px var(--space-md);
    padding-top: calc(var(--safe-top) + 12px);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.08);
    z-index: 100;
}

.header-left .greeting {
    font-size: 13px;
    color: var(--text-secondary);
}

.header-left .user-name-display {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.header-btn {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    background: var(--gray-100);
}

.header-btn svg {
    width: 22px;
    height: 22px;
    color: var(--text-secondary);
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--danger);
    color: var(--white);
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 600;
    font-size: 1rem;
}

/* Tab Content Container */
.tab-content-container {
    flex: 1;
    padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + var(--space-md));
    overflow-y: auto;
}

.tab-content {
    display: none;
    padding: var(--space-lg);
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Section Header */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
    margin-top: var(--space-lg);
}

.section-header h2,
.section-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

.section-header span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ===============================================
   HOME TAB
   =============================================== */

/* Progress Card */
.progress-card {
    background: var(--gradient-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    color: var(--white);
}

.progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
}

.progress-header h3 {
    font-size: 1rem;
    font-weight: 500;
}

.progress-badge {
    background: rgba(255,255,255,0.2);
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
}

.stat-item {
    text-align: center;
    flex: 1;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-label {
    font-size: 0.75rem;
    opacity: 0.9;
}

.stat-divider {
    width: 1px;
    background: rgba(255,255,255,0.3);
    margin: 0 var(--space-sm);
}

.progress-bar-container {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: rgba(255,255,255,0.3);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--white);
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
}

.progress-percent {
    font-size: 0.9rem;
    font-weight: 600;
}

/* Tasks List */
.tasks-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.task-card {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    background: var(--white);
    padding: var(--space-md);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease;
}

.task-card:active {
    transform: scale(0.98);
}

.task-card.completed {
    opacity: 0.7;
}

.task-card.completed .task-info h4 {
    text-decoration: line-through;
}

.task-check {
    position: relative;
}

.task-check input {
    display: none;
}

.task-check label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.2s ease;
}

.task-check input:checked + label {
    background: var(--primary);
    border-color: var(--primary);
}

.task-check input:checked + label::after {
    content: '✓';
    color: var(--white);
    font-size: 0.9rem;
}

.task-info {
    flex: 1;
}

.task-info h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}

.task-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.task-icon {
    font-size: 1.5rem;
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-md);
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease;
}

.quick-action-btn:active {
    transform: scale(0.95);
}

.action-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-light);
    border-radius: var(--radius);
}

.action-icon svg {
    width: 24px;
    height: 24px;
    color: var(--primary);
}

.scanner-icon {
    background: var(--secondary);
}

.scanner-icon svg {
    color: var(--white);
}

.quick-action-btn span {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
}

/* Tip Card */
.tip-card {
    display: flex;
    gap: var(--space-md);
    background: var(--accent-light);
    padding: var(--space-md);
    border-radius: var(--radius);
    margin-top: var(--space-lg);
}

.tip-icon {
    font-size: 1.5rem;
}

.tip-content h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--secondary);
    margin-bottom: var(--space-xs);
}

.tip-content p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ===============================================
   PLAN TAB
   =============================================== */

.plan-header {
    text-align: center;
    margin-bottom: var(--space-lg);
}

.plan-header h2 {
    font-size: 1.5rem;
    color: var(--text);
    margin-bottom: var(--space-xs);
}

.plan-header p {
    color: var(--text-muted);
}

.plan-section {
    margin-bottom: var(--space-xl);
}

.plan-section-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.plan-icon {
    font-size: 1.5rem;
}

.plan-section-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

.plan-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
}

.instruction-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.instruction-item {
    display: flex;
    gap: var(--space-md);
}

.instruction-number {
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: var(--white);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}

.instruction-content h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: var(--space-xs);
}

.instruction-content p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.meal-cards {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.meal-card {
    background: var(--white);
    padding: var(--space-md);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.meal-time {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: var(--space-xs);
}

.meal-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.warning-cards {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.warning-card {
    background: var(--danger-light);
    padding: var(--space-md);
    border-radius: var(--radius);
    border-left: 4px solid var(--danger);
}

.warning-card p {
    font-size: 0.9rem;
    color: var(--danger);
}

/* ===============================================
   SCANNER TAB
   =============================================== */

.scanner-header {
    text-align: center;
    margin-bottom: var(--space-lg);
}

.scanner-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text);
    margin-bottom: var(--space-xs);
}

.scanner-header p {
    color: var(--text-muted);
}

/* Scanner Modes */
.scanner-modes {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.scanner-mode-btn {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--white);
    border: none;
    border-radius: var(--radius-lg);
    text-align: left;
    transition: all 0.25s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.scanner-mode-btn.active {
    background: var(--primary);
    box-shadow: 0 4px 16px rgba(52, 199, 89, 0.3);
}

.scanner-mode-btn.active.toxins-mode {
    background: var(--danger);
    box-shadow: 0 4px 16px rgba(255, 59, 48, 0.3);
}

.scanner-mode-btn.active.quality-mode {
    background: var(--primary);
}

.mode-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: var(--gray-100);
    border-radius: var(--radius);
}

.scanner-mode-btn.active .mode-icon {
    background: rgba(255, 255, 255, 0.2);
}

.scanner-mode-btn.active .mode-info h4,
.scanner-mode-btn.active .mode-info p {
    color: var(--white);
}

.mode-info h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}

.mode-info p {
    font-size: 13px;
    color: var(--text-secondary);
}

.current-mode-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--gray-100);
    border-radius: var(--radius-full);
    margin-bottom: var(--space-md);
}

.mode-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.mode-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
}

.mode-value.toxins {
    color: var(--danger);
}

/* Scanner Frame Colors by Mode */
.scanner-frame.toxins-mode {
    border-color: var(--danger) !important;
}

.scanner-frame.toxins-mode::before,
.scanner-frame.toxins-mode::after {
    border-color: var(--danger) !important;
}

#btn-start-scan.toxins-mode {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.scanner-container {
    margin-bottom: var(--space-xl);
}

.scanner-preview {
    position: relative;
    aspect-ratio: 4/3;
    background: var(--gray-900);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: var(--space-md);
}

#scanner-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scanner-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.scanner-frame {
    width: 70%;
    aspect-ratio: 3/2;
    border: 3px solid var(--primary);
    border-radius: var(--radius);
    position: relative;
}

.scanner-frame::before,
.scanner-frame::after {
    content: '';
    position: absolute;
    width: 30px;
    height: 30px;
    border: 4px solid var(--primary);
}

.scanner-frame::before {
    top: -3px;
    left: -3px;
    border-right: none;
    border-bottom: none;
    border-radius: var(--radius-sm) 0 0 0;
}

.scanner-frame::after {
    bottom: -3px;
    right: -3px;
    border-left: none;
    border-top: none;
    border-radius: 0 0 var(--radius-sm) 0;
}

.scanner-instruction {
    color: var(--white);
    font-size: 0.85rem;
    margin-top: var(--space-lg);
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.scanner-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--gray-800);
    color: var(--white);
}

.scanner-placeholder svg {
    width: 80px;
    height: 80px;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.scanner-placeholder p {
    opacity: 0.7;
}

.scanner-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.btn-scanner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    width: 100%;
    padding: var(--space-md);
    background: var(--gradient-primary);
    color: var(--white);
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-scanner:active {
    transform: scale(0.98);
}

#btn-capture-photo {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    animation: pulse-capture 2s infinite;
}

@keyframes pulse-capture {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
}

.btn-scanner svg {
    width: 24px;
    height: 24px;
}

.btn-scanner-secondary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    width: 100%;
    padding: var(--space-md);
    background: var(--gray-100);
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    border-radius: var(--radius);
}

.btn-scanner-secondary svg {
    width: 20px;
    height: 20px;
}

.scanned-products {
    min-height: 150px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2xl);
    text-align: center;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.empty-state p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
}

.empty-state span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Loading Modal */
.loading-modal {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.loading-modal.hidden {
    display: none;
}

.loading-content {
    text-align: center;
    color: var(--text);
    padding: var(--space-xl);
}

.loading-spinner {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto var(--space-lg);
}

.spinner-ring {
    position: absolute;
    inset: 0;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    animation: pulse-icon 2s ease-in-out infinite;
}

@keyframes pulse-icon {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.loading-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.loading-content p {
    font-size: 1rem;
    opacity: 0.8;
    margin-bottom: var(--space-lg);
}

.loading-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.loading-dots span {
    width: 12px;
    height: 12px;
    background: var(--primary);
    border-radius: 50%;
    animation: loading-bounce 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes loading-bounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Scanner Result Modal */
.scanner-result-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 1000;
    padding: 0;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.scanner-result-modal .result-card {
    width: 100%;
    max-width: 500px;
    background: var(--white);
    border-radius: 20px 20px 0 0;
    padding: var(--space-lg);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.close-modal {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    border-radius: var(--radius-full);
    font-size: 1.25rem;
    color: var(--text-muted);
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
}

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

.score-value {
    display: block;
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary);
}

.score-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.result-verdict {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--primary-light);
    border-radius: var(--radius-full);
}

.verdict-icon {
    font-size: 1.25rem;
}

.verdict-text {
    font-weight: 600;
    color: var(--primary-dark);
}

.result-product {
    margin-bottom: var(--space-lg);
}

.result-product h3 {
    font-size: 1.1rem;
    color: var(--text);
}

.result-product p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.result-details {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.result-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.result-label {
    width: 100px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.result-bar {
    flex: 1;
    height: 8px;
    background: var(--gray-200);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.result-bar-fill {
    height: 100%;
    background: var(--danger);
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
}

.result-bar.good .result-bar-fill {
    background: var(--primary);
}

.result-value {
    width: 60px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: right;
}

/* Result Mode Badge */
.result-mode-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--danger-light);
    border-radius: var(--radius-full);
    margin-bottom: var(--space-md);
}

.result-mode-badge.quality-mode {
    background: var(--primary-light);
}

.result-mode-badge .mode-icon {
    font-size: 1rem;
}

.result-mode-badge .mode-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--danger);
}

.result-mode-badge.quality-mode .mode-text {
    color: var(--primary-dark);
}

/* Result Bars by Type */
.result-bar.danger .result-bar-fill {
    background: var(--danger);
}

.result-bar.good .result-bar-fill {
    background: var(--primary);
}

/* Toxins Found List */
.toxins-found,
.benefits-found {
    margin-bottom: var(--space-md);
    padding: var(--space-md);
    background: var(--gray-50);
    border-radius: var(--radius);
}

.toxins-found {
    border-left: 4px solid var(--danger);
}

.benefits-found {
    border-left: 4px solid var(--primary);
}

.toxins-found h4,
.benefits-found h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
    color: var(--text);
}

.toxins-found ul,
.benefits-found ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toxins-found li {
    font-size: 0.85rem;
    color: var(--danger);
    padding: var(--space-xs) 0;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.toxins-found li::before {
    content: '⚠️';
    font-size: 0.75rem;
}

.benefits-found li {
    font-size: 0.85rem;
    color: var(--primary-dark);
    padding: var(--space-xs) 0;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.benefits-found li::before {
    content: '✓';
    color: var(--primary);
    font-weight: bold;
}

.result-recommendation {
    background: var(--primary-50);
    padding: var(--space-md);
    border-radius: var(--radius);
    border-left: 4px solid var(--primary);
}

.result-recommendation.warning {
    background: var(--danger-light);
    border-left-color: var(--danger);
}

.result-recommendation p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Product Card in list */
.product-card {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    background: var(--white);
    padding: var(--space-md);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-md);
}

.product-score {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 1.1rem;
}

.product-score.good {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.product-score.medium {
    background: var(--accent-light);
    color: #b45309;
}

.product-score.bad {
    background: var(--danger-light);
    color: var(--danger);
}

.product-info {
    flex: 1;
}

.product-info h4 {
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: 2px;
}

.product-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ===============================================
   ROUTINE TAB
   =============================================== */

.routine-header {
    text-align: center;
    margin-bottom: var(--space-lg);
}

.routine-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text);
    margin-bottom: var(--space-xs);
}

.routine-header p {
    color: var(--text-muted);
}

/* Timer Card */
.timer-card {
    background: var(--gradient-secondary);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    color: var(--white);
    text-align: center;
    margin-bottom: var(--space-xl);
}

.timer-display {
    margin-bottom: var(--space-md);
}

.timer-value {
    font-size: 4rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.timer-exercise-name {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: var(--space-lg);
}

.timer-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-lg);
}

.timer-btn {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.1);
    border-radius: var(--radius-full);
    transition: background 0.2s ease;
}

.timer-btn:active {
    background: rgba(255,255,255,0.2);
}

.timer-btn svg {
    width: 24px;
    height: 24px;
    color: var(--white);
}

.timer-btn-main {
    width: 64px;
    height: 64px;
    background: var(--primary);
}

.timer-btn-main svg {
    width: 28px;
    height: 28px;
}

/* Exercise List */
.exercise-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.exercise-card {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    background: var(--white);
    padding: var(--space-md);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.exercise-card:active {
    transform: scale(0.98);
}

.exercise-card.active {
    border-color: var(--primary);
    background: var(--primary-50);
}

.exercise-card.completed {
    opacity: 0.6;
}

.exercise-card.completed .exercise-check {
    background: var(--primary);
}

.exercise-card.completed .exercise-check::after {
    content: '✓';
    color: var(--white);
    font-size: 0.8rem;
}

.exercise-status {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.exercise-check {
    width: 24px;
    height: 24px;
    border: 2px solid var(--gray-300);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
}

.exercise-info {
    flex: 1;
}

.exercise-info h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}

.exercise-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.exercise-duration {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-light);
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
}

.routine-tip {
    display: flex;
    gap: var(--space-md);
    align-items: center;
    background: var(--accent-light);
    padding: var(--space-md);
    border-radius: var(--radius);
    margin-top: var(--space-xl);
}

.routine-tip .tip-icon {
    font-size: 1.5rem;
}

.routine-tip p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ===============================================
   COMMUNITY TAB
   =============================================== */

.community-header {
    text-align: center;
    margin-bottom: var(--space-lg);
}

.community-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text);
    margin-bottom: var(--space-xs);
}

.community-header p {
    color: var(--text-muted);
}

.new-post-card {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    background: var(--white);
    padding: var(--space-md);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-lg);
}

.new-post-avatar {
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 600;
}

.new-post-input {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    background: var(--gray-100);
    border-radius: var(--radius-full);
    color: var(--text-muted);
    text-align: left;
    font-size: 0.9rem;
}

/* Posts Feed */
.posts-feed {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.post-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
}

.post-card.doctor-post {
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.04) 0%, var(--white) 100%);
}

.post-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.post-avatar {
    width: 40px;
    height: 40px;
    background: var(--gradient-secondary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 600;
    font-size: 0.9rem;
}

.post-avatar.emoji-avatar {
    font-size: 1.5rem;
    background: var(--gray-100);
}

.post-user-info {
    flex: 1;
}

.post-user-name {
    display: flex;
    align-items: center;
    gap: 4px;
}

.verified-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: var(--secondary);
    color: var(--white);
    border-radius: 50%;
    font-size: 0.6rem;
    font-weight: bold;
}

.post-user-name-text {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}

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

.post-content {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    line-height: 1.6;
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.post-tag {
    padding: var(--space-xs) var(--space-sm);
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
}

.post-actions {
    display: flex;
    gap: var(--space-lg);
    padding-top: var(--space-md);
    border-top: 1px solid var(--gray-100);
}

.post-action {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.post-action svg {
    width: 20px;
    height: 20px;
}

.post-action.liked svg {
    fill: var(--danger);
    color: var(--danger);
}

/* Post Modal */
.post-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: var(--space-md);
}

.post-modal-content {
    width: 100%;
    max-width: 500px;
    background: var(--white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.post-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    border-bottom: 1px solid var(--gray-100);
}

.post-modal-header h3 {
    font-size: 1.1rem;
    color: var(--text);
}

.post-modal-body {
    padding: var(--space-md);
}

.post-modal-body textarea {
    width: 100%;
    min-height: 120px;
    padding: var(--space-md);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius);
    resize: none;
    font-size: 1rem;
    margin-bottom: var(--space-md);
}

.post-modal-body textarea:focus {
    border-color: var(--primary);
}

.post-modal-body .post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.post-modal-body .post-tag {
    cursor: pointer;
    transition: all 0.2s ease;
}

.post-modal-body .post-tag.selected {
    background: var(--primary);
    color: var(--white);
}

.post-modal-footer {
    padding: var(--space-md);
    border-top: 1px solid var(--gray-100);
}

/* ===============================================
   PROGRESS TAB
   =============================================== */

.progress-header {
    text-align: center;
    margin-bottom: var(--space-lg);
}

.progress-header h2 {
    font-size: 1.5rem;
    color: var(--text);
    margin-bottom: var(--space-xs);
}

.progress-header p {
    color: var(--text-muted);
}

.chart-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-lg);
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.chart-header h3 {
    font-size: 1rem;
    color: var(--text);
}

.chart-period {
    display: flex;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    padding: 2px;
}

.period-btn {
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.period-btn.active {
    background: var(--white);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

.chart-container {
    height: 200px;
    position: relative;
}

#weight-chart-canvas {
    width: 100%;
    height: 100%;
}

/* Log Weight */
.log-weight-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: var(--space-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-lg);
}

.log-weight-card h3 {
    font-size: 1rem;
    color: var(--text);
    margin-bottom: var(--space-md);
    text-align: center;
}

.log-weight-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
}

.weight-input-group {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.weight-adjust {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    border-radius: var(--radius-full);
    font-size: 1.5rem;
    color: var(--text-secondary);
    transition: background 0.2s ease;
}

.weight-adjust:active {
    background: var(--gray-200);
}

#new-weight-input {
    width: 100px;
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    background: transparent;
}

.weight-unit {
    font-size: 1.25rem;
    color: var(--text-muted);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.stat-card {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    background: var(--white);
    padding: var(--space-md);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.stat-card .stat-icon {
    font-size: 1.5rem;
}

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

.stat-card .stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Weight History */
.weight-history {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--white);
    padding: var(--space-md);
    border-radius: var(--radius);
}

.history-date {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.history-weight {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.history-change {
    font-size: 0.85rem;
    font-weight: 500;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
}

.history-change.positive {
    background: var(--danger-light);
    color: var(--danger);
}

.history-change.negative {
    background: var(--primary-light);
    color: var(--primary-dark);
}

/* ===============================================
   PROFILE TAB
   =============================================== */

.profile-header {
    text-align: center;
    padding: var(--space-xl) 0;
}

.profile-avatar-large {
    width: 100px;
    height: 100px;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0 auto var(--space-md);
}

.profile-header h2 {
    font-size: 1.5rem;
    color: var(--text);
    margin-bottom: var(--space-xs);
}

.profile-member-since {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.profile-stats {
    display: flex;
    justify-content: space-around;
    background: var(--white);
    padding: var(--space-lg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: var(--space-lg);
}

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

.profile-stat-value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.profile-stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.profile-menu {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
}

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    background: var(--white);
    padding: var(--space-md);
    text-align: left;
}

.profile-menu-item .menu-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    border-radius: var(--radius);
}

.profile-menu-item .menu-icon svg {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
}

.profile-menu-item span {
    flex: 1;
    font-size: 0.95rem;
    color: var(--text);
}

.profile-menu-item .menu-arrow {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}

.app-version {
    text-align: center;
    padding: var(--space-xl);
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ===============================================
   BOTTOM NAVIGATION
   =============================================== */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-evenly;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-top: 0.5px solid rgba(0, 0, 0, 0.08);
    padding: 8px 0;
    padding-bottom: calc(var(--safe-bottom) + 8px);
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 4px 2px;
    min-width: 0;
    flex: 1;
    transition: all 0.15s ease;
    position: relative;
}

.nav-item svg {
    width: 24px;
    height: 24px;
    color: var(--text-muted);
    transition: all 0.15s ease;
}

.nav-item span {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.15s ease;
    white-space: nowrap;
    letter-spacing: 0;
}

.nav-item.active svg {
    color: var(--primary);
}

.nav-item.active span {
    color: var(--primary);
    font-weight: 600;
}

/* ===============================================
   TOAST NOTIFICATIONS
   =============================================== */

.toast-container {
    position: fixed;
    top: calc(var(--safe-top) + var(--space-md));
    left: var(--space-md);
    right: var(--space-md);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    padding: 14px 18px;
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    pointer-events: auto;
    animation: toastIn 0.35s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.toast.toast-out {
    animation: toastOut 0.25s ease forwards;
}

@keyframes toastIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes toastOut {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(-20px);
        opacity: 0;
    }
}

.toast-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    font-size: 1.25rem;
}

.toast.success .toast-icon {
    background: var(--primary-light);
}

.toast.error .toast-icon {
    background: var(--danger-light);
}

.toast.warning .toast-icon {
    background: var(--accent-light);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}

.toast-message {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ===============================================
   UTILITIES
   =============================================== */

.text-center { text-align: center; }
.text-primary { color: var(--primary); }
.text-muted { color: var(--text-muted); }
.font-bold { font-weight: 700; }
.mt-lg { margin-top: var(--space-lg); }
.mb-lg { margin-bottom: var(--space-lg); }

/* ===============================================
   REMINDERS MODAL
   =============================================== */

.reminders-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
}

.reminders-modal.hidden {
    display: none;
}

.reminders-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    animation: scaleIn 0.3s ease;
}

.reminders-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    border-bottom: 1px solid var(--gray-200);
}

.reminders-header h3 {
    font-size: 1.25rem;
    color: var(--text);
}

.reminders-body {
    padding: var(--space-md);
}

.reminders-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: var(--space-lg);
    text-align: center;
}

.reminder-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--gray-100);
}

.reminder-item:last-child {
    border-bottom: none;
}

.reminder-info {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.reminder-icon {
    font-size: 1.5rem;
}

.reminder-text h4 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}

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

.reminder-time {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.reminder-time input[type="time"] {
    padding: var(--space-xs) var(--space-sm);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--text);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--gray-300);
    transition: 0.3s;
    border-radius: 28px;
}

.toggle-slider::before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--primary);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
}

.reminders-footer {
    padding: var(--space-md);
    border-top: 1px solid var(--gray-200);
}

.notification-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: var(--space-sm);
}

/* ===============================================
   CHAT COM DR. ELIAS
   =============================================== */

/* Floating Chat Button */
.floating-chat-btn {
    position: fixed;
    bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
    right: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--text);
    color: var(--white);
    padding: 12px 18px;
    border-radius: var(--radius-full);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    z-index: 500;
    transition: all 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.floating-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.chat-btn-icon {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-btn-icon svg {
    width: 20px;
    height: 20px;
}

.chat-btn-label {
    font-size: 0.9rem;
    font-weight: 600;
}

.chat-notification-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    background: var(--primary);
    border-radius: 50%;
    border: 2px solid var(--white);
    animation: pulse 2s infinite;
}

/* Chat Modal */
.chat-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.chat-modal.hidden {
    display: none;
}

.chat-container {
    width: 100%;
    max-width: 500px;
    height: 85vh;
    max-height: 700px;
    background: var(--gray-100);
    border-radius: 20px 20px 0 0;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.35s cubic-bezier(0.25, 0.1, 0.25, 1);
    overflow: hidden;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--white);
    padding: var(--space-md);
    background: var(--gradient-secondary);
    color: var(--white);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.chat-doctor {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.doctor-avatar-small {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.doctor-info-small h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.online-status {
    font-size: 0.8rem;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 5px;
}

.online-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
}

.close-chat {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 1.5rem;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    background: var(--gray-50);
}

.chat-message {
    display: flex;
    gap: var(--space-sm);
    max-width: 85%;
}

.chat-message.doctor {
    align-self: flex-start;
}

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

.message-avatar {
    width: 32px;
    height: 32px;
    background: var(--secondary);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
}

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

.message-content {
    background: var(--white);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.chat-message.user .message-content {
    background: var(--primary);
    color: var(--white);
}

.message-content p {
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: var(--space-xs);
}

.message-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: block;
}

.chat-message.user .message-time {
    color: rgba(255, 255, 255, 0.7);
}

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

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

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

@keyframes typing {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

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

#chat-input {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    background: var(--gray-100);
    border-radius: var(--radius-full);
    font-size: 1rem;
}

#chat-input:focus {
    background: var(--white);
    box-shadow: 0 0 0 2px var(--primary);
}

.send-btn {
    width: 44px;
    height: 44px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
}

.send-btn svg {
    width: 20px;
    height: 20px;
}

.send-btn:disabled {
    opacity: 0.5;
}

/* ===============================================
   RESPONSIVE
   =============================================== */

@media (min-width: 768px) {
    .container {
        max-width: 600px;
        margin: 0 auto;
    }
    
    .tab-content {
        max-width: 600px;
        margin: 0 auto;
    }
}
