/* ============================================================
   Portal Icono — main.css
   Reset, variáveis, componentes globais
   ============================================================ */

:root {
  --bg:          #0f172a;
  --bg2:         #1e293b;
  --bg3:         #334155;
  --border:      #334155;
  --text:        #e2e8f0;
  --text-muted:  #94a3b8;
  --primary:     #6366f1;
  --primary-d:   #4f46e5;
  --danger:      #ef4444;
  --success:     #22c55e;
  --warn:        #f59e0b;
  --radius:      8px;
  --radius-sm:   5px;
  --shadow:      0 4px 24px rgba(0,0,0,.4);
  --nav-h:       52px;
}

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

html { font-size: 16px; }

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- NAVBAR ---- */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(15,23,42,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  z-index: 100;
  gap: 1rem;
}

.nav-brand {
  display: flex; align-items: center; gap: .6rem; flex-shrink: 0;
}
.nav-logo-wrap {
  display: flex; align-items: center;
  text-decoration: none; flex-shrink: 0;
}
.nav-logo-wrap:hover { text-decoration: none; opacity: .85; }
.nav-logo-img { height: 18px; width: auto; display: block; }
.nav-logo-sep {
  width: 1px; height: 18px; background: var(--border); flex-shrink: 0;
}
.nav-logo-tag {
  font-size: .68rem; color: var(--text); line-height: 1.3;
  white-space: nowrap; font-weight: 400; pointer-events: none;
}
@media (max-width: 860px) { .nav-logo-sep, .nav-logo-tag { display: none; } }

.nav-left { display: flex; align-items: center; gap: .75rem; overflow: hidden; }

.btn-appearance {
  background: none; border: none; cursor: pointer; color: var(--text-muted);
  padding: .3rem; border-radius: var(--radius-sm); font-size: 1rem;
  display: flex; align-items: center; transition: color .15s, background .15s;
}
.btn-appearance:hover { color: var(--text); background: var(--bg3); }

.nav-actions { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; position: relative; }

.nav-user {
  display: flex; align-items: center; gap: .5rem;
  cursor: pointer; padding: .25rem .5rem; border-radius: var(--radius-sm);
}
.nav-user:hover { background: var(--bg3); }

.nav-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); min-width: 160px;
  box-shadow: var(--shadow); display: none; z-index: 200;
  overflow: hidden;
}
.nav-dropdown.open { display: block; }
.nav-dropdown a {
  display: block; padding: .6rem 1rem; font-size: .9rem; color: var(--text);
  border-bottom: 1px solid var(--border);
}
.nav-dropdown a:last-child { border-bottom: none; }
.nav-dropdown a:hover { background: var(--bg3); text-decoration: none; }
.nav-dropdown a.danger { color: var(--danger); }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .5rem 1rem; border: none; border-radius: var(--radius-sm);
  font-size: .9rem; font-weight: 500; cursor: pointer;
  transition: background .15s, opacity .15s; white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); }
.btn-ghost    { background: rgba(255,255,255,.08); color: var(--text); }
.btn-ghost:hover { background: rgba(255,255,255,.14); }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-sm       { padding: .35rem .75rem; font-size: .82rem; }
.btn-xs       { padding: .2rem .5rem; font-size: .78rem; }
.btn-block    { width: 100%; display: flex; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block; font-size: .82rem; color: var(--text-muted);
  margin-bottom: .35rem; font-weight: 500;
}
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=datetime-local], textarea, select {
  width: 100%; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .55rem .75rem; color: var(--text); font-size: .92rem;
  font-family: inherit; transition: border-color .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(99,102,241,.2);
}
select { appearance: none; cursor: pointer; }
textarea { resize: vertical; min-height: 80px; }

.checkbox-label {
  display: flex; align-items: center; gap: .5rem;
  padding: .35rem 0; cursor: pointer; font-size: .9rem;
}
.checkbox-label input { width: auto; }

