/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --font-display: 'Bebas Neue', sans-serif;
  --font-body: 'DM Sans', sans-serif;

  /* Dark theme */
  --bg: #0f0f0f;
  --bg-2: #1a1a1a;
  --bg-3: #252525;
  --surface: #1e1e1e;
  --surface-2: #2a2a2a;
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.15);
  --text: #f0f0f0;
  --text-2: #999;
  --text-3: #666;
  --accent: #ff3c3c;
  --accent-2: #ff6b35;
  --accent-glow: rgba(255,60,60,0.25);
  --shadow: rgba(0,0,0,0.5);
  --shadow-card: 0 2px 12px rgba(0,0,0,0.4);
  --radius: 16px;
  --radius-sm: 10px;
  --header-h: 60px;
  --tab-h: 52px;
}

body.light {
  --bg: #f5f4f0;
  --bg-2: #eeece8;
  --bg-3: #e5e3de;
  --surface: #ffffff;
  --surface-2: #f0eeea;
  --border: rgba(0,0,0,0.08);
  --border-strong: rgba(0,0,0,0.15);
  --text: #1a1a1a;
  --text-2: #666;
  --text-3: #999;
  --accent: #e02020;
  --accent-2: #e05a20;
  --accent-glow: rgba(224,32,32,0.15);
  --shadow: rgba(0,0,0,0.1);
  --shadow-card: 0 2px 12px rgba(0,0,0,0.08);
}

html { height: 100%; }

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

/* ===== SPLASH ===== */
#splash {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s, visibility 0.5s;
}
#splash.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.splash-inner { text-align: center; }

.splash-logo {
  font-family: var(--font-display);
  font-size: clamp(72px, 20vw, 128px);
  color: var(--accent);
  line-height: 1;
  letter-spacing: 4px;
  animation: pulse-glow 1.2s ease-in-out infinite alternate;
}

@keyframes pulse-glow {
  from { text-shadow: 0 0 20px var(--accent-glow); }
  to { text-shadow: 0 0 60px var(--accent-glow), 0 0 100px var(--accent-glow); }
}

.splash-loader {
  display: flex; gap: 8px; justify-content: center; margin-top: 32px;
}
.splash-loader span {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  animation: bounce 1s ease-in-out infinite;
}
.splash-loader span:nth-child(2) { animation-delay: 0.15s; }
.splash-loader span:nth-child(3) { animation-delay: 0.3s; }

@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40% { transform: translateY(-10px); opacity: 1; }
}

/* ===== AUTH ===== */
#auth-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: var(--bg);
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px 36px;
  text-align: center;
  width: 100%; max-width: 380px;
  box-shadow: var(--shadow-card);
}

.brand {
  font-family: var(--font-display);
  font-size: 72px;
  color: var(--accent);
  line-height: 1;
  letter-spacing: 4px;
}

.auth-tagline {
  color: var(--text-2);
  margin: 12px 0 36px;
  font-size: 14px;
  font-weight: 300;
  letter-spacing: 0.5px;
}

.btn-google {
  display: flex; align-items: center; gap: 12px; justify-content: center;
  width: 100%; padding: 14px 20px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-google:hover { background: var(--bg-3); transform: translateY(-1px); box-shadow: 0 4px 16px var(--shadow); }
.btn-google:active { transform: translateY(0); }

/* ===== HEADER ===== */
#app-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--header-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.app-brand {
  font-family: var(--font-display);
  font-size: 32px;
  color: var(--accent);
  letter-spacing: 3px;
  line-height: 1;
}

.header-actions {
  display: flex; align-items: center; gap: 8px;
}

.icon-btn {
  width: 40px; height: 40px;
  border-radius: 10px;
  border: none;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  position: relative;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  object-fit: cover;
  cursor: pointer;
}

.badge {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid var(--bg);
}

/* ===== TABS ===== */
#tab-nav {
  position: fixed; top: var(--header-h); left: 0; right: 0; z-index: 99;
  height: var(--tab-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex;
}

.tab-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
  border: none; background: transparent;
  color: var(--text-3);
  font-family: var(--font-body);
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  letter-spacing: 0.3px;
}
.tab-btn::after {
  content: '';
  position: absolute; bottom: 0; left: 20%; right: 20%; height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
  transform: scaleX(0);
  transition: transform 0.25s;
}
.tab-btn.active { color: var(--text); }
.tab-btn.active::after { transform: scaleX(1); }
.tab-btn:hover { color: var(--text-2); }

/* ===== BOARDS ===== */
#boards-container {
  position: fixed;
  top: calc(var(--header-h) + var(--tab-h));
  left: 0; right: 0; bottom: 0;
  overflow: hidden;
}

.board {
  position: absolute; inset: 0;
  overflow-y: auto; overflow-x: hidden;
  padding: 16px 16px 100px;
  scroll-behavior: smooth;
}
.board::-webkit-scrollbar { width: 4px; }
.board::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }

