/* =====================================================
   DOMOS - Sistema de Personal Doméstico
   CSS Principal · Mobile First · 2026
   ===================================================== */

/* ---- CSS Variables ---- */
:root {
  --primary:     #2563eb;
  --primary-d:   #1d4ed8;
  --primary-l:   #dbeafe;
  --secondary:   #7c3aed;
  --success:     #16a34a;
  --success-l:   #dcfce7;
  --danger:      #dc2626;
  --danger-l:    #fee2e2;
  --warning:     #d97706;
  --warning-l:   #fef3c7;
  --info:        #0891b2;
  --info-l:      #cffafe;
  --gray-50:     #f9fafb;
  --gray-100:    #f3f4f6;
  --gray-200:    #e5e7eb;
  --gray-300:    #d1d5db;
  --gray-400:    #9ca3af;
  --gray-500:    #6b7280;
  --gray-700:    #374151;
  --gray-900:    #111827;
  --white:       #ffffff;
  --font-sans:   'Segoe UI', system-ui, -apple-system, sans-serif;
  --radius:      8px;
  --radius-lg:   16px;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.08);
  --shadow:      0 4px 12px rgba(0,0,0,.10);
  --shadow-lg:   0 16px 40px rgba(0,0,0,.14);
  --transition:  .18s ease;
  --nav-h:       64px;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-sans);
  background: var(--gray-50);
  color: var(--gray-700);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { list-style: none; }

/* ---- Container ---- */
.container {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: 16px;
}
@media (min-width: 640px)  { .container { padding-inline: 24px; } }
@media (min-width: 1024px) { .container { padding-inline: 32px; } }

/* ---- Navbar ---- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  height: var(--nav-h);
  box-shadow: var(--shadow-sm);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: 16px;
}
.nav-brand {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.brand-icon { font-size: 1.5rem; }
.nav-toggle {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius);
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--gray-700);
  border-radius: 2px;
  transition: var(--transition);
}
.nav-links {
  display: none;
  position: absolute;
  top: var(--nav-h);
  left: 0;
  right: 0;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 12px 16px 20px;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow);
}
.nav-links.open { display: flex; }
.nav-links li a {
  display: block;
  padding: 8px 12px;
  border-radius: var(--radius);
  color: var(--gray-700);
  font-weight: 500;
  transition: background var(--transition);
}
.nav-links li a:hover { background: var(--gray-100); text-decoration: none; }

@media (min-width: 768px) {
  .nav-toggle { display: none; }
  .nav-links {
    display: flex;
    position: static;
    flex-direction: row;
    align-items: center;
    padding: 0;
    border: none;
    box-shadow: none;
    gap: 4px;
  }
  .nav-links li a { padding: 6px 10px; font-size: .9rem; }
}

/* ---- Main ---- */
.main-content { flex: 1; padding-block: 32px; }
.footer {
  background: var(--gray-900);
  color: var(--gray-400);
  padding: 20px 0;
  font-size: .85rem;
  text-align: center;
}
.footer a { color: var(--gray-400); text-decoration: underline; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius);
  border: 2px solid transparent;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.2;
  font-family: inherit;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary   { background: var(--primary);   color: var(--white); }
.btn-primary:hover   { background: var(--primary-d); }
.btn-success   { background: var(--success);   color: var(--white); }
.btn-danger    { background: var(--danger);    color: var(--white); }
.btn-warning   { background: var(--warning);   color: var(--white); }
.btn-secondary { background: var(--gray-500);  color: var(--white); }
.btn-outline   { border-color: var(--primary); color: var(--primary); background: transparent; }
.btn-outline:hover { background: var(--primary-l); }
.btn-ghost     { background: transparent; color: var(--gray-700); border-color: var(--gray-300); }
.btn-ghost:hover { background: var(--gray-100); }
.btn-sm { padding: 6px 14px; font-size: .82rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ---- Forms ---- */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: .9rem;
  color: var(--gray-700);
}
.form-label .req { color: var(--danger); margin-left: 2px; }
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: .95rem;
  font-family: inherit;
  color: var(--gray-900);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.form-control::placeholder { color: var(--gray-400); }
.form-control.is-invalid { border-color: var(--danger); }
.form-hint { font-size: .8rem; color: var(--gray-500); margin-top: 4px; }
.form-error { font-size: .8rem; color: var(--danger); margin-top: 4px; font-weight: 500; }

select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }

.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  background: var(--gray-50);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
}
.checkbox-group input[type=checkbox] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  cursor: pointer;
  accent-color: var(--primary);
  margin-top: 2px;
}

