/* Kairos Coach - Web App Styles */
/* Daily-use web application with auth, chat, history */

/* ============================================
   CSS VARIABLES
   ============================================ */
:root {
    /* Core colors */
    --primary: #4a69bd;
    --primary-light: #5e84e0;
    --primary-dark: #3c5da0;
    --secondary: #5e84e0;

    /* Accent colors */
    --streak-fire: #ff6b35;
    --streak: #ff6b35;
    --success: #2ecc71;
    --warning: #f39c12;
    --danger: #e74c3c;
    --error: #e74c3c;
    --premium: #9b59b6;

    /* Neutrals */
    --text-primary: #222428;
    --text-secondary: #666;
    --text-muted: #999;
    --background: #f4f5f8;
    --surface: #ffffff;
    --border: #e0e0e0;
    --border-light: #f0f0f0;

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.15);

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

    /* Border radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 50%;

    /* Safe areas for PWA */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ============================================
   BASE STYLES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

/* ============================================
   MAIN CONTAINER
   ============================================ */
.kairos-container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--background);
    position: relative;
}

/* Full width on mobile */
@media (max-width: 480px) {
    .kairos-container {
        max-width: 100%;
    }
}

/* ============================================
   HEADER
   ============================================ */
.kairos-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    padding-top: calc(var(--safe-top) + var(--space-md));
    background: var(--surface);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left, .header-right {
    width: 60px;
}

.header-center {
    flex: 1;
    text-align: center;
}

.header-logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.header-btn {
    background: none;
    border: none;
    padding: var(--space-sm);
    cursor: pointer;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.header-btn:hover {
    background: var(--background);
}

/* Streak Badge */
.streak-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, var(--streak-fire), #ff8f5a);
    padding: 6px 12px;
    border-radius: 20px;
    color: white;
    font-weight: 600;
}

.streak-fire {
    font-size: 16px;
}

