﻿/* ============================================
  TEMA CLARO - ESTILO COMPARADOR
============================================ */

:root{
  --bg:#f4f7fb;
  --card:#ffffff;
  --text:#1f2937;
  --muted:#6b7280;
  --line:#e5e7eb;
  --btn:#2b4c7e;
  --btn2:#3a5f98;
  --brand:#2b4c7e;
  --brand-soft:#eaf1fb;
  --err:#dc3545;
  --success:#4CAF50;
  --warning:#FFA726;
  --empty:#E0E0E0;
  --panel:#f8fbff;
  --calendar-border: rgba(43,76,126,0.12);
  --calendar-border-strong: rgba(43,76,126,0.38);
  --radius-sm:10px;
  --radius-md:14px;
  --space-1:8px;
  --space-2:12px;
  --space-3:16px;
  --space-4:24px;
  --gh-cell-size:22px;
}

/* NormalizaciÃ³n */
*{
  box-sizing:border-box;
  font-family:'Inter',system-ui,-apple-system,Segoe UI,Roboto,Arial;
}

body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  min-height:100vh;
  line-height:1.4;
  font-size:14px;
}

h2{
  margin:0 0 var(--space-2);
  font-size:20px;
  font-weight:600;
  color:var(--brand);
}

h3{
  margin:0 0 var(--space-2);
  font-size:15px;
  font-weight:600;
  color:var(--brand);
}

h4{
  margin:0 0 var(--space-1);
  font-size:14px;
  font-weight:600;
}

/* ============================================
   CONTENEDORES PRINCIPALES
============================================ */

#loginView {
  max-width:420px;
  margin:8vh auto;
  padding:22px;
}

#appView {
  max-width:1100px;
  margin:0 auto;
  padding:12px;
}

main.layout {
  max-width:1100px;
  margin:0 auto;
  display:grid;
  grid-template-columns:1fr;
  gap:12px;
}

header.topbar {
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:12px;
  max-width:1100px;
  margin-left:auto;
  margin-right:auto;
  padding:0 12px;
}

/* ============================================
   COMPONENTES GENERALES
============================================ */

.card{
  background:var(--card);
  border:0;
  border-radius:var(--radius-md);
  padding:12px;
  margin:0;
  box-shadow:0 4px 12px rgba(0,0,0,0.06);
}

.hidden{display:none !important}

label{
  display:flex;
  flex-direction:column;
  gap:6px;
  color:var(--muted);
  font-size:12px;
  font-weight:500;
}

input, select, textarea{
  min-height:36px;
  padding:8px 10px;
  border-radius:var(--radius-sm);
  border:1px solid var(--line);
  background:var(--card);
  color:var(--text);
  outline:none;
  font-size:13px;
}

input::placeholder, textarea::placeholder{
  color:#9ca3af;
}

input:focus, select:focus, textarea:focus{
  border-color:var(--btn);
  box-shadow:0 0 0 2px rgba(43,76,126,0.12);
}

textarea{min-height:40px;resize:vertical}

button{
  min-height:36px;
  padding:8px 12px;
  border:0;
  border-radius:var(--radius-sm);
  background:var(--btn);
  color:#ffffff;
  cursor:pointer;
  font-weight:600;
  transition: filter 0.15s ease, box-shadow 0.15s ease;
}

button.primary{background:var(--btn)}

button.ghost{
  background:#ffffff;
  border:1px solid var(--line);
  color:var(--text);
}

button.danger{
  background:#fee2e2;
  color:#991b1b;
  border:1px solid #fecaca;
}

button.danger:hover{
  background:#fecaca;
}

button:hover{
  filter:brightness(1.03);
  box-shadow:0 2px 6px rgba(0,0,0,0.1);
}

.row{
  display:flex;
  gap:10px;
  align-items:flex-end;
  justify-content:space-between;
  flex-wrap:wrap;
}

.muted{
  color:var(--muted);
  margin:6px 0 0;
}

.err{
  color:var(--err);
  margin-top:10px;
}

.grid2{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
}

/* ============================================
   SEGMENTOS (TRAMOS)
============================================ */

.seg{
  border:2px solid var(--calendar-border-strong);
  border-radius:var(--radius-sm);
  padding:10px;
  margin:10px 0;
  background:var(--card);
  box-shadow:0 1px 4px rgba(0,0,0,0.06);
  position:relative;
  z-index:0;
  transition:box-shadow 0.12s, border-color 0.12s, transform 0.08s;
}

.seg.open{
  z-index:2000;
}

