/* ─── FUDER GLOBAL CSS ─────────────────────────── */
:root {
  --orange: #FF6B00;
  --orange-dark: #E05500;
  --orange-light: #FF8C33;
  --orange-bg: #FFF3EB;
  --black: #0A0A0A;
  --dark: #111111;
  --dark2: #1A1A1A;
  --dark3: #222222;
  --gray: #888888;
  --gray-light: #BBBBBB;
  --border: rgba(255,255,255,0.08);
  --border-light: rgba(0,0,0,0.08);
  --white: #FFFFFF;
  --surface: #161616;
  --surface2: #1E1E1E;
  --success: #22C55E;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --nav-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 16px);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
  background: var(--dark);
  color: var(--white);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* ─── TYPOGRAPHY ────────────────────────────────── */
h1 { font-size: clamp(28px, 7vw, 48px); font-weight: 700; line-height: 1.1; }
h2 { font-size: clamp(20px, 5vw, 32px); font-weight: 700; line-height: 1.2; }
h3 { font-size: 18px; font-weight: 600; }
h4 { font-size: 15px; font-weight: 600; }
p { color: var(--gray-light); }

/* ─── BUTTONS ───────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 24px; border-radius: var(--radius); font-size: 15px; font-weight: 600;
  transition: all 0.15s ease; white-space: nowrap; line-height: 1;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: var(--orange-dark); }
.btn-secondary { background: var(--surface2); color: var(--white); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--dark3); }
.btn-outline { background: transparent; color: var(--white); border: 1px solid rgba(255,255,255,0.2); }
.btn-outline:hover { background: rgba(255,255,255,0.05); }
.btn-lg { padding: 16px 32px; font-size: 16px; border-radius: var(--radius-lg); }
.btn-full { width: 100%; }
.btn-sm { padding: 10px 16px; font-size: 13px; border-radius: var(--radius-sm); }

/* ─── INPUTS ────────────────────────────────────── */
.input-group { display: flex; flex-direction: column; gap: 6px; }
.input-label { font-size: 13px; font-weight: 500; color: var(--gray-light); }
.input {
  width: 100%; padding: 14px 16px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); color: var(--white);
  font-size: 15px; transition: border-color 0.15s;
  -webkit-appearance: none;
}
.input:focus { outline: none; border-color: var(--orange); }
.input::placeholder { color: var(--gray); }

/* ─── CARDS ─────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px; overflow: hidden;
}
.card-dark { background: var(--dark2); }

/* ─── BADGE ─────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600;
}
.badge-orange { background: rgba(255,107,0,0.15); color: var(--orange); }
.badge-green { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-gray { background: rgba(255,255,255,0.08); color: var(--gray-light); }

/* ─── BOTTOM NAV ─────────────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: rgba(10,10,10,0.95); backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-around;
  padding: 8px 0 calc(8px + var(--safe-bottom));
  height: calc(var(--nav-h) + var(--safe-bottom));
}
.nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 12px; border-radius: var(--radius-sm); transition: all 0.15s;
  color: var(--gray); font-size: 10px; font-weight: 500; min-width: 48px;
}
.nav-item svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.nav-item.active { color: var(--orange); }
.nav-item.active svg { stroke: var(--orange); }
.nav-create {
  width: 52px; height: 52px; background: var(--orange);
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(255,107,0,0.4); margin-top: -20px;
}
.nav-create svg { width: 24px; height: 24px; stroke: white; fill: none; stroke-width: 2; }

/* ─── PAGE LAYOUT ────────────────────────────────── */
.page { padding: 0 16px calc(var(--nav-h) + var(--safe-bottom) + 16px); max-width: 480px; margin: 0 auto; }
.page-header { padding: 60px 0 20px; }
.section-title { font-size: 13px; font-weight: 600; color: var(--gray); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 12px; }