.streak-count {
    font-size: 14px;
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */
.kairos-main {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* ============================================
   BOTTOM NAVIGATION
   ============================================ */
.kairos-nav {
    display: flex;
    background: var(--surface);
    border-top: 1px solid var(--border-light);
    padding: var(--space-sm);
    padding-bottom: calc(var(--safe-bottom) + var(--space-sm));
    position: sticky;
    bottom: 0;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: var(--space-sm);
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    transition: color 0.2s;
}

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

.nav-item svg {
    width: 24px;
    height: 24px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-primary {
    width: 100%;
    padding: var(--space-md);
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    width: 100%;
    padding: var(--space-md);
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-large {
    padding: var(--space-lg);
    font-size: 18px;
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    padding: var(--space-md);
}

.btn-text:hover {
    color: var(--primary);
}

.btn-danger {
    background: var(--danger);
    color: white;
    border: none;
    padding: var(--space-md);
    border-radius: var(--radius-sm);
    font-size: 14px;
    cursor: pointer;
    width: 100%;
    margin-top: var(--space-md);
}

.btn-danger-outline {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: 14px;
    cursor: pointer;
    margin-top: var(--space-md);
}

.btn-upgrade {
    background: linear-gradient(135deg, var(--premium), #8e44ad);
    color: white;
    border: none;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: 14px;
    cursor: pointer;
    font-weight: 600;
}

/* ============================================
   SCREENS - COMMON
   ============================================ */
.screen {
    min-height: calc(100vh - 130px);
    padding: var(--space-md);
    animation: fadeIn 0.3s ease;
}

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

/* ============================================
   WELCOME SCREEN
   ============================================ */
.screen-welcome {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: var(--space-xl);
    min-height: 100vh;
}

.welcome-content {
    max-width: 320px;
}

.welcome-logo {
    margin-bottom: var(--space-lg);
}

.app-logo {
    width: 120px;
    height: 120px;
    border-radius: var(--radius-full);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.welcome-title {
    font-size: 42px;
    font-weight: 700;
    margin-bottom: var(--space-sm);
}

.welcome-subtitle {
    font-size: 18px;
    opacity: 0.9;
    margin-bottom: var(--space-xl);
}

.welcome-features {
    margin-bottom: var(--space-xl);
}

.feature-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
    font-size: 15px;
}

.feature-icon {
    font-size: 24px;
}

.screen-welcome .btn-primary {
    background: white;
    color: var(--primary);
    margin-bottom: var(--space-md);
}

.screen-welcome .btn-secondary {
    border-color: white;
    color: white;
}

.screen-welcome .btn-secondary:hover {
    background: white;
    color: var(--primary);
}

.privacy-note {
    font-size: 12px;
    opacity: 0.8;
    margin-top: var(--space-lg);
}

.login-prompt {
    margin-top: var(--space-md);
    font-size: 14px;
    opacity: 0.9;
}

.login-prompt a {
    color: white;
    font-weight: 600;
}

/* ============================================
   COACH SELECTION SCREEN
   ============================================ */
.screen-coaches {
    background: var(--surface);
}

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

.screen-header h2 {
    color: var(--primary);
    font-size: 24px;
    margin-bottom: var(--space-sm);
}

.screen-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.coaches-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

.coach-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.coach-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.coach-card.selected {
    border-color: var(--primary);
    background: rgba(74, 105, 189, 0.05);
}

.coach-avatar {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full);
    margin: 0 auto var(--space-md);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 3px solid;
    background: white;
}

.coach-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.coach-initial {
    color: white;
    font-size: 28px;
    font-weight: 700;
}

.coach-name {
    font-size: 18px;
    margin-bottom: var(--space-xs);
}

.coach-style {
    font-size: 13px;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.coach-description {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* ============================================
   CHECK-IN SCREEN
   ============================================ */
.screen-checkin {
    background: var(--surface);
    padding: 0;
}

.coach-banner {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-light);
}

.coach-avatar-small {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    font-weight: 700;
    flex-shrink: 0;
    overflow: hidden;
    border: 2px solid;
    background: white;
}

.coach-avatar-small .coach-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.coach-info {
    flex: 1;
}

.coach-info h3 {
    font-size: 16px;
    margin-bottom: 2px;
}

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

.change-coach-btn {
    background: none;
    border: 1px solid var(--border);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkin-form {
    padding: var(--space-lg);
}

.checkin-form h2 {
    font-size: 22px;
    margin-bottom: var(--space-lg);
    text-align: center;
}

/* Sliders */
.slider-group {
    margin-bottom: var(--space-xl);
}

.slider-group label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
}

.slider-label {
    font-weight: 600;
    font-size: 15px;
}

.slider-value {
    font-size: 14px;
    color: var(--text-secondary);
}

.slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: var(--border);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    background: var(--primary);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.slider::-moz-range-thumb {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: var(--radius-full);
    background: var(--primary);
    cursor: pointer;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: var(--space-sm);
}

/* Cycle Phase Section - subtle */
.cycle-section {
    margin-top: var(--space-md);
    padding-top: var(--space-sm);
}

.cycle-label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
}

.cycle-label .optional {
    font-size: 11px;
    opacity: 0.7;
}

.cycle-options {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.cycle-btn {
    padding: 5px 10px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

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

.cycle-btn.selected {
    background: var(--surface);
    color: var(--text-secondary);
    border-color: var(--text-secondary);
}

.usage-note {
    text-align: center;
    font-size: 14px;
    color: var(--primary);
    margin-top: var(--space-md);
    padding: 10px 16px;
    background: rgba(74, 105, 189, 0.1);
    border-radius: 8px;
    font-weight: 500;
}

/* ============================================
   LOADING SCREEN
   ============================================ */
.screen-loading {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    min-height: 100vh;
}

.loading-content {
    padding: var(--space-xl);
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: var(--radius-full);
    animation: spin 1s linear infinite;
    margin: 0 auto var(--space-lg);
}

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

.loading-content h3 {
    font-size: 20px;
    margin-bottom: var(--space-xl);
}

.loading-steps {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    align-items: flex-start;
}

.loading-step {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    opacity: 0.4;
    transition: opacity 0.3s;
}

.loading-step.active {
    opacity: 0.7;
}

.loading-step.completed {
    opacity: 1;
}

.loading-step .step-icon {
    font-size: 20px;
}

.loading-step .step-check {
    display: none;
    color: var(--success);
    font-weight: bold;
}

.loading-step.completed .step-check {
    display: inline;
}

/* ============================================
   RESULTS SCREEN
   ============================================ */
.screen-results {
    background: var(--surface);
    padding: 0;
}

.results-coach-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg);
}

.results-content {
    padding: var(--space-md);
}

.results-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-light);
    margin-bottom: var(--space-lg);
}

.weather-summary,
.checkin-summary,
.advice-section {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-light);
}

.weather-summary:last-child,
.checkin-summary:last-child,
.advice-section:last-child {
    border-bottom: none;
}

.weather-summary h4,
.checkin-summary h4,
.advice-section h4 {
    font-size: 14px;
    color: var(--primary);
    margin-bottom: var(--space-md);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.weather-details {
    display: flex;
    gap: var(--space-lg);
    font-size: 15px;
}

/* Daylight Bar */
.daylight-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-light);
}