/* ===== CARDS ===== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: grab;
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
  position: relative;
  user-select: none;
  animation: card-in 0.3s ease both;
  min-height: 100px;
  display: flex; flex-direction: column; gap: 8px;
}
.card:hover { box-shadow: var(--shadow-card); border-color: var(--border-strong); }
.card.dragging { opacity: 0.4; cursor: grabbing; transform: scale(0.98); }
.card.drag-over { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }

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

.card-title {
  font-size: 14px; font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  word-break: break-word;
}
.card-body {
  font-size: 12px; color: var(--text-2); line-height: 1.5;
  flex: 1;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.card-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: auto;
}

.card-avatars {
  display: flex; gap: -4px;
}
.card-avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  object-fit: cover;
  margin-right: -6px;
}
.card-avatar:last-child { margin-right: 0; }

.card-done-tag {
  font-size: 10px; font-weight: 600; letter-spacing: 0.5px;
  color: #4ade80;
  background: rgba(74,222,128,0.12);
  border-radius: 6px; padding: 2px 7px;
}

.card-for-tag {
  font-size: 10px; font-weight: 600;
  color: var(--accent-2);
  background: rgba(255,107,53,0.12);
  border-radius: 6px; padding: 2px 7px;
}

.card-self-tag {
  font-size: 10px; font-weight: 500;
  color: var(--text-3);
  background: var(--bg-3);
  border-radius: 6px; padding: 2px 7px;
}

.card-shared-tag {
  font-size: 10px; font-weight: 500;
  color: #60a5fa;
  background: rgba(96,165,250,0.12);
  border-radius: 6px; padding: 2px 7px;
}

/* Task done state */
.card.done .card-title {
  text-decoration: line-through;
  color: var(--text-3);
}

/* Empty state */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 60px 24px; text-align: center; color: var(--text-3);
}
.empty-state svg { opacity: 0.3; }
.empty-state p { font-size: 14px; }

/* ===== FAB ===== */
.fab {
  position: fixed; bottom: 28px; right: 20px; z-index: 200;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--accent);
  border: none; color: white;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px var(--accent-glow);
  transition: transform 0.2s, box-shadow 0.2s;
}
.fab:hover { transform: scale(1.08); box-shadow: 0 6px 28px var(--accent-glow); }
.fab:active { transform: scale(0.96); }

/* ===== PANEL (Connections) ===== */
.panel {
  position: fixed; inset: 0; z-index: 500;
  display: flex; align-items: flex-end;
}
.panel.hidden { display: none; }

.panel-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  animation: fade-in 0.2s ease;
}

.panel-sheet {
  position: relative; z-index: 1;
  width: 100%; max-height: 80vh;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  border-top: 1px solid var(--border);
  padding: 0 0 32px;
  overflow-y: auto;
  animation: slide-up 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 20px 12px;
  border-bottom: 1px solid var(--border);
}
.panel-header h2 {
  font-family: var(--font-display);
  font-size: 26px; letter-spacing: 2px; color: var(--text);
}

#connection-content { padding: 20px; }

.panel-desc { color: var(--text-2); font-size: 14px; margin-bottom: 20px; }

.invite-section { display: flex; flex-direction: column; gap: 8px; }
.invite-section label { font-size: 12px; font-weight: 500; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.5px; }

.code-display {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 12px;
}
#my-invite-code {
  flex: 1; font-family: monospace; font-size: 16px; font-weight: 600;
  color: var(--accent); letter-spacing: 2px;
}

.btn-small {
  padding: 6px 14px; border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--text);
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: all 0.2s;
}
.btn-small:hover { background: var(--bg-3); }

.code-input-row {
  display: flex; gap: 8px;
}
#partner-code-input {
  flex: 1; padding: 12px 14px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text); font-size: 14px; font-family: var(--font-body);
  outline: none; transition: border-color 0.2s;
}
#partner-code-input:focus { border-color: var(--accent); }

.btn-primary-small {
  padding: 12px 18px; border-radius: var(--radius-sm);
  background: var(--accent); border: none; color: white;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn-primary-small:hover { opacity: 0.9; }

.user-info-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 16px;
}
.user-info-card img { width: 44px; height: 44px; border-radius: 50%; }
.user-info-card .uic-name { font-weight: 500; font-size: 15px; }
.user-info-card .uic-email { font-size: 12px; color: var(--text-2); }

.btn-row { display: flex; gap: 10px; }
.btn-accept {
  flex: 1; padding: 12px;
  background: #4ade80; border: none; border-radius: var(--radius-sm);
  color: #0a0a0a; font-weight: 600; font-size: 14px; cursor: pointer;
  transition: opacity 0.2s;
}
.btn-accept:hover { opacity: 0.85; }
.btn-decline {
  flex: 1; padding: 12px;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text); font-weight: 500; font-size: 14px; cursor: pointer;
  transition: all 0.2s;
}
.btn-decline:hover { background: var(--bg-3); }
.btn-danger {
  width: 100%; padding: 12px;
  background: transparent; border: 1px solid rgba(255,60,60,0.4);
  border-radius: var(--radius-sm);
  color: var(--accent); font-weight: 500; font-size: 14px; cursor: pointer;
  transition: all 0.2s;
}
.btn-danger:hover { background: rgba(255,60,60,0.08); }

