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

:root {
  /* Brand */
  --brand: #1E3A8A;
  --brand-hover: #1e40af;
  --brand-light: #EFF6FF;
  --brand-mid: #BFDBFE;
  --emerald: #059669;
  --emerald-light: #ECFDF5;
  --emerald-mid: #6EE7B7;

  /* Surfaces */
  --bg: #F1F5F9;
  --surface: #FFFFFF;
  --surface-alt: #F8FAFC;

  /* Text */
  --text: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;

  /* Borders */
  --border: #E2E8F0;
  --border-strong: #CBD5E1;

  /* Feedback */
  --danger: #DC2626;
  --danger-soft: #FEF2F2;
  --danger-border: #FECACA;
  --success: #059669;
  --success-soft: #ECFDF5;
  --success-border: #6EE7B7;

  /* Shadows — layered for depth */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 2px 4px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.08), 0 16px 48px rgba(15, 23, 42, 0.04);

  /* Shape */
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 8px;
  --radius-xs: 6px;

  --max-width: 1100px;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Outfit', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(30, 58, 138, 0.07), transparent),
    radial-gradient(ellipse 50% 40% at 100% 70%, rgba(5, 150, 105, 0.05), transparent);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a, button, input { font: inherit; }
button, .link-button { cursor: pointer; }

/* ─── ANIMATIONS ────────────────────────────────────── */

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── PAGE SHELL ────────────────────────────────────── */

.page-shell {
  width: min(calc(100% - 2rem), var(--max-width));
  margin: 0 auto;
  padding: 2rem 0 4rem;
  display: grid;
  gap: 1.5rem;
}

/* ─── PANEL ─────────────────────────────────────────── */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

/* Panels that are just a simple message or short form */
.narrow-panel {
  padding: 1.5rem;
  display: grid;
  gap: 1.25rem;
}

/* ─── HERO ──────────────────────────────────────────── */

.hero {
  position: relative;
  padding: 1.5rem;
  overflow: hidden;
  animation: fadeSlideUp 0.45s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--emerald));
}

.hero-copy { /* left column, no extra styles needed */ }

.hero-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 1rem;
}

/* ─── TYPOGRAPHY ────────────────────────────────────── */

h1, h2, h3 { margin: 0; }

h1 {
  font-size: clamp(1.5rem, 5vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.1;
}

h2 {
  font-size: clamp(1.125rem, 3vw, 1.375rem);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.eyebrow::before {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--emerald));
  flex-shrink: 0;
}

.panel-copy,
.card-copy,
.task-copy p,
.empty-state {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.6;
  font-size: 0.875rem;
}

/* ─── ROLE BADGE ────────────────────────────────────── */

.role-badge {
  display: inline-flex;
  align-items: center;
  height: 2rem;
  padding: 0 0.75rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
}

.role-badge-cleaner {
  background: var(--brand-light);
  color: var(--brand);
  border: 1px solid var(--brand-mid);
}

.role-badge-manager {
  background: var(--emerald-light);
  color: var(--emerald);
  border: 1px solid var(--emerald-mid);
}

/* ─── CONTENT STACK ─────────────────────────────────── */

.content-stack {
  display: grid;
  gap: 1.25rem;
}

/* ─── SECTION HEAD / DETAIL HEAD ────────────────────── */