.seg.seg-editing{
  border-color:var(--warning);
}

.seg.seg-correct{
  border-color:var(--success);
}

.seg:hover{
  background:#f9fbff;
  box-shadow:0 4px 12px rgba(0,0,0,0.08);
  border-color:var(--calendar-border-strong);
  transform:translateY(-1px);
}

.seg.seg-editing:hover{
  border-color:var(--warning);
}

.seg.seg-correct:hover{
  border-color:var(--success);
}

.segTop{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:flex-end;
}

.seg textarea,
.seg textarea[data-k="notes"]{
  display:none;
}

.small{width:140px}

.wide{
  min-width:280px;
  flex:1;
}

.totals{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-top:12px;
  gap:10px;
  flex-wrap:wrap;
}

/* Modal cambio de contraseña */
.modal{
  position:fixed;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(0,0,0,0.28);
  z-index:9999;
  padding:20px;
}
.modal.hidden{display:none !important;}
.modal .modal-content{max-width:420px;width:100%;}
.validation{color:var(--muted);margin-top:8px}

.userbox{
  display:flex;
  gap:10px;
  align-items:center;
  color:var(--muted);
}

/* ============================================
   BOTÃ“N AÃ‘ADIR TRAMO
============================================ */

#addSeg{
  width:100%;
  margin-top:10px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  background:#ffffff;
  color:var(--brand);
  border:1px solid var(--line);
  border-radius:var(--radius-sm);
  padding:8px 12px;
  font-weight:700;
  cursor:pointer;
  transition:background 0.15s ease;
}

#addSeg:hover{
  filter:brightness(1.08);
}

#addSeg:active{
  transform:translateY(1px);
}

#addSeg:disabled{
  opacity:0.55;
  cursor:not-allowed;
  transform:none;
}

/* ============================================
   ACTIVITY PICKER (MENÃš SELECCIONAR ACTIVIDAD)
============================================ */

.pick{
  position:relative;
}

.pickBtn{
  width:100%;
  text-align:left;
  padding:8px 10px;
  border-radius:var(--radius-sm);
  border:1px solid var(--line);
  background:var(--card);
  color:var(--text);
  font-weight:600;
  cursor:pointer;
  min-height:36px;
  transition:background 0.12s ease;
}

.pickBtn:hover{
  background:#f9fbff;
}

.pickBtn.empty{
  color:var(--muted);
  font-weight:600;
}

.pickMenu{
  position:absolute;
  z-index:3000;
  left:0;
  right:0;
  top:calc(100% + 6px);
  background:var(--card);
  border:1px solid var(--line);
  border-radius:var(--radius-sm);
  box-shadow:0 8px 24px rgba(0,0,0,0.08);
  padding:6px;
  max-height:280px;
  overflow:auto;
}

.pickItem{
  width:100%;
  text-align:left;
  padding:8px 9px;
  border:none;
  background:transparent;
  border-radius:var(--radius-sm);
  cursor:pointer;
  color:var(--text);
  transition:background 0.15s ease;
}

.pickItem:hover{
  background:var(--brand-soft);
}

.pickItem:disabled{
  opacity:0.45;
  cursor:not-allowed;
}

.pickItem:focus{
  outline:none;
}

.pickItem.active{
  font-weight:700;
  background:var(--brand-soft);
  color:var(--brand);
}

/* Ajuste del botón de login dentro de la vista de login */
#loginView #loginBtn{
  margin-top:14px;
  display:block;
  width:100%;
  padding:10px 14px;
}

.pickPlaceholder{
  color:var(--muted);
}

select option[value=""] {
  color:var(--muted);
}

/* ============================================
   CALENDARIO DEL MES
============================================ */

#calendarCard {
  border:1px solid var(--calendar-border-strong);
  border-radius:16px;
  box-shadow:0 4px 12px rgba(0,0,0,0.06);
  background:var(--card);
  color:var(--text);
}

#calendarCard h3 {
  margin:0 0 6px 0;
  color:var(--brand);
  font-size:14px;
  letter-spacing:0.2px;
}

.calendar-nav {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:6px;
  margin-bottom:8px;
}

.calendar-nav button {
  min-height:30px;
  padding:5px 7px !important;
  font-size:12px !important;
  min-width:28px;
  white-space:nowrap;
  background:#ffffff;
  color:var(--brand);
  border:1px solid var(--line);
}

.calendar-help {
  margin:0 0 8px 0;
  font-size:11px;
  color:var(--muted);
}

