/* ============================================================
   main.css — Estilos de la app Calendario Video Bluecell
   ============================================================ */

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

/* ── Variables ── */
:root {
  --bg-primary: #f6f8ff;
  --bg-secondary: #ffffff;
  --bg-card: rgba(0, 0, 0, 0.02);
  --bg-card-hover: rgba(108, 99, 255, 0.06);
  --border: #e3e5f0;
  --border-strong: #c8cadc;

  --accent: #6C63FF;
  --accent-2: #00A8C0;
  --accent-grad: linear-gradient(135deg, #6C63FF 0%, #00BCD4 100%);
  --danger: #d93025;
  --success: #1e8e3e;

  --text-primary: #202124;
  --text-secondary: #5f6368;
  --text-muted: #9aa0a6;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --shadow-sm: 0 1px 6px rgba(0, 0, 0, .08);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, .10);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .14);
  --shadow-accent: 0 4px 20px rgba(108, 99, 255, .22);

  --header-h: 60px;
  --legend-h: 42px;
  --transition: .18s cubic-bezier(.4, 0, .2, 1);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden
}

a {
  color: var(--accent);
  text-decoration: none
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(108, 99, 255, .12), transparent),
    radial-gradient(ellipse 60% 40% at 90% 100%, rgba(0, 188, 212, .08), transparent),
    var(--bg-primary);
  padding: 24px;
}

.login-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-md);
  animation: fadeInUp .4s ease both;
}

.login-logo {
  text-align: center;
  margin-bottom: 36px
}

.logo-icon {
  width: 64px;
  height: 64px;
  background: var(--accent-grad);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 28px;
  box-shadow: var(--shadow-accent);
}

.login-logo h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -.5px;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-logo p {
  color: var(--text-secondary);
  font-size: .875rem;
  margin-top: 6px
}

/* Google sign-in button */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 13px 20px;
  background: #fff;
  color: #3c4043;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9375rem;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  margin-bottom: 16px;
}

.btn-google:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
  transform: translateY(-1px)
}

.btn-google:active {
  transform: translateY(0)
}

.btn-google:disabled {
  opacity: .4;
  cursor: not-allowed;
  transform: none
}

.login-hint {
  font-size: .8rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5
}

.login-hint strong {
  color: var(--text-secondary)
}

.login-error {
  background: rgba(217, 48, 37, .07);
  border: 1px solid rgba(217, 48, 37, .2);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: .875rem;
  margin-bottom: 20px;
}

/* Setup banner (cuando no hay Client ID) */
.setup-banner {
  position: fixed;
  inset: 0;
  background: rgba(30, 30, 60, .45);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.setup-banner-inner {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  max-width: 600px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}

.setup-banner-inner h2 {
  font-size: 1.25rem;
  margin-bottom: 12px
}

.setup-banner-inner p {
  color: var(--text-secondary);
  margin-bottom: 16px;
  font-size: .9rem;
  line-height: 1.6
}

.setup-banner-inner ol {
  padding-left: 20px;
  color: var(--text-secondary);
  font-size: .875rem;
  line-height: 2
}

.setup-banner-inner code {
  background: rgba(108, 99, 255, .10);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: .8rem
}

.setup-banner-inner a {
  color: var(--accent-2);
  text-decoration: underline
}

/* ============================================================
   DASHBOARD PAGE
   ============================================================ */
.dashboard-page {
  display: grid;
  grid-template-rows: var(--header-h) var(--legend-h) 1fr;
  grid-template-areas: "header" "legend" "main";
  min-height: 100vh;
}

/* ── Header ── */
.dash-header {
  grid-area: header;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.dash-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0
}

.logo-mark {
  width: 36px;
  height: 36px;
  background: var(--accent-grad);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 2px 10px rgba(108, 99, 255, .28);
}

.logo-text strong {
  display: block;
  font-size: .8125rem;
  font-weight: 700;
  color: var(--text-primary);
}

.logo-text span {
  font-size: .68rem;
  color: var(--text-secondary)
}

.dash-header-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.month-label {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -.2px;
  color: var(--text-primary);
  min-width: 195px;
  text-align: center;
}

.nav-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.nav-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border);
  color: var(--text-primary);
}