.daylight-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-top: var(--space-xs);
}

.daylight-item > span {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

.daylight-item .bar-track {
    flex: 1;
}

.daylight-fill {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.daylight-remaining {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

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

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

.bar-item span {
    width: 80px;
    font-size: 14px;
    color: var(--text-secondary);
}

.bar-track {
    flex: 1;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.advice-text {
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
}

.poi-link {
    color: var(--primary);
    text-decoration: none;
    border-bottom: 1px dashed var(--primary);
    transition: border-color 0.2s;
}

.poi-link:hover {
    border-bottom-style: solid;
}

.poi-link::after {
    content: ' \2197';
    font-size: 0.8em;
    opacity: 0.7;
}

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

/* ============================================
   CHAT SCREEN
   ============================================ */
.screen-chat {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 130px);
    padding: 0;
    background: var(--background);
}

.chat-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--surface);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.chat-empty {
    text-align: center;
    padding: var(--space-xl);
    color: var(--text-secondary);
}

.chat-empty p {
    margin-bottom: var(--space-md);
}

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

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

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

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
    overflow: hidden;
    border: 2px solid;
    background: white;
}

.message-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message-bubble {
    padding: var(--space-md);
    border-radius: var(--radius-lg);
    font-size: 15px;
    line-height: 1.5;
}

.coach-bubble {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-top-left-radius: 4px;
}

.user-bubble {
    background: var(--primary);
    color: white;
    border-top-right-radius: 4px;
}

/* Typing animation */
.typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: var(--space-md) var(--space-lg);
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--text-muted);
    border-radius: var(--radius-full);
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-6px); }
}

.chat-input-area {
    padding: var(--space-md);
    background: var(--surface);
    border-top: 1px solid var(--border-light);
}

.chat-input-wrapper {
    display: flex;
    gap: var(--space-sm);
}

.chat-input-area input {
    flex: 1;
    padding: var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 16px;
    outline: none;
}

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

.chat-input-area input:disabled {
    background: var(--background);
}

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

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-limit-warning {
    text-align: center;
    padding: var(--space-md);
    background: var(--background);
    border-radius: var(--radius-md);
}

.chat-limit-warning p {
    margin-bottom: var(--space-sm);
    color: var(--text-secondary);
    font-size: 14px;
}

.chat-usage-note {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: var(--space-sm);
}

.chat-login-required {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
    text-align: center;
}

.chat-login-required h3 {
    font-size: 20px;
    margin-bottom: var(--space-md);
}

.chat-login-required p {
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
    max-width: 280px;
}

/* ============================================
   HISTORY SCREEN
   ============================================ */
.screen-history {
    background: var(--surface);
}

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

.history-header h2 {
    color: var(--primary);
    font-size: 24px;
    margin-bottom: var(--space-md);
}

.streak-display {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    background: linear-gradient(135deg, var(--streak-fire), #ff8f5a);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-lg);
    color: white;
}

.streak-fire-large {
    font-size: 28px;
}

.streak-number {
    font-size: 32px;
    font-weight: 700;
}

.streak-label {
    font-size: 14px;
    opacity: 0.9;
}

.history-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.stat-card {
    background: var(--background);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Calendar */
.history-calendar {
    margin-bottom: var(--space-lg);
}

.calendar-grid {
    background: var(--background);
    padding: var(--space-md);
    border-radius: var(--radius-md);
}

.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: var(--space-sm);
}

.calendar-header span {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
}

.calendar-day.empty {
    visibility: hidden;
}

.calendar-day.checked {
    background: var(--success);
    color: white;
    font-weight: 600;
}

.calendar-day.today {
    border: 2px solid var(--primary);
    font-weight: 600;
}

.calendar-day.today.checked {
    border-color: var(--success);
}

/* History list */
.history-list h3 {
    font-size: 16px;
    color: var(--primary);
    margin-bottom: var(--space-md);
}

.history-empty {
    text-align: center;
    padding: var(--space-xl);
    color: var(--text-secondary);
}

.history-empty p {
    margin-bottom: var(--space-md);
}

.history-item {
    display: flex;
    align-items: center;
    padding: var(--space-md);
    background: var(--background);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
}

.history-date {
    width: 100px;
    font-size: 13px;
    color: var(--text-secondary);
}

.history-metrics {
    flex: 1;
    display: flex;
    gap: var(--space-md);
    font-size: 14px;
}

.history-weather {
    font-size: 14px;
    color: var(--text-muted);
}

/* ============================================
   UPGRADE SCREEN
   ============================================ */
.screen-upgrade {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background: linear-gradient(135deg, var(--premium), #8e44ad);
    color: white;
    min-height: 100vh;
}

.upgrade-content {
    padding: var(--space-xl);
    max-width: 360px;
}

.upgrade-icon {
    font-size: 64px;
    margin-bottom: var(--space-lg);
}

.upgrade-content h2 {
    font-size: 28px;
    margin-bottom: var(--space-sm);
}

.upgrade-subtitle {
    opacity: 0.9;
    margin-bottom: var(--space-xl);
}

.upgrade-features {
    margin-bottom: var(--space-xl);
    text-align: left;
}

.upgrade-feature {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) 0;
    font-size: 15px;
}

.feature-check {
    color: var(--success);
    font-weight: bold;
}

.upgrade-pricing {
    background: rgba(255, 255, 255, 0.1);
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-lg);
}

.price-tag {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
}

.price-amount {
    font-size: 48px;
    font-weight: 700;
}

.price-period {
    font-size: 18px;
    opacity: 0.8;
}

.price-note {
    font-size: 13px;
    opacity: 0.7;
    margin-top: var(--space-sm);
}

.screen-upgrade .btn-primary {
    background: white;
    color: var(--premium);
    margin-bottom: var(--space-sm);
}

.upgrade-note {
    font-size: 13px;
    opacity: 0.8;
    margin-bottom: var(--space-md);
}

/* Plan selection cards */
.upgrade-plans {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    width: 100%;
}

.plan-option {
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-lg);
    padding: var(--space-lg) var(--space-md);
    text-align: center;
    position: relative;
}

.plan-option.plan-recommended {
    background: rgba(255, 255, 255, 0.25);
    border-color: white;
}

.plan-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--streak);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.plan-header {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: var(--space-sm);
    opacity: 0.9;
}

.plan-price {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: var(--space-xs);
}

.plan-price span {
    font-size: 14px;
    font-weight: 400;
    opacity: 0.8;
}

.plan-subtext {
    font-size: 12px;
    opacity: 0.7;
    margin-bottom: var(--space-md);
}

.plan-option .btn-primary {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    font-size: 13px;
    margin-bottom: 0;
}

.plan-option .btn-highlight {
    background: white;
    color: var(--premium);
    font-weight: 600;
}

/* ============================================
   SETTINGS PANEL
   ============================================ */
.settings-panel {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    justify-content: flex-end;
}

.settings-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.settings-content {
    position: relative;
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    height: 100%;
    overflow-y: auto;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    background: var(--surface);
}

.settings-header h2 {
    font-size: 20px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: var(--space-sm);
}

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

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

.settings-section h3 {
    font-size: 14px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-md);
}

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

.settings-item.clickable {
    cursor: pointer;
}

.settings-item.clickable:hover {
    background: var(--border-light);
}

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

.settings-value.premium {
    color: var(--premium);
    font-weight: 600;
}

.settings-note {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: var(--space-sm);
}

.settings-link {
    display: block;
    padding: var(--space-md);
    background: var(--background);
    border-radius: var(--radius-sm);
    color: var(--primary);
    text-decoration: none;
    margin-bottom: var(--space-sm);
}

