/* ══════════════════════════════════════════════════════
   callit-o — Premium Design System
   Minimalist / Decent / Professional
══════════════════════════════════════════════════════ */

:root {
  /* LIGHT THEME (Default) */
  --bg:          #FFFFFF;
  --bg-sub:      #F8F9FA;
  --surface:     #FFFFFF;
  --surface-sub: #F1F3F5;
  --border:      rgba(0, 0, 0, 0.06);
  --border-bold: rgba(0, 0, 0, 0.12);
  
  --accent:      #000000; /* Minimalist Black accent */
  --accent-soft: rgba(0, 0, 0, 0.05);
  --success:     #22C55E;
  --danger:      #EF4444;
  
  --tx:          #111111;
  --tx-sub:      #666666;
  --tx-dim:      #999999;

  --glass:       rgba(255, 255, 255, 0.8);
  --shadow:      0 4px 20px rgba(0,0,0,0.04);
  --shadow-lg:   0 12px 40px rgba(0,0,0,0.08);

  --r:           12px;
  --rl:          24px;
  --ff:          'Inter', -apple-system, sans-serif;
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* DARK THEME */
[data-theme="dark"] {
  --bg:          #000000;
  --bg-sub:      #0A0A0A;
  --surface:     #121212;
  --surface-sub: #1A1A1A;
  --border:      rgba(255, 255, 255, 0.08);
  --border-bold: rgba(255, 255, 255, 0.15);
  
  --accent:      #FFFFFF;
  --accent-soft: rgba(255, 255, 255, 0.1);
  
  --tx:          #F2F2F2;
  --tx-sub:      #A0A0A0;
  --tx-dim:      #606060;

  --glass:       rgba(18, 18, 18, 0.8);
  --shadow:      0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg:   0 12px 60px rgba(0,0,0,0.6);
}

* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--tx);
  font-family: var(--ff);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}

button { cursor:pointer; border:none; outline:none; background:none; font-family:inherit; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); }
button:active { transform: scale(0.96); }

input { font-family:inherit; outline:none; }
.hidden { display:none !important; }

/* ══ LAYOUT ═══════════════════════════════════════════ */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
}
.screen.active { display: flex; }

/* ══ AUTH ═════════════════════════════════════════════ */
.auth-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
}

.auth-logo { margin-bottom: 48px; }
.auth-logo svg { width: 64px; height: 64px; }
.auth-logo span { display: block; font-size: 24px; font-weight: 800; letter-spacing: -0.5px; margin-top: 12px; }

.auth-title { font-size: 32px; font-weight: 800; line-height: 1.1; margin-bottom: 16px; letter-spacing: -1px; }
.auth-sub { font-size: 16px; color: var(--tx-sub); line-height: 1.6; margin-bottom: 48px; max-width: 300px; }

.btn-google {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 32px; background: var(--tx); color: var(--bg);
  border-radius: 100px; font-weight: 600; font-size: 15px;
  box-shadow: var(--shadow);
}
.btn-google svg { width: 20px; height: 20px; }

/* ══ APP HEADER ═══════════════════════════════════════ */
.app-header {
  padding: calc(20px + var(--safe-top)) 24px 20px;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}
.app-header h2 { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; }

.header-actions { display: flex; gap: 12px; }

/* ══ NAVIGATION ═══════════════════════════════════════ */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: calc(64px + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: flex; z-index: 100;
}

.nav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; color: var(--tx-dim);
}
.nav-btn.active { color: var(--accent); }
.nav-btn svg { width: 22px; height: 22px; stroke-width: 2.2; }
.nav-btn span { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }

/* ══ LISTS ════════════════════════════════════════════ */
.content-area { flex: 1; overflow-y: auto; padding: 100px 20px calc(80px + var(--safe-bottom)); }

.item-row {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 0; border-bottom: 1px solid var(--border);
}
.item-row:last-child { border: none; }

.avatar {
  width: 52px; height: 52px; border-radius: 50%;
  object-fit: cover; background: var(--surface-sub);
  flex-shrink: 0; border: 1px solid var(--border);
}

.item-info { flex: 1; min-width: 0; }
.item-name { font-size: 16px; font-weight: 700; margin-bottom: 2px; }
.item-meta { font-size: 13px; color: var(--tx-sub); display: flex; align-items: center; gap: 6px; }

