/* Vacaciones equipo — MarSenses look (tokens from branding/tokens.css) */
@import url("../branding/tokens.css");

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

body {
  font-family: var(--font);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  background-image: var(--page-wave-asset);
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

header.app-header {
  background: transparent;
  border-bottom: none;
  padding: var(--space-lg) var(--space-2xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: var(--header-z);
  box-shadow: none;
  color: var(--header-title-color);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--header-brand-gap);
  min-width: 0;
}

.brand-logo {
  height: auto;
  max-height: var(--header-logo-max-h);
  width: auto;
  max-width: var(--header-logo-max-w);
  object-fit: contain;
  object-position: left center;
  display: block;
  flex-shrink: 0;
  padding: 0;
  margin: 0;
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
}
.brand-logo.is-broken { display: none; }

.brand-wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
  color: #173D78;
}
.brand-wordmark[hidden] { display: none !important; }
.brand-wordmark-stack {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  line-height: 1.1;
}
.brand-name {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-weight: 700;
  font-size: 1.15rem;
  color: #173D78;
}
.brand-tag {
  font-size: 0.55rem;
  font-weight: 650;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #008F96;
}

.brand-divider {
  width: 1px;
  height: 32px;
  background: rgba(23, 61, 120, 0.22);
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.brand h1 {
  font-size: var(--header-title-size);
  font-weight: var(--header-title-weight);
  letter-spacing: var(--header-title-tracking);
  color: var(--header-title-color);
  line-height: 1.2;
}
.brand p {
  font-size: var(--header-subtitle-size);
  color: var(--header-subtitle-color);
  font-weight: 500;
}

.header-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  align-items: center;
}

.who-label {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
}
.who-label select {
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.7rem;
  min-width: 9rem;
  box-shadow: var(--shadow);
}
.who-label select:focus {
  outline: none;
  box-shadow: var(--focus-ring);
  border-color: var(--primary);
}

button {
  font: inherit;
  cursor: pointer;
  border-radius: var(--radius-sm);
  border: 1px solid var(--header-action-border);
  background: var(--surface);
  color: var(--header-action-fg);
  padding: 0.5rem 0.85rem;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.15s, border-color 0.15s;
}
button:hover:not(:disabled) {
  border-color: var(--primary);
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
button.primary {
  background: var(--header-cta-bg);
  color: var(--header-cta-fg);
  border-color: transparent;
}
button.primary:hover:not(:disabled) {
  background: var(--header-cta-hover);
}
button.ghost {
  background: transparent;
  border-color: var(--border);
}
button:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

main {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-2xl) var(--space-3xl);
  position: relative;
  z-index: 1;
}

.app-loading {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
  font-weight: 500;
}
.hidden { display: none !important; }

.legend-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: var(--space-lg);
}
.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.3rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow);
}
.legend-dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  flex-shrink: 0;
}
.legend-chip.is-me {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(0, 166, 166, 0.2);
}

.calendar-panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(6px);
  margin-bottom: var(--space-2xl);
}

.cal-nav {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
}
.cal-nav button {
  min-width: 44px;
  min-height: 44px;
  padding: 0.45rem 0.7rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.cal-title {
  flex: 1;
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  text-transform: capitalize;
  min-width: 10rem;
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.25rem;
  margin-bottom: 0.35rem;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.2rem;
}

.cal-cell {
  min-height: 4.6rem;
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.28rem 0.28rem 0.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  position: relative;
  overflow: hidden;
}
.cal-cell.is-weekend:not(.is-outside) {
  background: rgba(23, 61, 120, 0.04);
}
.cal-cell.is-outside {
  opacity: 0.38;
  background: transparent;
}
.cal-cell.is-outside .cal-daynum {
  color: var(--muted);
  font-weight: 600;
}
.cal-cell.is-today {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 1.5px var(--primary);
  background: rgba(0, 166, 166, 0.08);
}
.cal-cell.is-today .cal-daynum {
  color: var(--primary);
  font-weight: 800;
}
.cal-cell.has-overlap {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(242, 139, 170, 0.4);
  background:
    repeating-linear-gradient(
      -45deg,
      rgba(242, 139, 170, 0.12) 0 4px,
      rgba(242, 139, 170, 0.04) 4px 8px
    );
}
.cal-cell-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.2rem;
  min-height: 1rem;
}
.cal-daynum {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.cal-overlap-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0 0.25rem;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(23, 61, 120, 0.15);
}

/* Continuous range strips — full width so adjacent days read as one range */
.cal-bars {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0.1rem -0.28rem 0; /* bleed to cell edge for continuity across grid gap */
  flex: 1;
  justify-content: flex-end;
  min-height: 0.55rem;
}
.cal-bar {
  display: block;
  height: 5px;
  width: 100%;
  border-radius: 0;
  opacity: 0.92;
}
.cal-bar:first-child { border-top-left-radius: 2px; border-top-right-radius: 2px; }
.cal-bar:last-child { border-bottom-left-radius: 2px; border-bottom-right-radius: 2px; }