.form-row { display: grid; gap: 16px; }
@media (min-width: 640px) { .form-row.cols-2 { grid-template-columns: 1fr 1fr; } }

/* ---- Cards ---- */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}
.card-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-header h2, .card-header h3 { font-size: 1.1rem; color: var(--gray-900); }
.card-body { padding: 24px; }
.card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
}

/* Worker Cards (listado público) */
.worker-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
@media (min-width: 480px) { .worker-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .worker-grid { grid-template-columns: repeat(3, 1fr); } }

.worker-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  transition: box-shadow var(--transition), transform var(--transition);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.worker-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

.worker-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--primary-l);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  flex-shrink: 0;
}
.worker-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 2px;
}
.worker-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: .82rem;
  color: var(--gray-500);
}
.worker-jobs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.worker-card .btn { margin-top: auto; }

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-success   { background: var(--success-l);  color: var(--success); }
.badge-danger    { background: var(--danger-l);   color: var(--danger); }
.badge-warning   { background: var(--warning-l);  color: var(--warning); }
.badge-info      { background: var(--info-l);     color: var(--info); }
.badge-secondary { background: var(--gray-100);   color: var(--gray-500); }
.badge-primary   { background: var(--primary-l);  color: var(--primary); }
.badge-verified  { background: #fef9c3; color: #854d0e; }

/* ---- Alerts ---- */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: .9rem;
  font-weight: 500;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert::before { font-size: 1rem; }
.alert-success { background: var(--success-l); color: #14532d; border-left: 4px solid var(--success); }
.alert-success::before { content: '✓'; }
.alert-error   { background: var(--danger-l);  color: #7f1d1d; border-left: 4px solid var(--danger); }
.alert-error::before   { content: '✕'; }
.alert-warning { background: var(--warning-l); color: #78350f; border-left: 4px solid var(--warning); }
.alert-warning::before { content: '⚠'; }
.alert-info    { background: var(--info-l);    color: #0c4a6e; border-left: 4px solid var(--info); }
.alert-info::before    { content: 'ℹ'; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--gray-200); }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
thead th {
  background: var(--gray-50);
  padding: 12px 16px;
  text-align: left;
  font-weight: 700;
  color: var(--gray-700);
  border-bottom: 2px solid var(--gray-200);
  white-space: nowrap;
}
tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--gray-50); }
.table-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---- Pagination ---- */
.pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  margin-top: 24px;
  flex-wrap: wrap;
}
.pagination a, .pagination span {
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--gray-300);
  font-size: .85rem;
  font-weight: 600;
  color: var(--gray-700);
  text-decoration: none;
  transition: all var(--transition);
}
.pagination a:hover { background: var(--gray-100); }
.pagination .current { background: var(--primary); color: var(--white); border-color: var(--primary); }
.pagination .disabled { opacity: .4; pointer-events: none; }

/* ---- Modal ---- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  padding: 32px;
}
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--gray-500);
  padding: 4px 8px;
  border-radius: var(--radius);
}
.modal-close:hover { background: var(--gray-100); }

/* ---- Page headers ---- */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.page-header h1 { font-size: 1.6rem; color: var(--gray-900); }
.page-header p { color: var(--gray-500); margin-top: 4px; font-size: .9rem; }

/* ---- Stats grid ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}
@media (min-width: 768px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1024px) { .stats-grid { grid-template-columns: repeat(5, 1fr); } }
.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  padding: 20px;
  text-align: center;
}
.stat-number { font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-label { font-size: .82rem; color: var(--gray-500); margin-top: 4px; }

/* ---- Doc status grid ---- */
.doc-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 640px) { .doc-grid { grid-template-columns: 1fr 1fr; } }

.doc-item {
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: border-color var(--transition);
}
.doc-item.approved { border-color: var(--success); }
.doc-item.pending  { border-color: var(--warning); }
.doc-item.rejected { border-color: var(--danger); }
.doc-item.missing  { border-color: var(--gray-200); background: var(--gray-50); }

.doc-name { font-weight: 700; margin-bottom: 8px; font-size: .95rem; }
.doc-rejection { background: var(--danger-l); color: var(--danger); padding: 8px; border-radius: var(--radius); font-size: .82rem; margin-top: 8px; }