.btn-today {
  padding: 5px 14px;
  border-radius: 20px;
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  font-size: .8rem;
  font-weight: 600;
  transition: all var(--transition);
  letter-spacing: .01em;
}

.btn-today:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.dash-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0
}

.btn-signout {
  padding: 6px 14px;
  border-radius: 20px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: .78rem;
  font-weight: 600;
  transition: all var(--transition);
}

.btn-signout:hover {
  background: rgba(217, 48, 37, .07);
  border-color: rgba(217, 48, 37, .25);
  color: var(--danger)
}

/* ── Leyenda del equipo ── */
.team-legend {
  grid-area: legend;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 20px;
  background: rgba(255, 255, 255, .80);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}

.team-legend::-webkit-scrollbar {
  display: none
}

.legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px 3px 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.legend-chip:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.legend-avatar {
  width: 20px;
  height: 20px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .58rem;
  font-weight: 700;
  color: #fff;
}

/* ── Main ── */
.dash-main {
  grid-area: main;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
}

/* ============================================================
   CALENDAR GRID
   ============================================================ */
.cal-grid-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cal-grid-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  flex-shrink: 0;
}

.cal-header-cell {
  text-align: center;
  padding: 9px 4px;
  font-size: .7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.cal-grid-body {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: 1fr;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* ── Day cell ── */
.cal-cell {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 6px 5px 4px;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  transition: background var(--transition);
  background: var(--bg-secondary);
}

.cal-cell:nth-child(7n) {
  border-right: none
}

.cal-cell--other {
  background: #fafbff;
  opacity: .65
}

.cal-cell--today {
  background: rgba(108, 99, 255, .04)
}

.cal-cell:hover {
  background: rgba(108, 99, 255, .03)
}

.cal-day-num {
  font-size: .72rem;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1;
  margin-bottom: 3px;
  padding-left: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
}

.cal-day-num--today {
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-weight: 700;
}

.cal-events {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden
}

/* ── Event chip ── */
.cal-event-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  background: rgba(108, 99, 255, .09);
  border-left: 3px solid var(--accent);
  border-radius: 0 4px 4px 0;
  padding: 2px 5px 2px 4px;
  cursor: pointer;
  transition: all var(--transition);
  overflow: hidden;
  min-width: 0;
}

.cal-event-chip:hover {
  background: rgba(108, 99, 255, .18);
  transform: translateX(1px);
}

.chip-time {
  font-size: .65rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
  opacity: .85;
}

.chip-title {
  font-size: .7rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.chip-attendees {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

.chip-avatar {
  width: 15px;
  height: 15px;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .5rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.cal-overflow {
  font-size: .65rem;
  color: var(--accent);
  font-weight: 600;
  padding: 1px 4px 1px 7px;
  cursor: default;
  opacity: .75;
}

/* ── Loading / Error states ── */
.cal-loading,
.cal-error {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-secondary);
  font-size: .9rem;
  grid-column: 1/-1;
}

.cal-error {
  color: var(--danger)
}

.cal-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* ============================================================
   POPOVER DE DETALLE DE EVENTO
   ============================================================ */
.cal-popover {
  position: fixed;
  z-index: 500;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  width: 290px;
  box-shadow: var(--shadow-lg);
  animation: fadeInUp .15s ease both;
}

.pop-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.pop-close:hover {
  background: var(--bg-card-hover);
  border-color: var(--border);
  color: var(--text-primary)
}

.pop-title {
  font-size: .9375rem;
  font-weight: 700;
  margin-bottom: 6px;
  padding-right: 30px;
  line-height: 1.3;
  color: var(--text-primary);
}

.pop-date {
  font-size: .775rem;
  color: var(--text-secondary);
  margin-bottom: 10px;
  line-height: 1.4;
  text-transform: capitalize
}

.pop-desc {
  font-size: .775rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.5
}

.pop-section-label {
  font-size: .66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 7px
}

.pop-members {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px
}

.pop-member {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .775rem;
  font-weight: 500;
  color: var(--text-primary);
}

.pop-avatar {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .6rem;
  font-weight: 700;
  color: #fff;
}

.pop-link {
  display: block;
  font-size: .775rem;
  font-weight: 600;
  color: var(--accent);
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 4px;
  transition: color var(--transition);
}

.pop-link:hover {
  color: var(--accent-2);
  text-decoration: underline
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg)
  }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media(max-width:700px) {
  .dash-header-left .logo-text {
    display: none
  }

  .month-label {
    min-width: 140px;
    font-size: .9rem
  }

  .cal-cell {
    min-height: 72px;
    padding: 4px 2px
  }

  .chip-title {
    font-size: .62rem
  }

  .cal-popover {
    width: calc(100vw - 32px);
    left: 16px !important
  }
}

/* ============================================================
   BOTÓN NUEVO EVENTO (HEADER)
   ============================================================ */
.btn-new-event {
  padding: 7px 16px;
  border-radius: 20px;
  background: var(--accent);
  color: #fff;
  font-size: .8125rem;
  font-weight: 600;
  border: none;
  box-shadow: 0 2px 8px rgba(108, 99, 255, .28);
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-new-event:hover {
  background: #5a52e0;
  box-shadow: 0 4px 16px rgba(108, 99, 255, .40);
  transform: translateY(-1px);
}

.btn-new-event:active {
  transform: translateY(0);
}

/* ============================================================
   MODAL NUEVO EVENTO
   ============================================================ */
.event-modal {
  position: fixed;
  inset: 0;
  background: rgba(30, 30, 60, .40);
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.event-modal.open {
  opacity: 1;
  pointer-events: all;
}

.event-modal-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 28px 24px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  animation: fadeInUp .2s ease both;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

/* ── Header del modal ── */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.modal-title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--bg-card-hover);
  border-color: var(--border);
  color: var(--text-primary);
}

/* ── Formulario ── */
.event-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-row label {
  font-size: .76rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: .02em;
}

.form-row .required {
  color: var(--danger);
}

.form-row input[type="text"],
.form-row input[type="date"],
.form-row input[type="time"],
.form-row textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: .875rem;
  color: var(--text-primary);
  background: var(--bg-secondary);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-row input:focus,
.form-row textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, .12);
}