.settings-privacy {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    margin-top: var(--space-md);
}

.settings-profile-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: var(--space-sm);
}

.settings-profile-summary span {
    background: rgba(74, 105, 189, 0.1);
    color: var(--primary);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: capitalize;
}

/* ============================================
   AUTH MODAL
   ============================================ */
.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
}

.auth-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.auth-content {
    position: relative;
    background: var(--surface);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 400px;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.auth-form {
    padding: var(--space-xl);
    position: relative;
}

.auth-close {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-muted);
    cursor: pointer;
}

.auth-form h2 {
    font-size: 24px;
    margin-bottom: var(--space-sm);
    text-align: center;
}

.auth-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
    font-size: 14px;
}

.auth-input-group {
    margin-bottom: var(--space-lg);
}

.auth-input-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: var(--space-sm);
}

.auth-input-group input {
    width: 100%;
    padding: var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 16px;
    outline: none;
}

.auth-input-group input:focus {
    border-color: var(--primary);
}

.auth-privacy {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: var(--space-md);
}

/* Auth sent state */
.auth-sent {
    text-align: center;
    padding: var(--space-lg) 0;
}

.auth-sent-icon {
    font-size: 64px;
    margin-bottom: var(--space-md);
}

.auth-sent h3 {
    font-size: 22px;
    margin-bottom: var(--space-sm);
    color: var(--primary);
}

.auth-sent p {
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.auth-sent-note {
    font-size: 13px;
    color: var(--text-muted);
}

/* ============================================
   PWA STYLES
   ============================================ */
/* Standalone mode */
@media (display-mode: standalone) {
    .kairos-container {
        padding-top: var(--safe-top);
    }
}

/* Hide address bar on mobile */
html {
    height: -webkit-fill-available;
}

body {
    min-height: 100vh;
    min-height: -webkit-fill-available;
}

/* ============================================
   PROFILE SCREEN
   ============================================ */
.screen-profile {
    padding: var(--space-lg);
    padding-bottom: 100px;
}

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

.profile-header h2 {
    margin: 0 0 8px;
    font-size: 24px;
    color: var(--text-primary);
}

.profile-header p {
    margin: 0;
    color: var(--text-secondary);
}

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

.profile-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.profile-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.profile-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.profile-option {
    padding: 10px 16px;
    border: 2px solid var(--border-light);
    border-radius: 20px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.profile-option:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.profile-option.selected {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.profile-actions {
    margin-top: var(--space-xl);
    text-align: center;
}

.profile-note {
    margin-top: var(--space-md);
    font-size: 13px;
    color: var(--text-muted);
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */
@media (max-width: 360px) {
    .coaches-grid {
        grid-template-columns: 1fr;
    }

    .history-stats {
        grid-template-columns: 1fr;
    }

    .weather-details {
        flex-direction: column;
        gap: var(--space-sm);
    }
}

/* Desktop enhancements */
@media (min-width: 481px) {
    .kairos-container {
        border-left: 1px solid var(--border-light);
        border-right: 1px solid var(--border-light);
        box-shadow: var(--shadow-lg);
    }
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    max-width: 90%;
    text-align: center;
    box-shadow: var(--shadow-md);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast-info {
    background: var(--primary);
    color: white;
}

.toast-success {
    background: var(--success);
    color: white;
}

.toast-error {
    background: var(--error);
    color: white;
}

/* ============================================
   ACTIVITY LOG SCREEN
   ============================================ */
.screen-log {
    padding: var(--space-lg);
    padding-bottom: 100px;
}

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

.log-header h2 {
    font-size: 28px;
    margin-bottom: var(--space-xs);
}

.log-header p {
    color: var(--text-secondary);
}

.activity-picker {
    margin-bottom: var(--space-lg);
}

.activity-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-sm);
}

.activity-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
    background: var(--surface);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
}

.activity-btn:hover {
    border-color: var(--primary-light);
    background: rgba(74, 105, 189, 0.05);
}

.activity-btn.selected {
    border-color: var(--primary);
    background: rgba(74, 105, 189, 0.1);
}

.activity-icon {
    font-size: 28px;
    margin-bottom: var(--space-xs);
}

.activity-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.feeling-section {
    margin-bottom: var(--space-lg);
    animation: slideDown 0.3s ease;
}

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

.feeling-section h3 {
    font-size: 16px;
    margin-bottom: var(--space-md);
    text-align: center;
}

.feeling-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
}

.feeling-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
    background: var(--surface);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
}