/* ---- Filter bar ---- */
.filter-bar {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
}
.filter-bar form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 640px)  { .filter-bar form { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .filter-bar form { grid-template-columns: repeat(4, 1fr) auto; align-items: end; } }

/* ---- Home hero ---- */
.hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 60%, #7c3aed 100%);
  border-radius: var(--radius-lg);
  padding: 60px 32px;
  text-align: center;
  color: var(--white);
  margin-bottom: 40px;
}
.hero h1 { font-size: clamp(1.6rem, 4vw, 2.8rem); font-weight: 800; margin-bottom: 16px; }
.hero p  { font-size: 1.1rem; opacity: .9; margin-bottom: 32px; max-width: 600px; margin-inline: auto; margin-bottom: 32px; }
.hero-search {
  display: flex;
  gap: 10px;
  max-width: 540px;
  margin-inline: auto;
  flex-wrap: wrap;
}
.hero-search .form-control {
  flex: 1;
  min-width: 180px;
  background: rgba(255,255,255,.15);
  border-color: rgba(255,255,255,.4);
  color: var(--white);
}
.hero-search .form-control::placeholder { color: rgba(255,255,255,.7); }
.hero-search .form-control option { color: var(--gray-900); background: var(--white); }

/* ---- Multi-select tags ---- */
.job-type-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
@media (min-width: 480px) { .job-type-grid { grid-template-columns: repeat(3, 1fr); } }
.job-type-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 2px solid var(--gray-300);
  cursor: pointer;
  font-size: .85rem;
  font-weight: 500;
  transition: all var(--transition);
  user-select: none;
}
.job-type-tag input { display: none; }
.job-type-tag:hover { border-color: var(--primary); background: var(--primary-l); }
.job-type-tag.selected { border-color: var(--primary); background: var(--primary-l); color: var(--primary); }

/* ---- Location rows ---- */
.location-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.location-row .form-control { flex: 1; }
.btn-remove-loc {
  background: var(--danger-l);
  border: none;
  color: var(--danger);
  border-radius: var(--radius);
  padding: 8px 10px;
  cursor: pointer;
  font-size: .9rem;
  flex-shrink: 0;
}

/* ---- Profile status bar ---- */
.profile-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--gray-200);
  background: var(--white);
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.profile-status.verified   { border-color: var(--success); background: var(--success-l); }
.profile-status.published  { border-color: var(--primary); background: var(--primary-l); }
.profile-status.hidden     { border-color: var(--gray-300); background: var(--gray-50); }

/* ---- Chat/messages ---- */
.messages-thread { display: flex; flex-direction: column; gap: 12px; }
.message-bubble {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: .9rem;
  line-height: 1.5;
}
.message-bubble.worker     { background: var(--primary-l);  align-self: flex-end; }
.message-bubble.contractor { background: var(--gray-100);   align-self: flex-start; }
.message-bubble.admin      { background: #fef3c7;            align-self: center; border: 1px solid var(--warning); }
.message-meta { font-size: .75rem; color: var(--gray-400); margin-top: 4px; }

/* ---- Toggle switch ---- */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }
.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--gray-300);
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: var(--white);
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-switch input:checked + .toggle-slider { background: var(--success); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ---- Utilities ---- */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--gray-500); font-size: .88rem; }
.text-success{ color: var(--success); }
.text-danger { color: var(--danger); }
.fw-bold { font-weight: 700; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.gap-2 { gap: 16px; }
.d-flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.divider { border: none; border-top: 1px solid var(--gray-200); margin: 24px 0; }

/* ---- Section label ---- */
.section-label {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--gray-400);
  margin-bottom: 12px;
}

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-400);
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state p { font-size: .95rem; }

/* ---- Loader ---- */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Interview card ---- */
.interview-card {
  background: linear-gradient(135deg, var(--primary-l), #e0e7ff);
  border: 2px solid var(--primary);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 24px;
}
.interview-card h3 { color: var(--primary); margin-bottom: 12px; }
.interview-detail { display: flex; gap: 8px; margin-bottom: 8px; align-items: flex-start; }
.interview-detail strong { min-width: 120px; }

/* ---- Responsive helpers ---- */
@media (max-width: 640px) {
  .hide-mobile { display: none !important; }
  .page-header { flex-direction: column; }
  .page-header > * { width: 100%; }
}
@media (min-width: 641px) { .hide-desktop { display: none !important; } }

/* ---- Print ---- */
@media print {
  .navbar, .footer, .btn, .pagination { display: none; }
  .main-content { padding: 0; }
}

/* ---- Dark mode (futuro) ---- */
@media (prefers-color-scheme: dark) {
  /* Intencional: light mode solamente por ahora para máxima legibilidad en hostings */
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }
