/* public/assets/app.css */
/* Тъмна тема – Handyman App */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Токени ─────────────────────────────────────────────────────── */
:root {
  /* Фонове */
  --bg-base:    #0f1117;
  --bg-surface: #181c27;
  --bg-card:    #1e2333;
  --bg-input:   #252a3a;
  --bg-hover:   #2a3047;

  /* Акцент – наситено жълто-оранжево (работещ инструмент) */
  --accent:       #f59e0b;
  --accent-dark:  #d97706;
  --accent-light: #fcd34d;
  --accent-dim:   rgba(245,158,11,0.15);

  /* Статуси */
  --status-scheduled:  #60a5fa;
  --status-in-progress:#34d399;
  --status-paused:     #fb923c;
  --status-completed:  #a3a3a3;

  /* Текст */
  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #4b5563;

  /* Рамки */
  --border:       #2d3348;
  --border-focus: #f59e0b;

  /* Сенки */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.6);

  /* Радиуси */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  /* Анимация */
  --transition: 150ms ease;
}

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

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100dvh;
}

/* ── Типография ─────────────────────────────────────────────────── */
h1 { font-size: 1.5rem;  font-weight: 700; line-height: 1.2; }
h2 { font-size: 1.25rem; font-weight: 600; }
h3 { font-size: 1rem;    font-weight: 600; }

.mono { font-family: 'JetBrains Mono', monospace; }

/* ── Layout ─────────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent);
  text-decoration: none;
}

.topbar-logo svg { width: 24px; height: 24px; }

.main-content {
  flex: 1;
  padding: 1rem;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}

/* Таб навигация (долна лента на мобилно) */
.bottom-nav {
  position: sticky;
  bottom: 0;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 0.5rem 0 calc(0.5rem + env(safe-area-inset-bottom));
  z-index: 100;
}

.bottom-nav a, .bottom-nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.7rem;
  font-weight: 500;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem 1rem;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
}

.bottom-nav a.active, .bottom-nav button.active {
  color: var(--accent);
}

.bottom-nav svg { width: 22px; height: 22px; }

/* ── Карти ──────────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
}

.card + .card { margin-top: 0.75rem; }

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.card-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.card-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.card-meta-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.card-meta-item svg { width: 13px; height: 13px; opacity: 0.7; }

.card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

/* Клик върху цялата карта */
.card-clickable {
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.card-clickable:hover { border-color: var(--accent); background: var(--bg-hover); }

/* ── Статус бадж ────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.badge-scheduled  { background: rgba(96,165,250,0.15);  color: var(--status-scheduled); }
.badge-in_progress{ background: rgba(52,211,153,0.15);  color: var(--status-in-progress); }
.badge-paused     { background: rgba(251,146,60,0.15);  color: var(--status-paused); }
.badge-completed  { background: rgba(163,163,163,0.15); color: var(--status-completed); }
.badge-accent     { background: var(--accent-dim);      color: var(--accent); }

/* ── Бутони ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #0f1117;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-light); }

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg-hover); border-color: var(--accent); }

.btn-danger {
  background: rgba(239,68,68,0.15);
  color: #f87171;
  border: 1px solid rgba(239,68,68,0.3);
}
.btn-danger:hover:not(:disabled) { background: rgba(239,68,68,0.25); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover:not(:disabled) { color: var(--text-primary); background: var(--bg-hover); }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; width: 100%; }

.btn-start    { background: rgba(52,211,153,0.15); color: var(--status-in-progress); border: 1px solid rgba(52,211,153,0.3); }
.btn-start:hover:not(:disabled) { background: rgba(52,211,153,0.25); }

.btn-pause    { background: rgba(251,146,60,0.15); color: var(--status-paused); border: 1px solid rgba(251,146,60,0.3); }
.btn-pause:hover:not(:disabled) { background: rgba(251,146,60,0.25); }

.btn-complete { background: rgba(96,165,250,0.15); color: var(--status-scheduled); border: 1px solid rgba(96,165,250,0.3); }
.btn-complete:hover:not(:disabled) { background: rgba(96,165,250,0.25); }

/* ── Форми ──────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

.form-control {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  padding: 0.6rem 0.85rem;
  transition: border-color var(--transition);
  -webkit-appearance: none;
}

.form-control:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control { cursor: pointer; }

textarea.form-control { resize: vertical; min-height: 90px; }

.form-error {
  font-size: 0.78rem;
  color: #f87171;
  margin-top: 0.3rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

/* ── Таймер (активна работна сесия) ────────────────────────────── */
.timer-bar {
  background: rgba(52,211,153,0.1);
  border: 1px solid rgba(52,211,153,0.3);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.timer-display {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--status-in-progress);
  letter-spacing: 0.05em;
}

.timer-label {
  font-size: 0.75rem;
  color: var(--status-in-progress);
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Пулсиращ индикатор */
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

.pulse-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--status-in-progress);
  animation: pulse-dot 1.5s ease-in-out infinite;
  flex-shrink: 0;
}

