/* ============================================
   Second Brain — Stitch Design System
   Plus Jakarta Sans · Minimalist · #12100a
   ============================================ */

:root {
  --gold: #f4b925;
  --orange: #d7561f;
  --blue: #1980c2;
  --bg: #12100a;
  --surface: rgba(34, 29, 16, 0.6);
  --surface-solid: #1c1812;
  --border: rgba(244, 185, 37, 0.1);
  --border-hover: rgba(244, 185, 37, 0.2);
  --text: #e8e4dc;
  --text-2: rgba(232, 228, 220, 0.6);
  --text-3: rgba(232, 228, 220, 0.35);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xl: 16px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --nav-height: 72px;
}

/* Base */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { color-scheme: dark; -webkit-tap-highlight-color: transparent; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Plus Jakarta Sans', sans-serif;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Scrollbar */
.scrollbar-hide::-webkit-scrollbar { display: none; }
.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(244, 185, 37, 0.15); border-radius: 4px; }

/* ============================================
   Glass Effects
   ============================================ */
.glass {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.glass-dark {
  background: var(--surface);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
}

/* ============================================
   Header
   ============================================ */
.header-glass {
  background: rgba(18, 16, 10, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

/* ============================================
   Inputs & Selects
   ============================================ */
.input-field {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-family: inherit;
  font-size: 14px;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
  -webkit-appearance: none;
}

.input-field::placeholder { color: var(--text-3); }

.input-field:focus {
  outline: none;
  border-color: rgba(244, 185, 37, 0.4);
  box-shadow: 0 0 0 3px rgba(244, 185, 37, 0.08);
}

.search-input {
  background: rgba(244, 185, 37, 0.05);
  border: none;
  border-radius: var(--radius-xl);
  padding: 14px 16px 14px 44px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  width: 100%;
  transition: all 0.2s var(--ease);
  caret-color: var(--gold);
}

.search-input::placeholder { color: var(--text-3); }
.search-input:focus {
  outline: none;
  background: rgba(244, 185, 37, 0.08);
  box-shadow: 0 0 0 1px rgba(244, 185, 37, 0.2);
}

.select-field {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  border-radius: var(--radius);
  padding: 10px 36px 10px 14px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.2s var(--ease);
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='rgba(244,185,37,0.5)' viewBox='0 0 16 16'%3E%3Cpath d='M4.646 5.646a.5.5 0 0 1 .708 0L8 8.293l2.646-2.647a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.select-field:focus {
  outline: none;
  border-color: rgba(244, 185, 37, 0.3);
}

.form-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-3);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

/* ============================================
   Buttons
   ============================================ */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s var(--ease);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.icon-btn:active { transform: scale(0.95); }

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: var(--radius);
  background: var(--gold);
  color: #12100a;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.15s var(--ease);
}

.btn-primary:hover { background: #e5a817; }
.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: all 0.15s var(--ease);
}

.btn-secondary:hover { background: rgba(255, 255, 255, 0.08); }

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 18px;
  border-radius: var(--radius);
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid rgba(239, 68, 68, 0.15);
  cursor: pointer;
  transition: all 0.15s var(--ease);
}

.btn-danger:hover { background: rgba(239, 68, 68, 0.18); }

.btn-danger-solid {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 24px;
  border-radius: var(--radius);
  background: #ef4444;
  color: #ffffff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.15s var(--ease);
}

.btn-danger-solid:hover { background: #dc2626; }

/* ============================================
   Filter Chips / Tabs
   ============================================ */
.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(244, 185, 37, 0.15);
  background: rgba(244, 185, 37, 0.05);
  color: var(--text-2);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s var(--ease);
}

.tab-btn:hover {
  background: rgba(244, 185, 37, 0.1);
  border-color: rgba(244, 185, 37, 0.25);
}

.tab-btn.active {
  background: var(--gold);
  border-color: var(--gold);
  color: #12100a;
  font-weight: 700;
}

.tab-btn.active .tab-dot { background: #12100a !important; }

.tab-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ============================================
   Stats Dashboard
   ============================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

@media (min-width: 640px) {
  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }
}

.stat-card {
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  text-align: center;
  transition: border-color 0.2s var(--ease);
}

.stat-card:hover { border-color: var(--border-hover); }

.stat-number {
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
}

.stat-bar {
  height: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.06);
  margin-top: 10px;
  overflow: hidden;
}

.stat-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.6s var(--ease);
}

/* ============================================
   Idea Cards — glass-dark style
   ============================================ */
.idea-card {
  background: var(--surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  position: relative;
  overflow: hidden;
  animation: cardIn 0.3s var(--ease) backwards;
}

.idea-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  border-radius: 3px 0 0 3px;
}