.form-row textarea {
  resize: vertical;
  min-height: 72px;
}

/* ── Toggle todo el día ── */
.form-toggle {
  display: flex;
  align-items: center;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-primary);
  user-select: none;
}

.toggle-label input[type="checkbox"] {
  display: none;
}

.toggle-track {
  width: 36px;
  height: 20px;
  background: var(--border-strong);
  border-radius: 10px;
  position: relative;
  transition: background var(--transition);
  flex-shrink: 0;
}

.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
  transition: transform var(--transition);
}

.toggle-label input:checked + .toggle-track {
  background: var(--accent);
}

.toggle-label input:checked + .toggle-track .toggle-thumb {
  transform: translateX(16px);
}

/* ── Campos de hora ── */
.time-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form-row--half {
  min-width: 0;
}

/* ── Asistentes ── */
.attendee-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.attendee-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 6px;
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}

.attendee-chip input[type="checkbox"] {
  display: none;
}

.attendee-chip:hover {
  border-color: var(--accent);
  background: rgba(108, 99, 255, .05);
}

.attendee-chip:has(input:checked) {
  border-color: var(--accent);
  background: rgba(108, 99, 255, .10);
}

.attendee-avatar {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .6rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.attendee-name {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* ── Error del formulario ── */
.form-error {
  background: rgba(217, 48, 37, .08);
  border: 1px solid rgba(217, 48, 37, .2);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: .82rem;
  line-height: 1.4;
}

/* ── Botones de acción ── */
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 6px;
}

.btn-cancel {
  padding: 9px 18px;
  border-radius: 20px;
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
  font-size: .875rem;
  font-weight: 600;
  transition: all var(--transition);
}

.btn-cancel:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.btn-primary {
  padding: 9px 20px;
  border-radius: 20px;
  background: var(--accent);
  color: #fff;
  font-size: .875rem;
  font-weight: 600;
  border: none;
  box-shadow: 0 2px 8px rgba(108, 99, 255, .28);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-primary:hover:not(:disabled) {
  background: #5a52e0;
  box-shadow: 0 4px 14px rgba(108, 99, 255, .38);
}

.btn-primary:disabled {
  opacity: .6;
  cursor: not-allowed;
}
