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

:root {
  --primary: #1a365d;
  --primary-light: #2b4c7e;
  --accent: #c9a84c;
  --bg: #f0f2f5;
  --card-bg: #ffffff;
  --text: #2d3748;
  --text-light: #718096;
  --border: #e2e8f0;
  --success: #48bb78;
  --warning: #ed8936;
  --error: #e53e3e;
  --info: #4299e1;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* LOGIN PAGE */
.login-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  background: white;
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}

.login-header {
  text-align: center;
  margin-bottom: 28px;
}

.login-icon {
  width: 56px;
  height: 56px;
  background: var(--primary);
  color: white;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.login-header h1 {
  font-size: 22px;
  color: var(--primary);
  margin-bottom: 4px;
}

.login-header p {
  color: var(--text-light);
  font-size: 14px;
}

/* ALERTS */
.alert {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
}

.alert-error {
  background: #fff5f5;
  color: #742a2a;
  border: 1px solid #fed7d7;
}

.alert-success {
  background: #f0fff4;
  color: #22543d;
  border: 1px solid #c6f6d5;
}

/* FORM */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: #f7fafc;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,54,93,0.1);
  background: white;
}

.form-group textarea {
  resize: vertical;
  min-height: 70px;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border: none;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-light);
}

.btn-secondary {
  background: #edf2f7;
  color: var(--text);
}

.btn-secondary:hover {
  background: #e2e8f0;
}

.btn-danger {
  background: #fff5f5;
  color: var(--error);
  border: 1px solid #fed7d7;
}

.btn-danger:hover {
  background: #fed7d7;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-full {
  width: 100%;
  justify-content: center;
  padding: 12px;
}

/* LAYOUT */
.topbar {
  background: var(--primary);
  color: white;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-brand {
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-brand .badge {
  background: var(--accent);
  color: var(--primary);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}

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

.topbar-user {
  font-size: 13px;
  opacity: 0.8;
}

.topbar-actions a {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: color 0.2s;
}

.topbar-actions a:hover {
  color: white;
}

.main-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

/* PAGE HEADER */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 22px;
  color: var(--primary);
}

.page-header .subtitle {
  font-size: 14px;
  color: var(--text-light);
}

/* STATS CARDS */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border-radius: 10px;
  padding: 20px;
  border: 1px solid var(--border);
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
}

.stat-card .stat-label {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 2px;
}

/* TABLE */
.table-card {
  background: white;
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.search-input {
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  width: 280px;
  outline: none;
}

.search-input:focus {
  border-color: var(--primary);
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  background: #f7fafc;
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-light);
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: #f7fafc;
}

.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.status-novo {
  background: #ebf8ff;
  color: #2b6cb0;
}

.status-visto {
  background: #fefcbf;
  color: #975a16;
}

.status-respondido {
  background: #f0fff4;
  color: #276749;
}

.actions-cell {
  display: flex;
  gap: 6px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state p {
  font-size: 15px;
}

/* VIEW / EDIT PAGE */
.detail-card {
  background: white;
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 20px;
  overflow: hidden;
}

.detail-card-header {
  background: #f7fafc;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.detail-card-header h2 {
  font-size: 16px;
  color: var(--primary);
  font-weight: 600;
}

.detail-card-body {
  padding: 24px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.detail-field {
  margin-bottom: 16px;
}

.detail-field:last-child {
  margin-bottom: 0;
}

.detail-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-light);
  margin-bottom: 4px;
}

.detail-value {
  font-size: 14px;
  color: var(--text);
}

.detail-value.empty {
  color: #cbd5e0;
  font-style: italic;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-block;
  background: #edf2f7;
  color: var(--text);
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
}

/* ACTION BAR */
.action-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.action-bar .back-link {
  color: var(--text-light);
  text-decoration: none;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.action-bar .back-link:hover {
  color: var(--primary);
}

.action-bar .spacer {
  flex: 1;
}

/* MODAL */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: white;
  border-radius: 12px;
  padding: 32px;
  max-width: 420px;
  width: 90%;
  text-align: center;
}

.modal h3 {
  font-size: 18px;
  color: var(--text);
  margin-bottom: 8px;
}

.modal p {
  color: var(--text-light);
  font-size: 14px;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* SELECT STATUS */
.status-select {
  padding: 4px 10px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  background: white;
  cursor: pointer;
}

.status-select.status-pendente {
  border-color: #bee3f8;
  background: #ebf8ff;
  color: #2b6cb0;
}

.status-select.status-respondido {
  border-color: #c6f6d5;
  background: #f0fff4;
  color: #276749;
}

.status-select.status-visto {
  border-color: #fefcbf;
  background: #fffff0;
  color: #975a16;
}

.status-select.status-em_andamento {
  border-color: #fed7aa;
  background: #fffaf0;
  color: #c05621;
}

/* TYPE BADGE */
.type-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  background: #edf2f7;
  color: var(--text);
  white-space: nowrap;
}

/* LINK CELL */
.link-cell {
  display: flex;
  align-items: center;
  gap: 6px;
}

.link-code {
  font-size: 12px;
  background: #f7fafc;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid var(--border);
  color: var(--text-light);
}

.btn-copy {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
  line-height: 1;
}

.btn-copy:hover {
  background: #edf2f7;
  border-color: var(--primary);
}

/* EDIT FORM */
.edit-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.edit-form .checkbox-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.edit-form .checkbox-list label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
}

.edit-form .checkbox-list label:has(input:checked) {
  background: rgba(26,54,93,0.05);
  border-color: var(--primary);
}

.edit-form .radio-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.edit-form .radio-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
}

.edit-form .radio-list label:has(input:checked) {
  background: rgba(26,54,93,0.05);
  border-color: var(--primary);
}

/* EXPORT PAGE */
.export-page {
  background: white;
  max-width: 800px;
  margin: 0 auto;
  padding: 40px;
}

.export-header {
  text-align: center;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 3px solid var(--primary);
}

.export-header h1 {
  font-size: 24px;
  color: var(--primary);
  margin-bottom: 4px;
}

.export-header p {
  color: var(--text-light);
  font-size: 14px;
}

.export-section {
  margin-bottom: 24px;
}

.export-section h3 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* PRINT STYLES */
@media print {
  .topbar, .action-bar, .no-print { display: none !important; }
  body { background: white; }
  .main-content { max-width: 100%; padding: 0; }
  .detail-card { box-shadow: none; border: 1px solid #ddd; }
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .table-toolbar { flex-direction: column; gap: 10px; }
  .search-input { width: 100%; }
  .detail-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .edit-form .form-row { grid-template-columns: 1fr; }
}