/* ===== MODAL ===== */
.modal {
  position: fixed; inset: 0; z-index: 600;
  display: flex; align-items: flex-end;
}
.modal.hidden { display: none; }

.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  animation: fade-in 0.2s ease;
}

.modal-sheet {
  position: relative; z-index: 1;
  width: 100%; max-height: 90vh;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column;
  animation: slide-up 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 20px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h2 {
  font-family: var(--font-display);
  font-size: 26px; letter-spacing: 2px; color: var(--text);
}

.modal-body {
  padding: 20px;
  overflow-y: auto; flex: 1;
  display: flex; flex-direction: column; gap: 14px;
}

#item-title-input {
  width: 100%; padding: 14px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text); font-size: 16px; font-weight: 500; font-family: var(--font-body);
  outline: none; transition: border-color 0.2s;
}
#item-title-input:focus { border-color: var(--accent); }

#item-body-input {
  width: 100%; padding: 14px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text); font-size: 14px; font-family: var(--font-body);
  outline: none; resize: vertical; min-height: 80px;
  transition: border-color 0.2s; line-height: 1.6;
}
#item-body-input:focus { border-color: var(--accent); }

.modal-extras { display: flex; flex-direction: column; gap: 10px; }

.checkbox-label {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; font-size: 14px; color: var(--text-2);
}
.checkbox-label input { accent-color: var(--accent); width: 16px; height: 16px; }

.share-section {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
}
.share-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
  font-size: 13px; font-weight: 500; color: var(--text-2);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.user-chip {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-2);
}
.user-chip img { width: 20px; height: 20px; border-radius: 50%; }

.share-options { display: flex; flex-direction: column; gap: 10px; }
.radio-label {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; font-size: 14px; color: var(--text);
}
.radio-label input { accent-color: var(--accent); }

.modal-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.btn-primary {
  padding: 13px 28px;
  background: var(--accent); border: none; border-radius: var(--radius-sm);
  color: white; font-weight: 600; font-size: 15px; font-family: var(--font-body);
  cursor: pointer; transition: all 0.2s;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-danger-sm {
  padding: 10px 18px;
  background: transparent; border: 1px solid rgba(255,60,60,0.35);
  border-radius: var(--radius-sm);
  color: var(--accent); font-size: 14px; font-weight: 500; cursor: pointer;
  transition: all 0.2s;
}
.btn-danger-sm:hover { background: rgba(255,60,60,0.08); }

/* ===== TOAST ===== */
.toast {
  position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 100px;
  padding: 10px 20px;
  font-size: 13px; color: var(--text);
  z-index: 9999;
  white-space: nowrap;
  box-shadow: 0 4px 20px var(--shadow);
  animation: toast-in 0.3s ease;
  transition: opacity 0.3s;
}
.toast.hidden { display: none; }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ===== UTILS ===== */
.hidden { display: none !important; }
.screen { min-height: 100vh; }

/* ===== SECTION LABELS ===== */
.section-label {
  font-size: 11px; font-weight: 600; letter-spacing: 1px;
  text-transform: uppercase; color: var(--text-3);
  padding: 16px 0 8px;
}

/* ===== RESPONSIVE ===== */
@media (min-width: 600px) {
  .cards-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .panel-sheet, .modal-sheet { max-width: 480px; margin: auto; border-radius: 24px; }
  .panel, .modal { align-items: center; }
}

/* ===== VERSION LABEL ===== */
.brand-wrap {
  display: flex; align-items: baseline; gap: 6px;
}
.app-version {
  font-size: 10px; font-weight: 600; letter-spacing: 1px;
  color: var(--accent);
  opacity: 0.7;
  font-family: var(--font-body);
  text-transform: uppercase;
}

/* ===== NOTIF BADGE (numeric) ===== */
.notif-badge-count {
  min-width: 16px; height: 16px;
  border-radius: 8px;
  font-size: 9px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  padding: 0 3px;
}

/* ===== NOTIFICATION PANEL ===== */
.notif-list {
  padding: 12px 16px 32px;
  display: flex; flex-direction: column; gap: 4px;
}

.notif-empty {
  text-align: center; color: var(--text-3);
  font-size: 14px; padding: 32px 0;
}

.notif-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread {
  background: var(--bg-3);
  border-left: 3px solid var(--accent);
  padding-left: 9px;
}

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

.notif-body {
  flex: 1; display: flex; flex-direction: column; gap: 3px;
}
.notif-text {
  font-size: 13px; line-height: 1.5; color: var(--text);
}
.notif-time {
  font-size: 11px; color: var(--text-3);
}