.section-head,
.detail-head {
  display: grid;
  gap: 0.5rem;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.section-head-stacked {
  grid-template-columns: minmax(0, 1fr);
}

/* Alert inside a panel (e.g. error between section-head and form) */
.panel > .alert {
  margin: 1.5rem 1.5rem 0;
}

/* ─── ALERTS ────────────────────────────────────────── */

.alert {
  padding: 0.875rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.5;
}

.alert-error {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.alert-success {
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid var(--success-border);
}

/* ─── FORMS ─────────────────────────────────────────── */

.stack-form {
  display: grid;
  gap: 1rem;
  margin-top: 0.25rem;
}

.submission-form {
  display: grid;
  gap: 1.5rem;
  padding: 1.5rem;
}

.identity-grid {
  display: grid;
  gap: 1rem;
}

.field {
  display: grid;
  gap: 0.4rem;
}

.field span {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

input[type="text"],
input[type="password"] {
  width: 100%;
  height: 2.75rem;
  padding: 0 0.875rem;
  border-radius: var(--radius-xs);
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input[type="text"]:focus,
input[type="password"]:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.12);
}

/* Hide the native file input — replaced by .upload-btn */
.upload-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ─── BUTTONS ───────────────────────────────────────── */

.primary-button,
.secondary-button,
.ghost-button,
.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 2.5rem;
  padding: 0 1.125rem;
  border-radius: var(--radius-xs);
  border: none;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.primary-button {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 1px 2px rgba(30, 58, 138, 0.25), 0 2px 8px rgba(30, 58, 138, 0.15);
}

.primary-button:hover {
  background: var(--brand-hover);
  box-shadow: 0 2px 4px rgba(30, 58, 138, 0.3), 0 4px 14px rgba(30, 58, 138, 0.2);
  transform: translateY(-1px);
}

.primary-button:active {
  transform: translateY(0);
}

.secondary-button {
  background: var(--surface-alt);
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-xs);
}

.secondary-button:hover {
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.ghost-button {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
}

.ghost-button:hover {
  background: var(--surface-alt);
  color: var(--text);
}

/* ─── AREA COLORS ───────────────────────────────────── */

.task-group                         { --area-color: #64748B; }
.task-group[data-area="Lavandería"] { --area-color: #6366F1; }
.task-group[data-area="Dormitorio"] { --area-color: #8B5CF6; }
.task-group[data-area="Cocina"]     { --area-color: #F59E0B; }
.task-group[data-area="Baño"]       { --area-color: #0EA5E9; }
.task-group[data-area="Sala"]       { --area-color: #10B981; }
.task-group[data-area="General"]    { --area-color: #64748B; }

/* ─── TASK GROUPS ───────────────────────────────────── */

.task-groups,
.detail-groups {
  display: grid;
  gap: 1rem;
}

.task-group {
  position: relative;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  border-left: 4px solid var(--area-color);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.22s ease, transform 0.22s ease;
}

.task-group:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.task-group-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.125rem;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
}

.area-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--area-color);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 700;
  flex-shrink: 0;
}

.area-label {
  flex: 1 1 auto;
  min-width: 0;
}

.task-group-head span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ─── TASK LIST & TASK CARD ─────────────────────────── */

.task-list {
  display: grid;
  padding: 0;
}

.task-card {
  display: grid;
  gap: 0.75rem;
  padding: 1rem 1.125rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
  transition: background 0.15s ease;
  cursor: pointer;
}

.task-card:first-child {
  border-top: none;
}

.task-card:hover {
  background: var(--surface-alt);
}

.task-card.has-file {
  background: var(--emerald-light);
}

.task-card.has-file:hover {
  background: #d1fae5;
}

.task-copy {
  display: grid;
  gap: 0.2rem;
}

.task-copy strong {
  font-size: 0.9375rem;
  font-weight: 600;
}

.task-copy p { margin: 0; }

/* ─── UPLOAD AREA ───────────────────────────────────── */

.upload-area {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-wrap: wrap;
}

.upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4375rem;
  height: 2.25rem;
  padding: 0 0.875rem;
  border-radius: var(--radius-xs);
  background: var(--brand);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  pointer-events: none; /* the parent label handles clicks */
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  box-shadow: 0 1px 2px rgba(30, 58, 138, 0.2), 0 2px 8px rgba(30, 58, 138, 0.12);
}

.task-card:hover .upload-btn {
  background: var(--brand-hover);
  box-shadow: 0 2px 4px rgba(30, 58, 138, 0.28), 0 4px 12px rgba(30, 58, 138, 0.18);
  transform: translateY(-1px);
}

.task-card.has-file .upload-btn {
  background: var(--emerald);
  box-shadow: 0 1px 2px rgba(5, 150, 105, 0.2), 0 2px 8px rgba(5, 150, 105, 0.12);
}

.task-card.has-file:hover .upload-btn {
  background: #047857;
  transform: translateY(-1px);
}

.upload-btn svg {
  flex-shrink: 0;
}

.upload-file-name {
  font-size: 0.75rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}

/* ─── SUBMISSION CARDS (Manager index) ──────────────── */

.submission-list {
  display: grid;
  gap: 0.875rem;
  padding: 0 1.5rem 1.5rem;
}

.submission-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.125rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.submission-card:hover {
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

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

.submission-meta span {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* ─── PHOTO GRID (Manager detail) ───────────────────── */

.photo-grid {
  display: grid;
  gap: 0.875rem;
  padding: 1.125rem;
}

.photo-card {
  display: grid;
  gap: 0.75rem;
  padding: 0.875rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  align-content: start;
  transition: box-shadow 0.2s ease;
}

.photo-card:hover {
  box-shadow: var(--shadow-sm);
}

.photo-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
}

/* ─── EMPTY STATE ───────────────────────────────────── */

.empty-state {
  padding: 1.125rem;
  margin: 0 1.5rem 1.5rem;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-strong);
  background: var(--surface-alt);
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ─── ACTION ROW ────────────────────────────────────── */

.action-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* ─── RESPONSIVE ────────────────────────────────────── */

@media (min-width: 640px) {
  .page-shell {
    width: min(calc(100% - 3rem), var(--max-width));
    padding-top: 2.5rem;
  }

  .hero {
    padding: 2rem;
  }
}

@media (min-width: 760px) {
  .hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .hero-actions {
    margin-top: 0;
  }

  .section-head,
  .detail-head {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }

  .section-head-stacked {
    grid-template-columns: minmax(0, 1fr);
  }

  .identity-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .task-card {
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 1.25rem;
  }

  .submission-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 980px) {
  .photo-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
