﻿:root {
  --bg-dark: #0b1120;
  --bg-surface: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #27354f;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent: #38bdf8;
  --accent-hover: #0284c7;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --success: #22c55e;
  --border: #334155;
  --border-light: rgba(255, 255, 255, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
html, body { height: 100%; background: var(--bg-dark); color: var(--text-main); overflow: hidden; }

.app-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-light);
  border-right: 1px solid var(--border-light);
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
  position: relative;
}

/* HEADER */
.app-header {
  background: #131d33;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-top: max(12px, env(safe-area-inset-top));
  flex-shrink: 0;
}
.header-brand { display: flex; align-items: center; gap: 12px; }
.header-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 17px;
  color: #0f172a;
}
.header-title-box { display: flex; flex-direction: column; }
.header-title { font-size: 16px; font-weight: 600; color: #fff; }
.header-status { font-size: 11px; color: var(--success); font-weight: 500; }
.header-user-tag {
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

/* MAIN & SCREENS */
.app-main { flex: 1; position: relative; overflow: hidden; display: flex; }
.view-screen { position: absolute; inset: 0; display: none; flex-direction: column; }
.view-screen.active { display: flex; }
.view-content { flex: 1; overflow-y: auto; padding: 18px; }

/* 1. AUTH SCREEN */
.auth-card {
  margin: auto;
  width: 92%;
  max-width: 400px;
  background: var(--bg-card);
  padding: 28px 24px;
  border-radius: 18px;
  border: 1px solid var(--border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  text-align: center;
}
.auth-icon { font-size: 44px; margin-bottom: 12px; }
.auth-card h2 { font-size: 20px; margin-bottom: 6px; color: #fff; }
.auth-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; line-height: 1.45; }
.form-group { text-align: left; margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; font-weight: 500; color: var(--text-muted); margin-bottom: 5px; }
.form-group input {
  width: 100%;
  background: #0b1120;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 11px 14px;
  color: #fff;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.form-group input:focus { border-color: var(--accent); }
.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #0b1120;
  border: none;
  border-radius: 9px;
  padding: 12px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  margin-top: 10px;
  transition: background 0.2s;
}
.btn-primary:hover { background: var(--accent-hover); }
.error-msg {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--danger);
  color: #fca5a5;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 12px;
  margin-bottom: 12px;
  text-align: left;
}
.waiting-box { padding: 16px 0; }
.pulse-phone { font-size: 48px; animation: bounce 1.8s infinite; margin-bottom: 12px; }
.waiting-box h3 { color: var(--accent); font-size: 17px; margin-bottom: 8px; }
.waiting-box p { color: var(--text-main); font-size: 13px; line-height: 1.5; margin-bottom: 14px; }
.wait-sub { font-size: 12px; color: var(--text-muted); }

/* 2. CHAT SCREEN */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chat-msg {
  max-width: 82%;
  padding: 11px 15px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.48;
  word-wrap: break-word;
}
.chat-msg.user {
  align-self: flex-end;
  background: #0284c7;
  color: #fff;
  border-bottom-right-radius: 3px;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.25);
}
.chat-msg.assistant {
  align-self: flex-start;
  background: var(--bg-card);
  color: var(--text-main);
  border-bottom-left-radius: 3px;
  border: 1px solid var(--border);
}
.chat-msg.system {
  align-self: center;
  background: rgba(56, 189, 248, 0.1);
  color: var(--accent);
  font-size: 12px;
  text-align: center;
  border-radius: 20px;
  padding: 6px 14px;
  border: 1px solid rgba(56, 189, 248, 0.2);
}
.chat-input-bar {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  background: #131d33;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-input-bar input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 11px 18px;
  color: #fff;
  font-size: 14px;
  outline: none;
}
.chat-input-bar input:focus { border-color: var(--accent); }
.btn-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #0b1120;
  border: none;
  font-size: 16px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s;
}
.btn-send:hover { background: var(--accent-hover); transform: scale(1.05); }

/* 3. CLOUD SCREEN */
.section-top-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.section-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.cloud-nav-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 14px;
}
.cloud-breadcrumb { font-size: 12px; font-weight: 600; color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-sm {
  background: var(--accent);
  color: #0b1120;
  border: none;
  padding: 7px 14px;
  border-radius: 7px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
.btn-xs {
  background: var(--bg-card);
  color: #cbd5e1;
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
}
.cards-list { display: flex; flex-direction: column; gap: 10px; }
.cloud-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.15s;
}
.cloud-item:hover { background: var(--bg-card-hover); }
.cloud-item-info { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; cursor: pointer; }
.cloud-icon { font-size: 20px; flex-shrink: 0; }
.cloud-meta { display: flex; flex-direction: column; min-width: 0; }
.cloud-name { font-size: 14px; font-weight: 500; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cloud-sub { font-size: 11px; color: var(--text-muted); }
.cloud-actions { display: flex; gap: 6px; }
.btn-action-icon {
  background: #0f172a;
  border: 1px solid var(--border);
  color: #cbd5e1;
  border-radius: 6px;
  padding: 5px 9px;
  font-size: 12px;
  cursor: pointer;
}
.btn-action-icon:hover { border-color: var(--accent); color: var(--accent); }
.btn-action-danger:hover { border-color: var(--danger); color: var(--danger); }

/* 4. FITNESS & 5. REMINDERS */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0 16px; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 14px; text-align: center; }
.stat-val { display: block; font-size: 26px; font-weight: 700; color: var(--accent); margin-bottom: 2px; }
.stat-label { font-size: 12px; color: var(--text-muted); }
.sub-heading { font-size: 14px; font-weight: 600; color: #cbd5e1; margin-bottom: 8px; }
.item-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px 15px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.item-header { display: flex; justify-content: space-between; align-items: center; }
.item-title { font-weight: 600; font-size: 14px; color: #fff; }
.item-sub { font-size: 11px; color: var(--accent); }
.item-body { font-size: 12px; color: var(--text-muted); line-height: 1.4; }

/* 6. SETTINGS SCREEN */
.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  font-size: 13px;
  line-height: 2;
  margin-top: 10px;
}
.tag-secure { background: rgba(34, 197, 94, 0.15); color: var(--success); padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; }
.info-note { font-size: 12px; color: var(--text-muted); line-height: 1.5; margin: 14px 0; background: #0f172a; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); }
.btn-danger {
  width: 100%;
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: 9px;
  padding: 12px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  margin-top: 10px;
  transition: background 0.15s;
}
.btn-danger:hover { background: var(--danger-hover); }

/* BOTTOM NAVIGATION */
.app-bottom-nav {
  background: #131d33;
  display: flex;
  justify-content: space-around;
  border-top: 1px solid var(--border);
  padding-bottom: max(6px, env(safe-area-inset-bottom));
  flex-shrink: 0;
}
.nav-btn {
  background: none;
  border: none;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  flex: 1;
  transition: color 0.15s;
}
.nav-btn:hover { color: #fff; }
.nav-btn.active { color: var(--accent); font-weight: 600; }
.nav-icon { font-size: 20px; }

.empty-state { text-align: center; color: var(--text-muted); padding: 36px 16px; font-size: 13px; }

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