.cal-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
  align-items: center;
}
.cal-pill {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  flex-shrink: 0;
}
.cal-pill-label {
  font-size: 0.58rem;
  font-weight: 650;
  color: #fff;
  background: var(--pill-color, var(--primary));
  border-radius: 4px;
  padding: 0.05rem 0.25rem;
  line-height: 1.3;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-dot {
  display: none; /* shown on mobile when labels hide */
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.7);
}

.cal-hint {
  margin-top: var(--space-md);
  font-size: 0.78rem;
  color: var(--muted);
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  line-height: 1.35;
}
.cal-hint-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0 0.25rem;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  flex-shrink: 0;
  margin-top: 0.05rem;
}

.lists-panel {
  margin-bottom: var(--space-3xl);
}
.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--space-md);
}

.person-lists {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-lg);
}

.person-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow);
}
.person-card.is-me {
  border-color: var(--primary);
}
.person-card-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: var(--space-md);
}
.person-card-head h3 {
  font-size: 1rem;
  font-weight: 700;
}
.person-card ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.person-card li {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.55rem;
  font-size: 0.85rem;
}
.vac-range {
  font-weight: 600;
  color: var(--text);
}
.vac-note {
  display: block;
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--muted);
}
.vac-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}
.vac-actions button {
  padding: 0.2rem 0.4rem;
  font-size: 0.75rem;
  min-width: auto;
}
.vac-actions .danger {
  color: var(--danger);
  border-color: transparent;
  background: var(--danger-soft);
}
.empty-list {
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
}

.app-footer {
  position: relative;
  text-align: center;
  padding: var(--space-2xl) var(--space-lg) var(--space-xl);
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: auto;
}
.footer-waves {
  display: block;
  width: min(420px, 90%);
  margin: 0 auto var(--space-sm);
  opacity: 0.85;
}

.sensi-peek {
  position: fixed;
  right: 0.5rem;
  bottom: 0.5rem;
  width: 72px;
  height: auto;
  pointer-events: none;
  z-index: 5;
  opacity: 0.9;
}

.vac-dialog {
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  max-width: 22rem;
  width: calc(100% - 2rem);
  box-shadow: var(--shadow-lg);
  background: var(--surface);
  color: var(--text);
}
.vac-dialog::backdrop {
  background: rgba(23, 61, 120, 0.35);
}
.vac-dialog form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding: var(--space-xl);
}
.vac-dialog h3 {
  font-size: 1.05rem;
  font-weight: 700;
}
.vac-dialog label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}
.vac-dialog input[type="date"],
.vac-dialog input[type="text"] {
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.65rem;
  background: #fff;
}
.vac-dialog input:focus {
  outline: none;
  box-shadow: var(--focus-ring);
  border-color: var(--primary);
}
.form-error {
  color: var(--danger);
  font-size: 0.85rem;
  font-weight: 600;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  font-weight: 600;
  z-index: var(--toast-z);
  box-shadow: var(--shadow-lg);
  max-width: calc(100% - 2rem);
}

@media (max-width: 640px) {
  header.app-header {
    padding: var(--space-md) var(--space-lg);
    align-items: flex-start;
  }
  .brand {
    width: 100%;
  }
  .brand-logo {
    max-height: 56px;
    max-width: 140px;
  }
  .brand-divider {
    height: 28px;
  }
  .header-actions {
    width: 100%;
    justify-content: space-between;
    gap: var(--space-sm);
  }
  .who-label {
    flex: 1;
    min-width: 0;
  }
  .who-label select {
    width: 100%;
    min-width: 0;
    min-height: 44px;
  }
  #btnAdd {
    flex-shrink: 0;
    min-height: 44px;
    white-space: nowrap;
    padding: 0.5rem 0.75rem;
  }
  main {
    padding: var(--space-md) var(--space-md) var(--space-2xl);
  }
  .cal-nav {
    gap: 0.35rem;
  }
  .cal-nav button {
    min-width: 44px;
    min-height: 44px;
  }
  .cal-title {
    font-size: 1rem;
    min-width: 0;
    flex: 1 1 100%;
    order: -1;
    margin-bottom: 0.15rem;
  }
  .cal-grid {
    gap: 0.15rem;
  }
  .cal-cell {
    min-height: 3.5rem;
    padding: 0.18rem 0.15rem 0.12rem;
  }
  .cal-bars {
    margin: 0.08rem -0.15rem 0;
    gap: 1.5px;
  }
  .cal-bar {
    height: 4px;
  }
  .cal-pill-label {
    display: none;
  }
  .cal-dot {
    display: inline-block;
  }
  .cal-pills {
    gap: 0.2rem;
    padding-top: 0.1rem;
  }
  .sensi-peek {
    width: 52px;
    opacity: 0.7;
  }
}
