/* ============================================================
   Login Único Camim - Stylesheet
   Clean, modern authentication UI
   ============================================================ */

/* --- CSS Custom Properties ---------------------------------- */
:root {
  --primary:        #1a56db;
  --primary-dark:   #1e429f;
  --primary-light:  #ebf0ff;
  --danger:         #dc2626;
  --danger-dark:    #b91c1c;
  --danger-light:   #fef2f2;
  --success:        #16a34a;
  --success-light:  #f0fdf4;
  --warning-light:  #fefce8;

  --error-bg:       #fdf2f2;
  --error-text:     #e02424;
  --error-border:   #f8b4b4;

  --border:         #e5e7eb;
  --border-focus:   #1a56db;
  --text-primary:   #111827;
  --text-secondary: #6b7280;
  --text-muted:     #9ca3af;
  --bg-page:        #f3f4f6;
  --bg-card:        #ffffff;

  --shadow:         0 4px 6px -1px rgba(0, 0, 0, 0.07),
                    0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg:      0 10px 15px -3px rgba(0, 0, 0, 0.08),
                    0 4px 6px -4px rgba(0, 0, 0, 0.04);

  --radius-sm:      6px;
  --radius:         10px;
  --radius-lg:      14px;

  --font:           system-ui, -apple-system, BlinkMacSystemFont,
                    'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

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

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

body {
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--bg-page);
  min-height: 100vh;
}

/* --- Page Layout -------------------------------------------- */
.page-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px;
}

/* --- Card --------------------------------------------------- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px 40px 36px;
  width: 100%;
  max-width: 420px;
  text-align: left;
}

.card--error {
  text-align: center;
}

/* --- Logo --------------------------------------------------- */
.logo {
  display: flex;
  justify-content: center;
  margin-bottom: 6px;
}

/* --- Subtitle ----------------------------------------------- */
.subtitle {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  text-align: center;
  margin-bottom: 28px;
  line-height: 1.5;
}

.subtitle strong {
  color: var(--text-primary);
}

/* --- Form Groups -------------------------------------------- */
.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-input {
  display: block;
  width: 100%;
  padding: 10px 14px;
  font-size: 1rem;
  font-family: var(--font);
  color: var(--text-primary);
  background-color: #fff;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}

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

.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.15);
}

.form-input:focus-visible {
  outline: none;
}

/* Inline form group (checkbox row) */
.form-group--inline {
  display: flex;
  align-items: center;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-secondary);
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* --- Buttons ----------------------------------------------- */
.btn-primary,
.btn-secondary,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 11px 20px;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: var(--font);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
  text-decoration: none;
  margin-top: 8px;
}

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

.btn-primary:hover {
  background-color: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(26, 86, 219, 0.3);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-secondary {
  background-color: #ffffff;
  color: var(--text-primary);
  border: 1.5px solid var(--border);
}

.btn-secondary:hover {
  background-color: var(--bg-page);
}

.btn-danger {
  background-color: var(--danger);
  color: #ffffff;
}

.btn-danger:hover {
  background-color: var(--danger-dark);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

/* --- Alert / Error ------------------------------------------ */
.alert-error {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background-color: var(--error-bg);
  color: var(--error-text);
  border: 1px solid var(--error-border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 20px;
  font-size: 0.875rem;
  line-height: 1.5;
}

.alert-error svg {
  flex-shrink: 0;
  margin-top: 1px;
}

/* --- Consent Page ------------------------------------------ */
.consent-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 6px;
  line-height: 1.4;
}

.consent-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 20px;
}

.permissions-list {
  list-style: none;
  margin-bottom: 24px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.permission-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.permission-item:last-child {
  border-bottom: none;
}

.permission-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background-color: var(--success-light);
  color: var(--success);
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 2px;
}

.permission-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.permission-text strong {
  font-size: 0.9375rem;
  color: var(--text-primary);
}

.permission-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.consent-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.consent-actions form {
  display: block !important;
  width: 100%;
}

.consent-note {
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 16px;
  line-height: 1.5;
}

/* --- Error Page --------------------------------------------- */
.error-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.error-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 12px;
}

.error-code {
  display: flex;
  justify-content: center;
  margin-bottom: 10px;
}

.error-code code {
  background-color: var(--error-bg);
  color: var(--error-text);
  border: 1px solid var(--error-border);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

.error-description {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  text-align: center;
  margin-bottom: 24px;
  line-height: 1.6;
}

.error-actions {
  display: flex;
  justify-content: center;
}

.error-actions .btn-secondary {
  width: auto;
  padding: 10px 24px;
}

/* --- Logout Page -------------------------------------------- */
.logout-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.logout-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 10px;
}