.idea-card[data-category="molab-screens"]::before { background: var(--gold); }
.idea-card[data-category="molab-agencja"]::before { background: var(--orange); }
.idea-card[data-category="ekolan"]::before { background: #22c55e; }
.idea-card[data-category="openclaw"]::before { background: var(--blue); }
.idea-card[data-category="ogólne"]::before { background: #6b7280; }

.idea-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.idea-card:active { transform: translateY(0); transform: scale(0.99); }

/* Priority indicator */
.priority-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.priority-dot.high { background: #ef4444; }
.priority-dot.medium { background: var(--gold); }
.priority-dot.low { background: #22c55e; }

/* Status badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.status-badge.idea { background: rgba(244,185,37,0.1); color: var(--gold); border: 1px solid rgba(244,185,37,0.15); }
.status-badge.planned { background: rgba(25,128,194,0.1); color: var(--blue); border: 1px solid rgba(25,128,194,0.15); }
.status-badge.in_progress { background: rgba(215,86,31,0.1); color: var(--orange); border: 1px solid rgba(215,86,31,0.15); }
.status-badge.done { background: rgba(34,197,94,0.1); color: #22c55e; border: 1px solid rgba(34,197,94,0.15); }
.status-badge.rejected { background: rgba(239,68,68,0.1); color: #ef4444; border: 1px solid rgba(239,68,68,0.15); }

/* Category chip */
.category-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.category-chip[data-cat="molab-screens"] { background: rgba(244,185,37,0.08); color: var(--gold); }
.category-chip[data-cat="molab-agencja"] { background: rgba(215,86,31,0.08); color: var(--orange); }
.category-chip[data-cat="ekolan"] { background: rgba(34,197,94,0.08); color: #22c55e; }
.category-chip[data-cat="openclaw"] { background: rgba(25,128,194,0.08); color: var(--blue); }
.category-chip[data-cat="ogólne"] { background: rgba(255,255,255,0.05); color: var(--text-3); }

/* Tag chips */
.tag-chip {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 500;
  background: rgba(244, 185, 37, 0.05);
  color: var(--text-3);
  border: 1px solid rgba(244, 185, 37, 0.08);
}

/* Card actions */
.card-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s var(--ease);
}

.idea-card:hover .card-actions { opacity: 1; }

@media (hover: none) {
  .card-actions { opacity: 1; }
}

.card-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  transition: all 0.15s var(--ease);
}

.card-action-btn:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.card-action-btn.danger:hover { background: rgba(239,68,68,0.1); color: #ef4444; }

/* Stagger animation */
@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   Bottom Navigation Bar
   ============================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(18, 16, 10, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 16px;
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: none;
  border: none;
  color: rgba(232, 228, 220, 0.35);
  cursor: pointer;
  padding: 6px 12px;
  font-family: inherit;
  transition: color 0.15s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.nav-item:hover { color: var(--text-2); }
.nav-item.active { color: var(--gold); }
.nav-item .material-icons-round { font-size: 24px; }
.nav-item span:last-child { font-size: 10px; font-weight: 500; }

/* FAB in bottom nav */
.fab {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--gold);
  color: #12100a;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(244, 185, 37, 0.3);
  transition: all 0.2s var(--ease);
  margin-top: -20px;
}

.fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(244, 185, 37, 0.4);
}

.fab:active { transform: scale(0.95); }

/* ============================================
   Modal (Bottom Sheet on Mobile)
   ============================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: none;
}

.modal-overlay.open {
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

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

.modal-sheet {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
  animation: sheetUp 0.3s var(--ease);
}

.modal-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.12);
  margin: 0 auto 16px;
}

.confirm-sheet {
  position: relative;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 90%;
  max-width: 340px;
  padding: 28px 24px 24px;
  text-align: center;
  animation: confirmIn 0.25s var(--ease);
  margin: auto;
}

@media (min-width: 640px) {
  .modal-overlay.open {
    align-items: center;
  }

  .modal-sheet {
    border-radius: 20px;
    border-bottom: 1px solid var(--border);
    max-height: 85vh;
    animation: modalIn 0.25s var(--ease);
  }

  .modal-handle { display: none; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes sheetUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes confirmIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

/* ============================================
   Toast Notifications
   ============================================ */
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--surface-solid);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  pointer-events: auto;
  cursor: pointer;
  animation: toastIn 0.3s var(--ease);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.toast.success { border-left: 3px solid #22c55e; }
.toast.error { border-left: 3px solid #ef4444; }
.toast.info { border-left: 3px solid var(--blue); }

.toast.out { animation: toastOut 0.25s var(--ease) forwards; }

.toast-icon { font-size: 18px; flex-shrink: 0; }
.toast.success .toast-icon { color: #22c55e; }
.toast.error .toast-icon { color: #ef4444; }
.toast.info .toast-icon { color: var(--blue); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(-8px) scale(0.95); }
}

/* ============================================
   Skeleton Loading
   ============================================ */
.skeleton-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  height: 140px;
  position: relative;
  overflow: hidden;
}

.skeleton-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(244, 185, 37, 0.02) 50%,
    transparent 100%
  );
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ============================================
   Utility
   ============================================ */
.spin { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.text-gold { color: var(--gold) !important; }

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.custom-scrollbar::-webkit-scrollbar {
  width: 4px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(244, 185, 37, 0.15);
  border-radius: 4px;
}

/* ============================================
   Safe area (iOS)
   ============================================ */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .bottom-nav {
    height: calc(var(--nav-height) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
  }
  .modal-sheet {
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }
}

/* ============================================
   Responsive
   ============================================ */
@media (min-width: 640px) {
  .stat-number { font-size: 28px; }
}