.action-btns { display: flex; gap: 8px; }
.btn-circle {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-sub); color: var(--tx);
}
.btn-circle:hover { background: var(--accent); color: var(--bg); }
.btn-circle svg { width: 18px; height: 18px; stroke-width: 2.5; }

/* ══ THEME TOGGLE ═════════════════════════════════════ */
.theme-toggle {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface-sub); display: flex; align-items: center; justify-content: center;
}

/* ══ SEARCH ═══════════════════════════════════════════ */
.search-container {
  position: fixed; top: calc(75px + var(--safe-top)); left: 20px; right: 20px;
  z-index: 90;
}
.search-input-wrap {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--surface-sub);
  border-radius: var(--r); border: 1px solid var(--border);
}
.search-input-wrap svg { width: 18px; height: 18px; color: var(--tx-dim); }
.search-input-wrap input { flex: 1; background: none; border: none; font-size: 15px; color: var(--tx); }

/* ══ MODALS ═══════════════════════════════════════════ */
.modal-ov {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.4); backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
}

.modal-box {
  width: 100%; max-width: 500px;
  background: var(--surface); border-radius: 24px 24px 0 0;
  padding: 32px 24px calc(32px + var(--safe-bottom));
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s cubic-bezier(0, 0, 0.2, 1);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.modal-title { font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.modal-sub { font-size: 14px; color: var(--tx-sub); margin-bottom: 24px; }

.btn-primary {
  width: 100%; padding: 16px; border-radius: var(--r);
  background: var(--accent); color: var(--bg);
  font-size: 16px; font-weight: 700;
}

/* ══ CALL SCREEN ══════════════════════════════════════ */
.call-screen { background: #000; color: #fff; z-index: 1000; }

.remote-video { position: absolute; inset: 0; width:100%; height:100%; object-fit: cover; }
.local-video {
  position: absolute; top: calc(20px + var(--safe-top)); right: 20px;
  width: 100px; height: 140px; border-radius: 16px;
  object-fit: cover; border: 2px solid rgba(255,255,255,0.2);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.call-ui {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: calc(30px + var(--safe-top)) 24px calc(40px + var(--safe-bottom));
  background: linear-gradient(to bottom, rgba(0,0,0,0.4) 0%, transparent 20%, transparent 80%, rgba(0,0,0,0.6) 100%);
  pointer-events: none;
}
.call-ui * { pointer-events: auto; }

.peer-info { text-align: center; }
.peer-name { font-size: 28px; font-weight: 800; margin-bottom: 4px; text-shadow: 0 2px 10px rgba(0,0,0,0.5); }
.call-status { font-size: 14px; opacity: 0.8; text-transform: uppercase; letter-spacing: 1px; }

.call-controls {
  display: flex; justify-content: center; gap: 20px;
}
.control-btn {
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.15); backdrop-filter: blur(10px);
  color: #fff; border: 1px solid rgba(255,255,255,0.1);
}
.control-btn svg { width: 24px; height: 24px; stroke-width: 2.2; }
.control-btn.active { background: #fff; color: #000; }
.control-btn.hangup { background: var(--danger); border: none; }

/* ══ TOAST ════════════════════════════════════════════ */
.toast {
  position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: var(--bg);
  padding: 12px 24px; border-radius: 100px; font-weight: 600;
  box-shadow: var(--shadow-lg); z-index: 2000;
}

/* ══ PROFILE ══════════════════════════════════════════ */
.profile-wrap { display: flex; flex-direction: column; align-items: center; padding-top: 40px; }
.p-avatar { width: 100px; height: 100px; border-radius: 50%; margin-bottom: 20px; border: 4px solid var(--accent-soft); }
.p-name { font-size: 24px; font-weight: 800; margin-bottom: 4px; }
.p-id-box {
  background: var(--surface-sub); padding: 12px 20px; border-radius: var(--r);
  display: flex; align-items: center; gap: 12px; margin-top: 20px;
}
.p-id { font-family: monospace; font-weight: 700; color: var(--tx-sub); }

/* ══ EMPTY STATE ══════════════════════════════════════ */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px 0; color: var(--tx-dim); text-align: center; }
.empty svg { width: 48px; height: 48px; margin-bottom: 16px; opacity: 0.3; }
