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

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0a0a0f;
  --bg-card: #14141f;
  --bg-input: #1a1a2e;
  --border: #2a2a3e;
  --accent: #c8a44e;
  --accent-glow: rgba(200, 164, 78, 0.25);
  --text: #f0ece4;
  --text-dim: #8a8698;
  --text-muted: #5a5670;
  --danger: #e74c5e;
  --success: #4eca8b;
  --radius: 14px;
  --radius-sm: 10px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tab-height: 72px;
  --font-display: 'Unbounded', sans-serif;
  --font-body: 'Inter Tight', sans-serif;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

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

/* ===== SCREENS ===== */

.screen {
  display: none;
  min-height: 100dvh;
}

.screen.active {
  display: flex;
}

/* ===== AUTH SCREEN ===== */

#screen-auth {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(200, 164, 78, 0.08) 0%, transparent 60%),
    var(--bg);
}

.auth-container {
  width: 100%;
  max-width: 380px;
  animation: fadeUp 0.6s ease-out;
}

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

.auth-logo {
  text-align: center;
  margin-bottom: 40px;
}

.logo-img {
  height: 40px;
  width: auto;
  filter: invert(1);
}

.auth-subtitle {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 300;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--accent);
  margin-top: 12px;
}

/* ===== FORM ===== */

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  position: relative;
}

.form-input {
  width: 100%;
  padding: 24px 16px 10px;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 400;
  color: var(--text);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s;
  -webkit-appearance: none;
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-label {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  color: var(--text-dim);
  pointer-events: none;
  transition: all 0.2s ease;
}

.form-input:focus + .form-label,
.form-input:not(:placeholder-shown) + .form-label {
  top: 7px;
  transform: translateY(0);
  font-size: 0.65rem;
  color: var(--accent);
  letter-spacing: 0.05em;
}

/* ===== BUTTONS ===== */

.btn-primary {
  position: relative;
  width: 100%;
  padding: 16px;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--bg);
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.25s;
  margin-top: 4px;
}

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

.btn-primary:disabled {
  opacity: 0.6;
  pointer-events: none;
}

.btn-primary.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn-primary.loading .btn-text { opacity: 0; }
.btn-primary.loading .btn-loader { display: block; }

.btn-loader {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ===== DIVIDER ===== */

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 16px;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-divider span {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.btn-link {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: var(--accent);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  padding: 8px;
  text-align: center;
  transition: opacity 0.2s;
}

.btn-link:active { opacity: 0.7; }

.auth-hint {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
  margin-bottom: 8px;
}

.login-form {
  margin-top: 8px;
}

/* ===== ERROR ===== */

.auth-error {
  margin-top: 16px;
  padding: 12px 16px;
  background: rgba(231, 76, 94, 0.1);
  border: 1px solid rgba(231, 76, 94, 0.3);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--danger);
  text-align: center;
}

/* ===== HIDDEN ===== */

.hidden {
  display: none !important;
}

/* ===== LANDING SCREEN ===== */

#screen-landing {
  flex-direction: column;
  min-height: 100dvh;
  background:
    radial-gradient(ellipse at 30% 0%, rgba(200, 164, 78, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 100%, rgba(200, 164, 78, 0.04) 0%, transparent 50%),
    var(--bg);
}

.landing-header {
  text-align: center;
  padding: 24px 20px 8px;
  flex-shrink: 0;
}

.landing-logo {
  height: 28px;
  width: auto;
  filter: invert(1);
}

.landing-greeting {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 8px;
}

/* ===== TAB CONTENT ===== */

.landing-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 20px calc(var(--tab-height) + var(--safe-bottom) + 16px);
}

.tab-pane {
  display: none;
  animation: tabIn 0.35s ease-out;
}

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

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

/* ===== SECTION CONTENT ===== */

.section-hero {
  text-align: center;
  padding: 24px 0 20px;
}

.section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(200, 164, 78, 0.15), rgba(200, 164, 78, 0.05));
  border: 1px solid rgba(200, 164, 78, 0.2);
  margin-bottom: 16px;
}

.section-icon svg {
  width: 26px;
  height: 26px;
  color: var(--accent);
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.section-desc {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-dim);
  max-width: 340px;
  margin: 0 auto;
}

/* ===== FILES ===== */

.files-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.file-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s, transform 0.15s, background 0.2s;
}

.file-card:active {
  transform: scale(0.98);
  background: var(--bg-input);
  border-color: var(--accent);
}

.file-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(200, 164, 78, 0.1);
  border-radius: 10px;
}

.file-icon svg {
  width: 20px;
  height: 20px;
  color: var(--accent);
}

.file-info {
  flex: 1;
  min-width: 0;
}

.file-name {
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ===== TAB BAR ===== */

.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  height: var(--tab-height);
  padding-bottom: var(--safe-bottom);
  background: rgba(14, 14, 20, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  z-index: 100;
}

.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.25s;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.tab-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 32px;
  height: 2px;
  background: var(--accent);
  border-radius: 0 0 2px 2px;
  transition: transform 0.3s ease;
}

.tab-item.active {
  color: var(--accent);
}

.tab-item.active::before {
  transform: translateX(-50%) scaleX(1);
}

.tab-icon {
  width: 22px;
  height: 22px;
}

.tab-label {
  font-family: var(--font-body);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ===== DESKTOP (на случай если откроют на десктопе) ===== */

@media (min-width: 600px) {
  .auth-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 48px 40px;
  }

  #screen-landing {
    max-width: 480px;
    margin: 0 auto;
    position: relative;
  }

  .tab-bar {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 16px 16px 0 0;
  }
}

/* ===== UTILITY ANIMATIONS ===== */

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-input) 25%, var(--border) 50%, var(--bg-input) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
