/* ===================================================
   TaskFlow — style.css
   Desenvolvido por Evandro Moresco · Oggi Sec
   =================================================== */

:root {
  /* Paleta — tema escuro (padrão) */
  --bg:        #0f1115;
  --surface:   #181b23;
  --surface-2: #20242f;
  --border:    #2b303d;
  --text:      #e7e9ee;
  --text-dim:  #8b92a6;

  --primary:    #6366f1;
  --primary-2:  #4f46e5;
  --primary-soft: rgba(99, 102, 241, 0.14);

  --amber: #f59e0b;
  --blue:  #3b82f6;
  --green: #22c55e;
  --red:   #ef4444;

  --radius:    10px;
  --radius-lg: 14px;
  --shadow:    0 8px 24px rgba(0,0,0,.28);

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg:        #f4f5f8;
  --surface:   #ffffff;
  --surface-2: #f0f1f5;
  --border:    #e2e5ec;
  --text:      #1b1e27;
  --text-dim:  #6b7280;

  --primary-soft: rgba(99, 102, 241, 0.10);

  --shadow: 0 8px 24px rgba(20,24,40,.08);

  color-scheme: light;
}

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

html, body {
  height: 100%;
}

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background .25s ease, color .25s ease;
}

/* ===================== THEME TOGGLE ===================== */

.theme-toggle {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color .2s, color .2s, background .2s;
}
.theme-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.theme-toggle svg {
  width: 18px;
  height: 18px;
}
.theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun  { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }

#themeToggleLogin {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 30;
}

/* ===================== LOGIN ===================== */

#loginScreen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow);
  text-align: center;
  animation: fadeUp .4s ease;
}

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

.login-logo {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -.02em;
  margin-bottom: 6px;
  color: var(--text);
}
.login-logo span { color: var(--primary); }

.login-sub {
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 24px;
}

.field {
  text-align: left;
  margin-bottom: 16px;
}
.field label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-weight: 600;
  letter-spacing: .02em;
}
.field input,
.field select {
  width: 100%;
  padding: 11px 13px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.field input:focus,
.field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.btn {
  width: 100%;
  padding: 11px 14px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .12s, opacity .15s, box-shadow .15s, background .15s, border-color .15s, color .15s;
  font-family: inherit;
}
.btn:active { transform: scale(.98); }
.btn-primary {
  background: var(--primary);
  color: #ffffff;
}
.btn-primary:hover { background: var(--primary-2); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--text-dim); }

.login-toggle {
  margin-top: 18px;
  font-size: 13px;
  color: var(--text-dim);
}
.login-toggle a {
  color: var(--primary);
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
}
.login-toggle a:hover { text-decoration: underline; }

.err {
  color: var(--red);
  font-size: 12px;
  margin-top: -8px;
  margin-bottom: 12px;
  min-height: 14px;
}

/* ===================== GOOGLE BUTTON ===================== */
.google-btn-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-dim);
  font-size: 12px;
  margin-bottom: 16px;
}
.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ===================== APP ===================== */

#appScreen { display: none; }

/* --- Topbar --- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 20;
  flex-wrap: wrap;
  gap: 12px;
}

.brand { font-weight: 800; font-size: 19px; letter-spacing: -.02em; }
.brand span { color: var(--primary); }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 6px 14px 6px 6px;
  border-radius: 999px;
  font-size: 13px;
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  font-size: 13px;
}

.avatar-img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

.logout-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  transition: .2s;
  font-family: inherit;
}
.logout-btn:hover { border-color: var(--red); color: var(--red); }

/* --- Date nav --- */
.date-nav {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 28px 0;
  flex-wrap: wrap;
}

.date-nav .nav-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: .15s;
}
.date-nav .nav-btn:hover { border-color: var(--primary); color: var(--primary); }

.date-label {
  font-size: 17px;
  font-weight: 700;
  text-transform: capitalize;
}
.date-label small {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 400;
  text-transform: none;
}

.today-btn {
  margin-left: auto;
  background: none;
  border: 1px solid var(--primary);
  color: var(--primary);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: .15s;
  font-family: inherit;
}
.today-btn:hover { background: var(--primary-soft); }

/* --- Carry-over banner --- */
.carry-banner {
  margin: 14px 28px 0;
  background: var(--primary-soft);
  border: 1px solid var(--primary);
  color: var(--text);
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.carry-banner button {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.carry-banner button:hover { background: var(--primary-2); }

/* --- Add task bar --- */
.add-task-bar {
  display: flex;
  gap: 10px;
  margin: 18px 28px 0;
  flex-wrap: wrap;
}
.add-task-bar input[type=text] {
  flex: 1;
  min-width: 180px;
  padding: 11px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  outline: none;
  font-family: inherit;
}
.add-task-bar input:focus { border-color: var(--primary); }
.add-task-bar select {
  padding: 11px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}
.add-task-bar .add-btn {
  padding: 11px 22px;
  border-radius: var(--radius);
  border: none;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  transition: background .15s;
}
.add-task-bar .add-btn:hover { background: var(--primary-2); }

/* --- Board / Kanban --- */
.board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  padding: 18px 28px 40px;
}

@media (max-width: 900px) {
  .board { grid-template-columns: 1fr; }
}

.column {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  transition: border-color .15s, background .15s;
}
.column.dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 0 4px;
}

.column-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 8px;
}

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.todo  { background: var(--amber); }
.dot.doing { background: var(--blue); }
.dot.done  { background: var(--green); }

.count {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 600;
}

.cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 60px;
}

/* --- Cards --- */
.card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 12px 10px;
  cursor: grab;
  transition: border-color .15s, box-shadow .15s, opacity .15s;
  position: relative;
}
.card:hover  { border-color: var(--primary); box-shadow: var(--shadow); }
.card.dragging { opacity: .4; }
.card.carried  { border-left: 3px solid var(--amber); }