/* ── Сметка (summary) ───────────────────────────────────────────── */
.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.summary-row:last-child { border-bottom: none; }

.summary-row.total {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  padding-top: 0.75rem;
}

.summary-label { color: var(--text-secondary); }
.summary-value { font-weight: 600; font-family: 'JetBrains Mono', monospace; }

/* ── Модален прозорец ───────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

@media (min-width: 640px) {
  .modal-backdrop {
    align-items: center;
    padding: 1rem;
  }
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 560px;
  max-height: 92dvh;
  overflow-y: auto;
  padding: 1.25rem;
  box-shadow: var(--shadow-lg);
}

@media (min-width: 640px) {
  .modal { border-radius: var(--radius-lg); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.modal-title { font-size: 1.1rem; font-weight: 700; }

/* ── Снимка карта ───────────────────────────────────────────────── */
.media-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.media-thumb {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  background: var(--bg-input);
  border: 1px solid var(--border);
}

.media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-thumb-del {
  position: absolute;
  top: 4px; right: 4px;
  background: rgba(0,0,0,0.7);
  border: none;
  border-radius: 50%;
  width: 22px; height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  opacity: 0;
  transition: opacity var(--transition);
}

.media-thumb:hover .media-thumb-del { opacity: 1; }

/* ── Upload зона ────────────────────────────────────────────────── */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.upload-area:hover, .upload-area.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}

.upload-area svg { width: 32px; height: 32px; margin-bottom: 0.5rem; opacity: 0.6; }

/* ── Разделител ─────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 1rem 0;
}

/* ── Helpers ────────────────────────────────────────────────────── */
.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.items-center{ align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2       { gap: 0.5rem; }
.gap-3       { gap: 0.75rem; }
.mt-1        { margin-top: 0.25rem; }
.mt-2        { margin-top: 0.5rem; }
.mt-3        { margin-top: 0.75rem; }
.mt-4        { margin-top: 1rem; }
.mb-1        { margin-bottom: 0.25rem; }
.mb-3        { margin-bottom: 0.75rem; }
.mb-4        { margin-bottom: 1rem; }
.text-sm     { font-size: 0.875rem; }
.text-xs     { font-size: 0.75rem; }
.text-muted  { color: var(--text-secondary); }
.text-accent { color: var(--accent); }
.text-right  { text-align: right; }
.w-full      { width: 100%; }
.hidden      { display: none !important; }

/* ── Празен екран ───────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
}

.empty-state svg {
  width: 48px; height: 48px;
  opacity: 0.3;
  margin-bottom: 1rem;
}

.empty-state p { font-size: 0.9rem; }

/* ── Toast нотификации ──────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: calc(72px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
  width: calc(100% - 2rem);
  max-width: 400px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: toast-in 0.2s ease;
}

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

.toast-success { border-left: 3px solid var(--status-in-progress); }
.toast-error   { border-left: 3px solid #f87171; }

/* ── Loader ─────────────────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  flex-shrink: 0;
}

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

.page-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
}

/* ── Login страница ─────────────────────────────────────────────── */
.auth-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: var(--bg-base);
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

.auth-logo {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-logo svg { width: 48px; height: 48px; color: var(--accent); }

.auth-logo h1 {
  margin-top: 0.5rem;
  font-size: 1.4rem;
  color: var(--text-primary);
}

.auth-logo p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}
