/* ============================================
   SISTEMA FOTOGRAFIA — CSS
   ============================================ */

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

:root {
  --bg:        #f5f4f2;
  --surface:   #ffffff;
  --border:    #e4e2de;
  --text:      #1a1a1a;
  --text-muted:#7a7774;
  --primary:   #1a1a1a;
  --primary-h: #333333;
  --accent:    #c8a97e;
  --accent-h:  #b8956a;

  --status-ag:  #d4edff;
  --status-ag-t:#0066b3;
  --status-re:  #fff4d4;
  --status-re-t:#a06000;
  --status-en:  #d4f5e4;
  --status-en-t:#007a3d;

  --kanban-ag:  #0066b3;
  --kanban-re:  #a06000;
  --kanban-en:  #007a3d;

  --radius:    10px;
  --radius-sm: 6px;
  --shadow:    0 1px 4px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
  --transition: 0.15s ease;
}

html { font-size: 15px; }

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

/* --- LOGIN --- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}

.login-wrapper {
  width: 100%;
  max-width: 380px;
  padding: 1.5rem;
}

.login-brand {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo {
  margin-bottom: 1rem;
  display: flex;
  justify-content: center;
}

.login-title {
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.login-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
}

/* --- TOPBAR --- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: 54px;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1.5rem;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

.topbar-nav {
  display: flex;
  gap: 0.25rem;
  flex: 1;
}

.nav-link {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.nav-link:hover { background: var(--bg); color: var(--text); }
.nav-link.active { background: var(--bg); color: var(--text); font-weight: 500; }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.user-email {
  font-size: 0.8rem;
  color: var(--text-muted);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- CONTAINER --- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* --- CARDS --- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 1.25rem;
  color: var(--text);
}

/* --- BUTTONS --- */
.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: 500;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-h); }

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

.btn-danger {
  background: transparent;
  color: #cc3333;
  border: 1px solid #f5cccc;
}
.btn-danger:hover { background: #fff5f5; }

.btn-sm { padding: 0.3rem 0.7rem; font-size: 0.8rem; }
.btn-block { width: 100%; }

/* --- FORMS --- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input, select, textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: var(--transition);
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(200,169,126,.15);
}

textarea { resize: vertical; }

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

.form-grid .full { grid-column: 1 / -1; }

.form-card { margin-bottom: 1.5rem; }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

/* --- ALERTS --- */
.alert {
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.alert-error { background: #fff5f5; color: #cc3333; border: 1px solid #f5cccc; }
.alert-success { background: #f0faf4; color: #007a3d; border: 1px solid #b3e8cc; }

/* --- TABS --- */
.tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.35rem;
  box-shadow: var(--shadow);
}

.tab {
  flex: 1;
  padding: 0.55rem 0.5rem;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.tab:hover { background: var(--bg); color: var(--text); }
.tab.active { background: var(--primary); color: #fff; }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* --- CALENDAR --- */
#calendar { padding: 0.25rem; }

.fc-toolbar-title { font-size: 1rem !important; font-weight: 600 !important; }
.fc-button { background: var(--primary) !important; border-color: var(--primary) !important; font-size: 0.8rem !important; }
.fc-button:hover { background: var(--primary-h) !important; }
.fc-event { cursor: pointer; border-radius: 4px !important; font-size: 0.78rem !important; }
.fc-event-agendado { background: var(--kanban-ag) !important; border-color: var(--kanban-ag) !important; }
.fc-event-realizado { background: var(--kanban-re) !important; border-color: var(--kanban-re) !important; }
.fc-event-entregue { background: var(--kanban-en) !important; border-color: var(--kanban-en) !important; }

/* --- KANBAN --- */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.kanban-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  min-height: 400px;
}

.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1rem;
  border-bottom: 2px solid transparent;
}

.kanban-col-header.agendado { border-bottom-color: var(--kanban-ag); }
.kanban-col-header.realizado { border-bottom-color: var(--kanban-re); }
.kanban-col-header.entregue { border-bottom-color: var(--kanban-en); }

.kanban-col-title { font-weight: 600; font-size: 0.875rem; }

.kanban-col-count {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  background: var(--bg);
  color: var(--text-muted);
}

.kanban-cards {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-height: 350px;
}

.kanban-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  cursor: grab;
  transition: var(--transition);
  user-select: none;
}

.kanban-card:active { cursor: grabbing; }
.kanban-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.1); transform: translateY(-1px); }
.kanban-card.dragging { opacity: 0.5; }

.kanban-card-name { font-weight: 600; font-size: 0.875rem; margin-bottom: 0.35rem; }
.kanban-card-tipo { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.kanban-card-meta { display: flex; justify-content: space-between; align-items: center; }
.kanban-card-data { font-size: 0.78rem; color: var(--text-muted); }
.kanban-card-valor { font-size: 0.82rem; font-weight: 600; color: var(--accent-h); }

/* --- STATUS BADGE --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

.badge-agendado    { background: var(--status-ag); color: var(--status-ag-t); }
.badge-realizado   { background: var(--status-re); color: var(--status-re-t); }
.badge-entregue    { background: var(--status-en); color: var(--status-en-t); }

/* --- LISTA / TABELA --- */
.lista-header {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.input-busca {
  flex: 1;
  min-width: 180px;
}

.input-filtro { width: auto; min-width: 150px; }

.table-wrapper { overflow-x: auto; }

.tabela {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.tabela th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.tabela td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.tabela tr:last-child td { border-bottom: none; }
.tabela tr:hover td { background: var(--bg); }

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 2.5rem 1rem !important;
  font-size: 0.875rem;
}

.table-actions { display: flex; gap: 0.4rem; }

/* --- MODAL --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-title { font-size: 1rem; font-weight: 600; }

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.modal-close:hover { background: var(--bg); color: var(--text); }

.modal-body { padding: 1.5rem; }

.modal-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.modal-detail-item { display: flex; flex-direction: column; gap: 0.2rem; }
.modal-detail-label { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.modal-detail-value { font-size: 0.9rem; color: var(--text); }
.modal-detail-full { grid-column: 1 / -1; }

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* --- DASHBOARD --- */
.dashboard-filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.page-title { font-size: 1.2rem; font-weight: 700; letter-spacing: -0.02em; }

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.metrics-grid-3 { grid-template-columns: repeat(3, 1fr); }

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.metric-card.metric-receita { border-top: 3px solid #2e9e5c; }
.metric-card.metric-custo   { border-top: 3px solid #d97706; }
.metric-card.metric-lucro   { border-top: 3px solid var(--accent); }

.metric-label { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin-bottom: 0.4rem; }
.metric-value { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.03em; color: var(--text); }
.metric-sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.25rem; }

.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

.chart-card { }
.chart-card-wide { grid-column: 1 / -1; }

.chart-wrapper { position: relative; height: 220px; }
.chart-wrapper-tall { height: 260px; }

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: 1; }
  .kanban-board { grid-template-columns: 1fr; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .metrics-grid-3 { grid-template-columns: 1fr 1fr; }
  .charts-grid { grid-template-columns: 1fr; }
  .chart-card-wide { grid-column: 1; }
  .tabs { flex-wrap: wrap; }
  .tab { flex: none; }
  .topbar { padding: 0 1rem; gap: 0.75rem; }
  .user-email { display: none; }
  .modal-detail-grid { grid-template-columns: 1fr; }
  .modal-detail-full { grid-column: 1; }
}

@media (max-width: 480px) {
  .container { padding: 1rem 0.75rem; }
  .metrics-grid { grid-template-columns: 1fr; }
  .metrics-grid-3 { grid-template-columns: 1fr; }
}