/* ─── KPI GRID ───────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kpi-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px; text-align: center;
}
.kpi-value { font-size: 22px; font-weight: 700; color: var(--white); }
.kpi-label { font-size: 10px; color: var(--gray); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }
.kpi-change { font-size: 11px; font-weight: 600; color: var(--success); margin-top: 4px; }

/* ─── PROJECT CARD ───────────────────────────────── */
.project-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.project-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; position: relative;
}
.project-thumb { width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--surface2); }
.project-thumb-placeholder {
  width: 100%; aspect-ratio: 1; background: var(--surface2);
  display: flex; align-items: center; justify-content: center; color: var(--gray); font-size: 32px;
}
.project-info { padding: 10px; }
.project-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-date { font-size: 11px; color: var(--gray); margin-top: 2px; }
.project-type-badge {
  position: absolute; top: 8px; right: 8px;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  border-radius: 6px; padding: 3px 7px; font-size: 10px; font-weight: 600; color: var(--gray-light);
}

/* ─── CREATE HUB GRID ────────────────────────────── */
.create-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.create-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 18px 16px;
  display: flex; flex-direction: column; gap: 10px;
  transition: all 0.15s;
}
.create-card:active { transform: scale(0.97); background: var(--surface2); }
.create-icon {
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  background: rgba(255,107,0,0.12); display: flex; align-items: center; justify-content: center;
}
.create-icon svg { width: 22px; height: 22px; stroke: var(--orange); fill: none; stroke-width: 1.8; }
.create-card h4 { font-size: 14px; font-weight: 600; }
.create-card p { font-size: 12px; color: var(--gray); line-height: 1.4; }

/* ─── FLASH MESSAGES ─────────────────────────────── */
.flash { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; font-weight: 500; }
.flash-error { background: rgba(239,68,68,0.15); color: #FCA5A5; border: 1px solid rgba(239,68,68,0.2); }
.flash-success { background: rgba(34,197,94,0.15); color: #86EFAC; border: 1px solid rgba(34,197,94,0.2); }

/* ─── LOADING ─────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px; border: 2px solid rgba(255,255,255,0.2);
  border-top-color: white; border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── MODAL ──────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.8); backdrop-filter: blur(4px);
  display: flex; align-items: flex-end;
}
.modal-sheet {
  width: 100%; background: var(--dark2); border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 24px 20px calc(24px + var(--safe-bottom)); max-height: 90vh; overflow-y: auto;
}
.modal-handle { width: 40px; height: 4px; background: var(--border); border-radius: 2px; margin: 0 auto 20px; }

/* ─── TABS ───────────────────────────────────────── */
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 8px 16px; border-radius: 20px; font-size: 13px; font-weight: 600;
  color: var(--gray); white-space: nowrap; transition: all 0.15s; border: 1px solid transparent;
}
.tab.active { background: var(--orange); color: white; }
.tab:not(.active):hover { color: var(--white); background: var(--surface); }

/* ─── TOGGLE ─────────────────────────────────────── */
.toggle { position: relative; width: 44px; height: 26px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; background: var(--surface2);
  border-radius: 13px; cursor: pointer; transition: 0.2s;
  border: 1px solid var(--border);
}
.toggle-slider::before {
  content: ''; position: absolute; width: 20px; height: 20px;
  background: var(--gray); border-radius: 50%; top: 2px; left: 2px; transition: 0.2s;
}
.toggle input:checked + .toggle-slider { background: rgba(255,107,0,0.2); border-color: var(--orange); }
.toggle input:checked + .toggle-slider::before { background: var(--orange); transform: translateX(18px); }

/* ─── UPLOAD AREA ────────────────────────────────── */
.upload-area {
  border: 2px dashed var(--border); border-radius: var(--radius-lg);
  padding: 40px 20px; text-align: center; cursor: pointer; transition: all 0.15s;
  background: var(--surface);
}
.upload-area:hover, .upload-area.drag-over { border-color: var(--orange); background: rgba(255,107,0,0.05); }
.upload-area p { font-size: 14px; color: var(--gray); margin-top: 8px; }

/* ─── SKELETON ───────────────────────────────────── */
.skeleton { background: linear-gradient(90deg, var(--surface) 25%, var(--surface2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ─── RESPONSIVE DESKTOP ─────────────────────────── */
@media (min-width: 768px) {
  .page { padding: 80px 24px 40px; max-width: 600px; }
  .bottom-nav { max-width: 480px; left: 50%; transform: translateX(-50%); border-radius: var(--radius-xl) var(--radius-xl) 0 0; }
}