.card-text {
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
  cursor: pointer;
}
.card.done .card-text { text-decoration: line-through; color: var(--text-dim); }

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.tag.from-prev      { background: rgba(245,158,11,.14); color: var(--amber); }
.tag.priority-alta  { background: rgba(239,68,68,.14);  color: var(--red); }
.tag.priority-media { background: rgba(245,158,11,.14); color: var(--amber); }
.tag.priority-baixa { background: rgba(34,197,94,.14);  color: var(--green); }

.card-actions { display: flex; gap: 4px; }

.icon-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 13px;
  padding: 3px 6px;
  border-radius: 6px;
  transition: .15s;
  font-family: inherit;
}
.icon-btn:hover      { color: var(--primary); background: var(--primary-soft); }
.icon-btn.del:hover  { color: var(--red); background: rgba(239,68,68,.1); }

.card-timestamps {
  font-size: 10.5px;
  color: var(--text-dim);
  margin-top: 6px;
  line-height: 1.5;
}

.empty-hint {
  color: var(--text-dim);
  font-size: 12px;
  text-align: center;
  padding: 20px 8px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* ===================== MODAL ===================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
  animation: fadeUp .25s ease;
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 18px;
}

.modal-dates {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 12px;
}
.modal-date-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  color: var(--text);
}
.modal-date-label { color: var(--text-dim); }

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}
.modal-actions .btn { width: auto; flex: 1; }

/* ===================== FOOTER ===================== */

.footer {
  border-top: 1px solid var(--border);
  padding: 28px 28px 32px;
  margin-top: 8px;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.footer-brand {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -.02em;
  color: var(--text-dim);
}
.footer-brand span { color: var(--primary); }

.footer-desc {
  font-size: 13px;
  color: var(--text-dim);
}
.footer-desc a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: opacity .15s;
}
.footer-desc a:hover { opacity: .75; }

.footer-copy {
  font-size: 11px;
  color: var(--text-dim);
  opacity: .6;
}

/* ===================== ICON ACTION BUTTON (Dashboard) ===================== */

.icon-action-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0 14px;
  height: 38px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  transition: border-color .15s, color .15s;
}
.icon-action-btn:hover { border-color: var(--primary); color: var(--primary); }
.icon-action-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
@media (max-width: 640px) {
  .icon-action-label { display: none; }
  .icon-action-btn { padding: 0; width: 38px; justify-content: center; }
}

/* Date label as clickable button (opens calendar) */
.date-label-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  padding: 4px 8px;
  border-radius: var(--radius);
  transition: background .15s;
}
.date-label-btn:hover { background: var(--surface-2); }
.date-label-btn #dateLabel {
  font-size: 17px;
  font-weight: 700;
  text-transform: capitalize;
  color: var(--text);
}
.date-label-btn small {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 400;
}

/* User pill clickable for profile (logout button stays separately clickable) */
.user-pill { cursor: pointer; }
.user-pill .logout-btn { cursor: pointer; }

/* ===================== CALENDAR MODAL ===================== */

.modal-calendar { max-width: 360px; }

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.calendar-month-label {
  margin-bottom: 0;
  text-transform: capitalize;
  font-size: 15px;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 700;
  margin-bottom: 6px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 18px;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text);
  position: relative;
  font-family: inherit;
  transition: background .15s, border-color .15s;
}
.calendar-day:hover { background: var(--surface-2); }
.calendar-day.empty { cursor: default; visibility: hidden; }
.calendar-day.today { border-color: var(--primary); font-weight: 700; }
.calendar-day.selected { background: var(--primary); color: #fff; }
.calendar-day.has-tasks::after {
  content: '';
  position: absolute;
  bottom: 4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--primary);
}
.calendar-day.selected.has-tasks::after { background: #fff; }

/* ===================== DASHBOARD MODAL ===================== */

.modal-dashboard {
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.dashboard-header .modal-title { margin-bottom: 0; }

.dashboard-filters {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.dashboard-filters .field { margin-bottom: 0; }
@media (max-width: 520px) {
  .dashboard-filters { grid-template-columns: 1fr; }
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
@media (max-width: 520px) {
  .dashboard-stats { grid-template-columns: repeat(2, 1fr); }
}

.stat-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.stat-value { font-size: 22px; font-weight: 800; color: var(--text); }
.stat-label { font-size: 11px; color: var(--text-dim); text-align: center; }
.stat-card.stat-done  .stat-value { color: var(--green); }
.stat-card.stat-doing .stat-value { color: var(--blue); }
.stat-card.stat-todo  .stat-value { color: var(--amber); }

.dashboard-progress { margin-bottom: 20px; }
.progress-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.progress-bar-track {
  height: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--green);
  border-radius: 999px;
  transition: width .3s ease;
}

.dashboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}
.dashboard-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 13px;
}
.dashboard-list-item-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dashboard-list-item-date {
  font-size: 11px;
  color: var(--text-dim);
  flex-shrink: 0;
}
.dashboard-empty {
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  padding: 20px;
}

/* ===================== PROFILE MODAL ===================== */

.profile-avatar-preview {
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
}
.avatar-lg, .avatar-img-lg {
  width: 72px;
  height: 72px;
  border-radius: 50%;
}
.avatar-lg {
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
}
.avatar-img-lg { object-fit: cover; }

.modal-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 18px 0;
}

.profile-section-label {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 12px;
}

.success-msg {
  color: var(--green);
  font-size: 12px;
  margin-top: -8px;
  margin-bottom: 12px;
  min-height: 14px;
}

.field input:disabled {
  opacity: .6;
  cursor: not-allowed;
}

/* ===================== SCROLLBAR ===================== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