#monthTitle {
  flex:1;
  text-align:center;
  font-size:13px;
  color:var(--brand);
  font-weight:600;
  min-width:88px;
  letter-spacing:0.2px;
}

#calendarGrid {
  display:block !important;
  width:100% !important;
  overflow:visible !important;
  background:var(--panel);
  border:2px solid var(--calendar-border-strong);
  border-radius:8px;
  padding:10px;
  box-shadow:inset 0 1px 0 rgba(0,0,0,0.02);
  text-align:center;
}

.calendar-actions {
  margin-top:8px;
  padding:8px;
  border:1px solid var(--line);
  border-radius:8px;
  background:var(--panel);
}

#calendarActionText {
  display:block;
  margin-bottom:6px;
  font-size:11px;
  color:var(--muted);
}

.calendar-actions-row {
  display:flex;
  gap:6px;
  flex-wrap:wrap;
}

.calendar-actions-row button {
  min-height:28px;
  padding:5px 9px !important;
  font-size:11px !important;
}

.gh-calendar{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:6px;
  margin:0 auto;
}

.gh-xaxis{
  display:grid;
  grid-template-columns:repeat(7,var(--gh-cell-size));
  gap:4px;
}

.gh-day-label{
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:10px;
  line-height:1;
  color:#374151;
}

.gh-day-label.weekend{
  color:#6b7280;
}

.gh-weeks{
  display:grid;
  grid-template-columns:repeat(7,var(--gh-cell-size));
  grid-auto-rows:var(--gh-cell-size);
  gap:4px;
}

.gh-cell{
  width:var(--gh-cell-size);
  height:var(--gh-cell-size);
  border-radius:2px;
  border:1px solid transparent;
  background:#ebedf0;
  padding:0;
  min-height:0;
  cursor:pointer;
  box-shadow:none;
  font-size:10px;
  line-height:1;
  font-weight:600;
  color:#334155;
}

.gh-cell:hover{
  filter:none;
  transform:scale(1.08);
  box-shadow:0 0 0 1px rgba(43,76,126,0.3);
}

.gh-cell.empty{
  background:#ebedf0;
  border-color:#e2e8f0;
}

.gh-cell.partial{
  background:#fdba74;
  border-color:#fb923c;
  color:#14532d;
}

.gh-cell.complete{
  background:#216e39;
  border-color:#1d6032;
  color:#ffffff;
}

.gh-cell.weekend.empty{
  background:#f1f3f5;
}

.gh-cell.unselectable{
  background:var(--empty);
  border-color:var(--line);
  color:var(--muted);
  cursor:not-allowed;
  opacity:.45;
  font-weight:400;
}

.gh-cell.unselectable:hover{
  transform:none;
  box-shadow:none;
}

.gh-cell.today{
  box-shadow:0 0 0 2px #2b4c7e;
}

.gh-cell.spacer{
  visibility:hidden;
  pointer-events:none;
}

.calendar-legend {
  margin-top:8px;
  font-size:11px;
  color:var(--muted);
  display:flex;
  gap:12px;
  flex-wrap:wrap;
}

.calendar-legend > div {
  display:flex;
  align-items:center;
  gap:3px;
}

.legend-item {
  display:inline-block;
  width:11px;
  height:11px;
  border-radius:2px;
  border:1px solid transparent;
}

.legend-item.complete {
  background:#216e39;
  border-color:#1d6032;
}

.legend-item.partial {
  background:#fdba74;
  border-color:#fb923c;
}

.legend-item.empty {
  background:#ebedf0;
  border-color:#e2e8f0;
}

.legend-item.unselectable {
  background:var(--empty);
  border-color:var(--line);
}

/* ============================================
   VALIDACIÃ“N Y MENSAJES
============================================ */

.validation{
  color:var(--muted);
  font-size:12px;
  margin:var(--space-1) 0 0 0;
}

.error{
  color:var(--err);
}

.success{
  color:var(--success);
}

/* ============================================
   TOTAL HORAS
============================================ */

.total{
  color:var(--muted);
  margin:6px 0 0;
  font-size:13px;
}

.total strong{
  color:var(--text);
  font-weight:700;
}

.report-filters{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(180px, 1fr));
  gap:10px;
  margin-bottom:10px;
}

.report-check{
  display:flex;
  flex-direction:row;
  align-items:center;
  gap:8px;
  margin:4px 0 10px;
  font-size:12px;
}

.report-check input[type="checkbox"]{
  min-height:16px;
  width:16px;
  height:16px;
}
