/* ============================================
   Base Styles
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-tertiary); border-radius: 2px; }

/* Hidden utility */
.hidden { display: none !important; }

/* Auth screen - full page, shown by default */
.auth-screen {
  display: flex;
  min-height: 100dvh;
}
.auth-screen.hidden { display: none !important; }

/* Screen layout - all screens hidden by default */
.screen {
  display: none;
  min-height: 100dvh;
  padding-top: var(--topbar-height);
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
}
.screen.active { display: block; }

.screen-content {
  padding: var(--space-md);
  max-width: 480px;
  margin: 0 auto;
}

/* Top Bar */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-height);
  background: rgba(10, 10, 14, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-md);
  z-index: var(--z-nav);
  border-bottom: 1px solid var(--border-color);
}

.app-logo {
  font-family: var(--font-display);
  font-size: 1.6rem;
  letter-spacing: 2px;
  color: var(--text-primary);
}

.accent { color: var(--accent); }

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-elevated);
  background-size: cover;
  background-position: center;
  border: 2px solid var(--border-color);
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

/* Dropdown */
.dropdown {
  position: fixed;
  top: calc(var(--topbar-height) + 4px);
  right: var(--space-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-elevated);
  z-index: var(--z-nav);
  overflow: hidden;
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 12px 20px;
  background: none;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}
.dropdown-item:hover { background: var(--bg-card-hover); }

/* Typography */
h2 {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.15rem;
}

h3 { font-weight: 700; font-size: 1rem; }

.screen-title-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.section-subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}

/* Links & Buttons */
a { color: var(--accent); text-decoration: none; }

.btn-back {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 6px 0;
}
.btn-back:active { color: var(--text-primary); }

.btn-text {
  background: none;
  border: none;
  color: var(--accent);
  font-family: var(--font-body);
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 500;
}

/* Forms */
.form-group {
  margin-bottom: var(--space-md);
}
.form-group label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}

.input-dark {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s;
}
.input-dark:focus {
  border-color: var(--accent);
}
.input-dark::placeholder {
  color: var(--text-muted);
}

select.input-dark {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='%239A9AAE'%3E%3Cpath d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

textarea.input-dark {
  resize: vertical;
  min-height: 48px;
}

/* Auth */
.auth-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 100dvh;
  padding: var(--space-xl);
  text-align: center;
}

.auth-icon {
  font-size: 4rem;
  margin-bottom: var(--space-md);
}

.auth-title {
  font-family: var(--font-display);
  font-size: 4rem;
  letter-spacing: 4px;
  line-height: 1;
  margin-bottom: var(--space-xs);
}

.auth-subtitle {
  font-family: var(--font-display);
  font-size: 1.4rem;
  letter-spacing: 6px;
  color: var(--text-secondary);
  margin-bottom: var(--space-2xl);
}

.btn-auth {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 28px;
  background: var(--text-primary);
  color: var(--bg-primary);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn-auth:active {
  transform: scale(0.97);
}

.auth-note {
  margin-top: var(--space-lg);
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

/* Bottom Nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(10, 10, 14, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: space-around;
  border-top: 1px solid var(--border-color);
  z-index: var(--z-nav);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  color: var(--text-tertiary);
  font-family: var(--font-body);
  font-size: 0.65rem;
  cursor: pointer;
  padding: 6px 12px;
  transition: color 0.2s;
  min-width: 48px;
  min-height: 44px;
}
.nav-item.active { color: var(--accent); }
.nav-item .nav-icon { font-size: 1.3rem; }

.nav-icon-record {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--accent);
  border-radius: 50%;
  font-size: 1.4rem !important;
  color: #fff !important;
  font-weight: 700;
  margin-top: -12px;
  box-shadow: 0 4px 16px var(--accent-glow);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-md);
  color: var(--text-tertiary);
  font-size: 0.9rem;
}