.feeling-btn:hover {
    border-color: var(--primary-light);
}

.feeling-btn.selected {
    border-color: var(--success);
    background: rgba(46, 204, 113, 0.1);
}

.feeling-icon {
    font-size: 24px;
    margin-bottom: var(--space-xs);
}

.feeling-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.note-section {
    margin-bottom: var(--space-xl);
    animation: slideDown 0.3s ease;
}

.activity-note-input {
    width: 100%;
    padding: var(--space-md);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: 16px;
    margin-bottom: var(--space-md);
    outline: none;
    transition: border-color 0.2s;
}

.activity-note-input:focus {
    border-color: var(--primary);
}

.today-logs {
    margin-top: var(--space-xl);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border-light);
}

.today-logs h3 {
    font-size: 16px;
    margin-bottom: var(--space-md);
    color: var(--text-secondary);
}

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

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

.log-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.log-details {
    flex: 1;
    min-width: 0;
}

.log-activity {
    display: block;
    font-weight: 600;
    font-size: 14px;
}

.log-note {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.log-feeling {
    font-size: 18px;
    flex-shrink: 0;
}

.log-time {
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.log-delete {
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
    color: var(--text-muted);
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    transition: color 0.2s, background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.log-delete:hover {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}

.log-delete:active {
    transform: scale(0.95);
}

/* ============================================
   WELLBEING SCREEN
   ============================================ */
.screen-wellbeing {
    padding: var(--space-lg);
    padding-bottom: 100px;
    background: var(--background);
}

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

.wellbeing-header h2 {
    font-size: 28px;
    margin-bottom: var(--space-xs);
    color: var(--text-primary);
}

.wellbeing-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Insights Section */
.insights-section {
    margin-bottom: var(--space-xl);
}

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

.insights-loader {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    margin: 0 auto var(--space-md);
    animation: spin 1s linear infinite;
}

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

.insights-welcome {
    text-align: center;
    padding: var(--space-xl);
    background: var(--surface);
    border-radius: var(--radius-lg);
}

.insights-welcome .insights-icon {
    font-size: 40px;
    display: block;
    margin-bottom: var(--space-md);
}

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

.insight-card {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-lg);
    background: linear-gradient(135deg, var(--surface) 0%, rgba(74, 105, 189, 0.05) 100%);
    border-radius: var(--radius-lg);
    border-left: 4px solid var(--primary);
    box-shadow: var(--shadow-sm);
}

.insight-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.insight-text {
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-primary);
    margin: 0;
}

/* Wellbeing Calendar */
.wellbeing-calendar {
    margin-bottom: var(--space-xl);
}

.wellbeing-calendar h3 {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.calendar-day.active-day {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    font-weight: 600;
}

/* Wellbeing Stats */
.wellbeing-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.wellbeing-stats .stat-card {
    text-align: center;
    padding: var(--space-lg);
    background: var(--surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.wellbeing-stats .stat-value {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: var(--space-xs);
}

.wellbeing-stats .stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mood-stat .stat-value {
    color: var(--success);
}

/* Recent Activity Timeline */
.recent-activity {
    margin-bottom: var(--space-xl);
}

.recent-activity h3 {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.activity-timeline {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

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

.timeline-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.timeline-content {
    flex: 1;
    min-width: 0;
}

.timeline-activity {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
}

.timeline-feeling {
    font-size: 12px;
    color: var(--text-secondary);
}

.timeline-date {
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Empty States */
.wellbeing-empty {
    text-align: center;
    padding: var(--space-xl);
    background: var(--surface);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-xl);
}

.wellbeing-empty p {
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
}

.wellbeing-cta {
    text-align: center;
    padding: var(--space-xl);
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: var(--radius-lg);
    color: white;
}

.wellbeing-cta p {
    margin-bottom: var(--space-md);
    opacity: 0.9;
}

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