.logout-subtitle {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  text-align: center;
  margin-bottom: 28px;
  line-height: 1.6;
}

/* --- Footer ------------------------------------------------- */
.page-footer {
  margin-top: 20px;
  text-align: center;
}

.page-footer p {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* --- Responsive --------------------------------------------- */
@media (max-width: 480px) {
  .card {
    padding: 28px 20px 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }

  .btn-primary,
  .btn-secondary,
  .btn-danger {
    padding: 12px 20px;
    font-size: 1rem;
  }
}

@media (prefers-color-scheme: dark) {
  /* Optional: provide dark mode support */
  /* Uncomment to enable:
  :root {
    --bg-page:        #111827;
    --bg-card:        #1f2937;
    --text-primary:   #f9fafb;
    --text-secondary: #d1d5db;
    --text-muted:     #6b7280;
    --border:         #374151;
  }
  */
}

/* ============================================================
   Admin Panel Styles
   ============================================================ */

/* --- Admin Layout ------------------------------------------ */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* --- Admin Sidebar ----------------------------------------- */
.admin-sidebar {
  width: 220px;
  flex-shrink: 0;
  background-color: #1e3a5f;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.admin-sidebar-logo {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  gap: 2px;
}

.admin-sidebar-logo span {
  font-size: 0.75rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-sidebar nav {
  display: flex;
  flex-direction: column;
  padding: 12px 0;
  flex: 1;
}

.admin-sidebar nav a {
  display: block;
  padding: 10px 20px;
  color: rgba(255, 255, 255, 0.75);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.admin-sidebar nav a:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.admin-sidebar nav a.active {
  background-color: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  border-left: 3px solid #60a5fa;
  padding-left: 17px;
}

/* Last nav link (Sair) styles as danger-ish */
.admin-sidebar nav a:last-child {
  margin-top: auto;
  color: rgba(255, 180, 180, 0.8);
}

.admin-sidebar nav a:last-child:hover {
  color: #fca5a5;
  background-color: rgba(220, 38, 38, 0.15);
}

/* --- Admin Main Content ------------------------------------ */
.admin-main {
  flex: 1;
  padding: 32px 40px;
  background-color: var(--bg-page);
  overflow-y: auto;
}

/* --- Admin Header ------------------------------------------ */
.admin-header {
  margin-bottom: 28px;
}

.admin-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* --- Table Container --------------------------------------- */
.table-container {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* --- Table Styles ----------------------------------------- */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

th {
  background-color: #f9fafb;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 14px 16px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

tr:hover td {
  background-color: #fafafa;
}

/* --- Badges ----------------------------------------------- */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-active {
  background-color: #dcfce7;
  color: #15803d;
}

.badge-pending {
  background-color: #fef9c3;
  color: #854d0e;
}

.badge-inactive {
  background-color: #f3f4f6;
  color: #6b7280;
}

/* --- Inline Form ------------------------------------------ */
.form-inline {
  display: flex;
  gap: 12px;
  align-items: center;
}

.form-inline .form-input {
  flex: 1;
}

/* --- Flash Messages --------------------------------------- */
.flash-success {
  background-color: var(--success-light);
  color: var(--success);
  border: 1px solid #bbf7d0;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 0.9375rem;
  font-weight: 500;
}

.flash-error {
  background-color: var(--error-bg);
  color: var(--error-text);
  border: 1px solid var(--error-border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 0.9375rem;
  font-weight: 500;
}

/* --- Small Buttons ---------------------------------------- */
.btn-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 12px;
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: var(--font);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}

.btn-sm-primary {
  background-color: var(--primary);
  color: #ffffff;
}

.btn-sm-primary:hover {
  background-color: var(--primary-dark);
}

.btn-sm-secondary {
  background-color: #ffffff;
  color: var(--text-primary);
  border: 1.5px solid var(--border);
}

.btn-sm-secondary:hover {
  background-color: var(--bg-page);
}

.btn-sm-danger {
  background-color: var(--danger);
  color: #ffffff;
}

.btn-sm-danger:hover {
  background-color: var(--danger-dark);
}

/* --- Admin Responsive ------------------------------------- */
@media (max-width: 768px) {
  .admin-layout {
    flex-direction: column;
  }

  .admin-sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 12px 16px;
  }

  .admin-sidebar nav {
    flex-direction: row;
    flex-wrap: wrap;
    padding: 0;
    gap: 4px;
  }

  .admin-sidebar nav a {
    padding: 8px 14px;
  }

  .admin-sidebar nav a.active {
    border-left: none;
    border-bottom: 2px solid #60a5fa;
    padding-left: 14px;
  }

  .admin-main {
    padding: 20px 16px;
  }

  .form-inline {
    flex-direction: column;
    align-items: stretch;
  }
}