/* ---- MODALS ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
  z-index: 300; padding: 1rem;
}
.modal-overlay.open { display: flex; }

.modal-box {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); width: 100%; max-width: 480px;
  box-shadow: var(--shadow); max-height: 90vh; overflow-y: auto;
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1rem; }
.modal-close {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 1.1rem; padding: .2rem .4rem; border-radius: 4px;
}
.modal-close:hover { background: var(--bg3); }

.modal-box form, .modal-box > div:not(.modal-header):not(.modal-footer) { padding: 1rem 1.25rem; }
.modal-footer {
  padding: .75rem 1.25rem; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: flex-end; gap: .5rem;
}

/* ---- ALERTS ---- */
.alert { padding: .75rem 1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: .9rem; }
.alert-ok    { background: #14532d; border: 1px solid #166534; color: #bbf7d0; }
.alert-error { background: #450a0a; border: 1px solid #7f1d1d; color: #fca5a5; }

/* ---- AVATARS ---- */
.avatar-sm {
  width: 32px; height: 32px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-size: .7rem;
  font-weight: 700; color: #fff; flex-shrink: 0;
}
.avatar-xs {
  width: 24px; height: 24px; border-radius: 50%; display: flex;
  align-items: center; justify-content: center; font-size: .6rem;
  font-weight: 700; color: #fff; flex-shrink: 0;
}
.avatar-more { background: var(--bg3); color: var(--text-muted); font-size: .65rem; }

/* ---- BADGES ---- */
.badge {
  display: inline-flex; align-items: center; gap: .2rem;
  font-size: .72rem; padding: .15rem .4rem;
  background: var(--bg3); border-radius: 4px; color: var(--text-muted);
}
.badge-done { background: rgba(34,197,94,.15); color: var(--success); }
.badge-due.due-overdue { background: rgba(239,68,68,.2); color: #f87171; }
.badge-due.due-soon    { background: rgba(245,158,11,.2); color: #fcd34d; }

/* ---- ADVANCED COLOR PICKER ---- */
.acp { margin-bottom: .5rem; }
.acp-section-label {
  font-size: .7rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted); margin: .65rem 0 .35rem;
}
.acp-section-label:first-child { margin-top: 0; }
.acp-grid { display: flex; flex-wrap: wrap; gap: .35rem; }
.acp-swatch {
  width: 30px; height: 30px; border-radius: 6px; cursor: pointer; flex-shrink: 0;
  border: 2px solid transparent; transition: transform .12s, border-color .12s;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.07);
}
.acp-swatch:hover { transform: scale(1.12); }
.acp-swatch.acp-sel {
  border-color: #fff; box-shadow: 0 0 0 1px rgba(255,255,255,.4), inset 0 0 0 1px rgba(255,255,255,.07);
}
.acp-custom { display: flex; align-items: center; gap: .6rem; margin-top: .35rem; }
.acp-color-input {
  width: 38px; height: 30px; padding: 1px 2px; border-radius: 6px;
  cursor: pointer; border: 1px solid var(--border); background: var(--bg); flex-shrink: 0;
}
.acp-color-label { font-size: .82rem; color: var(--text-muted); cursor: pointer; }
.acp-preview {
  margin-top: .75rem; height: 40px; border-radius: var(--radius-sm);
  border: 1px solid rgba(255,255,255,.1); display: flex; align-items: center;
  justify-content: center; font-size: .72rem; color: rgba(255,255,255,.7);
  text-shadow: 0 1px 3px rgba(0,0,0,.8); transition: background .2s; font-weight: 500;
}

/* Workspace background switcher */
.ws-bg-picker { display: flex; flex-wrap: wrap; gap: .4rem; padding: .6rem .85rem .75rem; }
.ws-bg-swatch {
  width: 26px; height: 26px; border-radius: 5px; cursor: pointer;
  border: 2px solid transparent; transition: transform .12s, border-color .12s;
}
.ws-bg-swatch:hover { transform: scale(1.12); }
.ws-bg-swatch.acp-sel { border-color: #fff; }
.ws-bg-custom-row {
  padding: .25rem .85rem .75rem; display: flex; align-items: center; gap: .5rem;
  border-top: 1px solid var(--border);
}
.ws-bg-custom-row label { font-size: .82rem; color: var(--text-muted); cursor: pointer; }
.ws-bg-custom-row input[type=color] {
  width: 36px; height: 26px; padding: 1px 2px; border-radius: 5px;
  border: 1px solid var(--border); background: var(--bg); cursor: pointer;
}

/* ---- CARD BOX (generic container) ---- */
.card-box {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.5rem;
}

/* ---- POPOVER ---- */
.popover {
  position: fixed; z-index: 400;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  min-width: 200px; max-width: 280px; display: none;
}
.popover.open { display: block; }
.popover-header {
  padding: .6rem .85rem; border-bottom: 1px solid var(--border);
  font-size: .82rem; font-weight: 600; color: var(--text-muted);
  display: flex; justify-content: space-between; align-items: center;
}
.popover-body { padding: .6rem .85rem; }
.popover-item {
  display: flex; align-items: center; gap: .5rem;
  padding: .4rem .6rem; border-radius: 5px; cursor: pointer;
  font-size: .88rem; border: none; background: none; color: var(--text);
  width: 100%; text-align: left;
}
.popover-item:hover { background: var(--bg3); }
.popover-item.selected { background: rgba(99,102,241,.15); }
.popover-search {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: 5px; padding: .4rem .6rem; color: var(--text); font-size: .85rem;
  margin-bottom: .5rem;
}
.popover-search:focus { outline: none; border-color: var(--primary); }

/* ---- AUTH PAGE ---- */
.auth-page { background: var(--bg); display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.auth-container { width: 100%; max-width: 400px; padding: 1rem; }
.auth-box {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2rem; box-shadow: var(--shadow);
}
.auth-logo {
  font-size: 2rem; font-weight: 800; text-align: center;
  background: linear-gradient(135deg,#6366f1,#a855f7);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  margin-bottom: .5rem;
}
.auth-title { text-align: center; font-size: 1.1rem; margin-bottom: .25rem; }
.auth-sub { text-align: center; color: var(--text-muted); font-size: .85rem; margin-bottom: 1.5rem; }
.auth-form .btn-block { margin-top: 1.25rem; }
.auth-footer { text-align: center; margin-top: 1.5rem; color: var(--text-muted); font-size: .8rem; }

/* ---- DASHBOARD ---- */
.dashboard-main { padding: calc(var(--nav-h) + 1.5rem) 1.5rem 2rem; }
.dashboard-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem;
}
.dashboard-header h2 { font-size: 1.2rem; }

.boards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.board-card {
  height: 100px; border-radius: var(--radius); position: relative;
  overflow: hidden; cursor: pointer; text-decoration: none;
  transition: transform .15s, box-shadow .15s;
  border: 1px solid rgba(255,255,255,.05);
}
.board-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.5); text-decoration: none; }
.board-card::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to bottom, transparent 30%, rgba(0,0,0,.5));
}
.board-card-name {
  position: absolute; bottom: .6rem; left: .75rem; right: .75rem;
  color: #fff; font-weight: 600; font-size: .92rem;
  z-index: 1; text-shadow: 0 1px 3px rgba(0,0,0,.7);
}
.empty-state { color: var(--text-muted); font-size: .9rem; }

/* ---- BOARDS CHECKLIST ---- */
.boards-checklist {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: .5rem .75rem;
  max-height: 200px; overflow-y: auto;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 600px) {
  .boards-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .modal-box { max-width: 100%; margin: 0; border-radius: var(--radius) var(--radius) 0 0; }
  .modal-overlay { align-items: flex-end; }
}
