/* ══════════════════════════════════════
   JOSC Portal — styles.css
   Fuente: Cormorant Garamond + DM Sans
   Paleta: dorado oscuro sobre crema/blanco
══════════════════════════════════════ */

:root {
  --gold:        #B8960C;
  --gold-light:  #F5E6A3;
  --gold-dim:    rgba(184,150,12,0.18);
  --gold-border: rgba(184,150,12,0.35);
  --dark:        #1A1612;
  --dark2:       #2C2620;
  --mid:         #5C5040;
  --cream:       #FAF8F2;

  --bg:          #F7F5EF;
  --surface:     #FFFFFF;
  --surface2:    #F3F1EB;
  --border:      rgba(0,0,0,0.1);
  --border-mid:  rgba(0,0,0,0.15);
  --text:        #1A1612;
  --text-mid:    #5C5040;
  --text-faint:  #9A8E7E;

  --radius:      10px;
  --radius-lg:   14px;
  --sidebar-w:   220px;
  --header-h:    58px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
}

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

html, body {
  height: 100%;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ────────────────────────────
   LOGIN
──────────────────────────── */
.login-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--dark2);
  padding: 2rem;
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.login-logo { margin-bottom: 1rem; }

.login-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 26px;
  font-weight: 600;
  color: var(--dark2);
  margin-bottom: 4px;
}

.login-sub {
  font-size: 12px;
  color: var(--text-faint);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 2rem;
  text-align: center;
}

.login-error {
  background: #FEE;
  border: 1px solid #F5C0C0;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  color: #A33;
  width: 100%;
  margin-bottom: 1rem;
  text-align: center;
}

.field-group { width: 100%; margin-bottom: 1rem; }
.field-label { display: block; font-size: 12px; font-weight: 500; color: var(--text-mid); margin-bottom: 5px; }

.field-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s;
  outline: none;
}
.field-input:focus { border-color: var(--gold); }

.btn-primary {
  width: 100%;
  padding: 11px;
  background: var(--dark2);
  color: var(--gold-light);
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  margin-top: 0.5rem;
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.85; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.forgot-link {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 1rem;
  transition: color 0.15s;
}
.forgot-link:hover { color: var(--gold); }

.login-footer {
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  margin-top: 2rem;
  text-align: center;
}

/* ────────────────────────────
   HEADER
──────────────────────────── */
.app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.header {
  height: var(--header-h);
  background: var(--dark2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--gold-border);
  flex-shrink: 0;
  z-index: 100;
}

.header-left { display: flex; align-items: center; gap: 1rem; }
.header-right { display: flex; align-items: center; gap: 1rem; }

.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  padding: 6px;
}
.menu-toggle span { display: block; width: 20px; height: 1.5px; background: var(--gold-light); }

.header-brand { display: flex; align-items: center; gap: 10px; }
.brand-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--gold-light);
  letter-spacing: 0.04em;
}

.user-badge { display: flex; align-items: center; gap: 10px; }

.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--gold-dim);
  border: 1px solid var(--gold-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 500;
  color: var(--gold-light);
}

.user-info { display: flex; flex-direction: column; }
.user-name { font-size: 13px; font-weight: 500; color: var(--gold-light); }
.user-role { font-size: 11px; color: rgba(245,230,163,0.5); text-transform: capitalize; }

.btn-logout {
  background: none;
  border: 1px solid var(--gold-border);
  border-radius: 8px;
  color: var(--gold-light);
  padding: 6px 10px;
  font-size: 14px;
  transition: background 0.15s;
}
.btn-logout:hover { background: var(--gold-dim); }

/* ────────────────────────────
   LAYOUT
──────────────────────────── */
.layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ────────────────────────────
   SIDEBAR
──────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--dark);
  flex-shrink: 0;
  padding: 1.5rem 0;
  overflow-y: auto;
  border-right: 1px solid rgba(184,150,12,0.2);
}

.nav-list { list-style: none; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 1.5rem;
  font-size: 13px;
  color: rgba(245,230,163,0.55);
  transition: color 0.15s, background 0.15s;
}
.nav-link:hover { color: var(--gold-light); background: rgba(184,150,12,0.08); }
.nav-link.active { color: var(--gold-light); background: rgba(184,150,12,0.14); border-right: 2px solid var(--gold); }

.nav-icon { font-size: 15px; }
.nav-divider { height: 1px; background: rgba(184,150,12,0.15); margin: 0.75rem 1.5rem; }

/* ────────────────────────────
   MAIN
──────────────────────────── */
.main {
  flex: 1;
  overflow-y: auto;
  padding: 2rem;
  background: var(--bg);
}

.section { display: none; }
.section.active { display: block; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 26px;
  font-weight: 600;
  color: var(--text);
}
.page-sub { font-size: 13px; color: var(--text-faint); margin-top: 2px; }

/* ────────────────────────────
   CARDS & GRIDS
──────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.card-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

/* ────────────────────────────
   BOTONES
──────────────────────────── */
.btn-secondary {
  padding: 9px 18px;
  background: var(--dark2);
  color: var(--gold-light);
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  transition: opacity 0.15s;
}
.btn-secondary:hover { opacity: 0.85; }

.btn-sync {
  width: 100%;
  margin-top: 1.25rem;
  padding: 10px;
  background: none;
  border: 1px solid var(--gold-border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--mid);
  transition: background 0.15s, color 0.15s;
}
.btn-sync:hover { background: var(--gold-dim); color: var(--dark2); }

/* ────────────────────────────
   CALENDARIO
──────────────────────────── */
.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.cal-month-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
  font-weight: 600;
}
.cal-btn {
  background: none;
  border: 1px solid var(--border-mid);
  border-radius: 8px;
  padding: 4px 12px;
  font-size: 18px;
  color: var(--text-mid);
  transition: background 0.1s;
}
.cal-btn:hover { background: var(--surface2); }

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 4px;
}
.cal-weekdays span {
  text-align: center;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-faint);
  padding: 4px 0;
}

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

.cal-day {
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text);
  position: relative;
  transition: background 0.1s;
}
.cal-day:hover { background: var(--surface2); }
.cal-day.empty { color: transparent; cursor: default; pointer-events: none; }
.cal-day.today { background: #E8F0FE; color: #185EA5; font-weight: 500; }
.cal-day.has-event::after {
  content: '';
  position: absolute; bottom: 3px;
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--gold);
}
.cal-day.selected { background: var(--dark2); color: var(--gold-light); }

/* ────────────────────────────
   EVENTOS
──────────────────────────── */
.event-list { display: flex; flex-direction: column; gap: 0; }

.event-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.event-item:last-child { border-bottom: none; }

.event-date-box {
  min-width: 44px; height: 44px;
  background: var(--surface2);
  border-radius: var(--radius);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.event-date-box strong { font-size: 17px; font-weight: 500; line-height: 1.1; }
.event-date-box span { font-size: 10px; color: var(--text-faint); }

.event-info { flex: 1; min-width: 0; }
.event-name { font-size: 14px; font-weight: 500; }
.event-meta { font-size: 12px; color: var(--text-faint); margin-top: 2px; }

.event-tag {
  display: inline-block;
  font-size: 11px; padding: 2px 8px;
  border-radius: 10px; margin-top: 4px;
}
.tag-ensayo   { background: #E8F0FE; color: #185EA5; }
.tag-concierto { background: rgba(184,150,12,0.15); color: #7A6208; }
.tag-reunion  { background: #E6F4EA; color: #1E6E35; }

/* ────────────────────────────
   TABLÓN
──────────────────────────── */
.anuncio-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}
.anuncio-item.urgente { border-left-color: #C0392B; }
.anuncio-item.info    { border-left-color: #2980B9; }

.anuncio-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.avatar-circle {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 500;
  background: var(--gold-dim); color: var(--dark2);
  flex-shrink: 0;
}
.anuncio-autor { font-size: 13px; font-weight: 500; }
.anuncio-fecha { font-size: 11px; color: var(--text-faint); margin-left: auto; }
.anuncio-asunto { font-size: 15px; font-weight: 500; margin-bottom: 5px; }
.anuncio-texto { font-size: 13px; color: var(--text-mid); line-height: 1.65; }

.badge-urgente {
  display: inline-block;
  font-size: 10px; padding: 2px 8px;
  background: #FEECEC; color: #C0392B;
  border-radius: 10px; margin-bottom: 6px;
}

/* ────────────────────────────
   DOCUMENTOS
──────────────────────────── */
.filter-row {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.filter-btn {
  padding: 6px 16px; font-size: 12px;
  border: 1px solid var(--border-mid); border-radius: 20px;
  background: none; color: var(--text-mid);
  transition: all 0.1s; cursor: pointer;
}
.filter-btn.active { background: var(--dark2); color: var(--gold-light); border-color: var(--dark2); }
.filter-btn:hover:not(.active) { background: var(--surface2); }

.doc-list { display: flex; flex-direction: column; gap: 0.5rem; }

.doc-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 1.25rem;
  cursor: pointer;
  transition: background 0.1s, box-shadow 0.1s;
  text-decoration: none; color: inherit;
}
.doc-item:hover { background: var(--surface2); box-shadow: var(--shadow-sm); }

.doc-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.doc-icon.pdf { background: rgba(220,60,60,0.1); }
.doc-icon.mus { background: rgba(184,150,12,0.12); }
.doc-icon.img { background: rgba(40,160,80,0.1); }
.doc-icon.doc { background: rgba(40,80,200,0.1); }

.doc-name { font-size: 14px; font-weight: 500; }
.doc-meta { font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.doc-size { font-size: 11px; color: var(--text-faint); margin-left: auto; white-space: nowrap; flex-shrink: 0; }

.doc-role-badge {
  font-size: 10px; padding: 2px 7px;
  border-radius: 8px; margin-left: 8px;
  background: var(--gold-dim); color: var(--dark2);
}

.drive-note {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: var(--surface2); border-radius: var(--radius);
  font-size: 12px; color: var(--text-faint);
  margin-top: 1rem;
}

/* ────────────────────────────
   HERRAMIENTAS
──────────────────────────── */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.tool-card:hover { border-color: var(--gold-border); box-shadow: var(--shadow-sm); }

.tool-icon { font-size: 32px; margin-bottom: 10px; }
.tool-name { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.tool-desc { font-size: 12px; color: var(--text-faint); line-height: 1.5; }

.tool-area { margin-top: 0; }

/* Metrónomo */
.metro-display {
  background: var(--dark2);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  color: var(--gold-light);
  margin-bottom: 1rem;
}
.metro-bpm {
  font-family: 'Cormorant Garamond', serif;
  font-size: 72px; font-weight: 600; line-height: 1;
}
.metro-label { font-size: 11px; letter-spacing: 0.15em; text-transform: uppercase; opacity: 0.5; margin-top: 4px; }
.metro-needle-wrap { height: 60px; display: flex; align-items: flex-end; justify-content: center; margin: 1rem 0; }
.metro-needle {
  width: 4px; height: 55px; background: var(--gold);
  border-radius: 2px; transform-origin: bottom center;
  transition: transform 0.08s linear;
}
.metro-controls { display: flex; align-items: center; gap: 10px; justify-content: center; }
.metro-btn {
  background: none; border: 1px solid var(--border-mid);
  border-radius: var(--radius); padding: 8px 14px; font-size: 13px; color: var(--text-mid);
  transition: background 0.1s;
}
.metro-btn:hover { background: var(--surface2); }
.metro-start {
  background: var(--gold); color: var(--dark);
  border: none; border-radius: var(--radius);
  padding: 10px 28px; font-size: 14px; font-weight: 500;
  transition: opacity 0.15s;
}
.metro-start:hover { opacity: 0.85; }

/* ────────────────────────────
   ADMIN - TABLA USUARIOS
──────────────────────────── */
.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.users-table th {
  text-align: left;
  padding: 8px 12px;
  font-weight: 500;
  font-size: 12px;
  color: var(--text-faint);
  border-bottom: 1px solid var(--border-mid);
}
.users-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.users-table tr:last-child td { border-bottom: none; }
.users-table tr:hover td { background: var(--surface2); }

.role-badge {
  display: inline-block;
  font-size: 11px; padding: 2px 9px;
  border-radius: 10px; font-weight: 500;
}
.role-admin    { background: rgba(184,150,12,0.2); color: #7A6208; }
.role-director { background: #E8F0FE; color: #185EA5; }
.role-junta    { background: #E6F4EA; color: #1E6E35; }
.role-musico   { background: #F3F1EB; color: #5C5040; }

.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block; margin-right: 6px;
}
.status-active { background: #3AB56B; }
.status-inactive { background: #CCC; }

.btn-table {
  background: none; border: none; color: var(--text-faint);
  font-size: 13px; cursor: pointer; padding: 4px 8px;
  border-radius: 6px; transition: background 0.1s;
}
.btn-table:hover { background: var(--surface2); color: var(--text); }

/* ────────────────────────────
   MODAL
──────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 480px;
  box-shadow: var(--shadow-md);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; font-weight: 500; }
.modal-close {
  background: none; border: none; font-size: 18px;
  color: var(--text-faint); cursor: pointer;
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
}
.modal-close:hover { background: var(--surface2); color: var(--text); }
.modal-body { padding: 1.5rem; }

.modal-field { margin-bottom: 1rem; }
.modal-label { display: block; font-size: 12px; font-weight: 500; color: var(--text-mid); margin-bottom: 5px; }
.modal-input, .modal-select, .modal-textarea {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border-mid); border-radius: var(--radius);
  font-size: 14px; color: var(--text); background: var(--surface);
  outline: none; transition: border-color 0.15s;
}
.modal-input:focus, .modal-select:focus, .modal-textarea:focus { border-color: var(--gold); }
.modal-textarea { resize: vertical; min-height: 80px; }

.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}
.btn-cancel {
  padding: 9px 18px; background: none;
  border: 1px solid var(--border-mid); border-radius: var(--radius);
  font-size: 13px; color: var(--text-mid); transition: background 0.1s;
}
.btn-cancel:hover { background: var(--surface2); }
.btn-save {
  padding: 9px 20px; background: var(--dark2);
  color: var(--gold-light); border: none;
  border-radius: var(--radius); font-size: 13px; font-weight: 500;
  transition: opacity 0.15s;
}
.btn-save:hover { opacity: 0.85; }

/* ────────────────────────────
   RESPONSIVE
──────────────────────────── */
@media (max-width: 768px) {
  .menu-toggle { display: flex; }
  .sidebar { position: fixed; left: -100%; top: var(--header-h); bottom: 0; z-index: 200; transition: left 0.25s; width: 240px; }
  .sidebar.open { left: 0; box-shadow: var(--shadow-md); }
  .main { padding: 1.25rem; }
  .grid-2 { grid-template-columns: 1fr; }
  .tools-grid { grid-template-columns: repeat(2, 1fr); }
  .user-info { display: none; }
}

@media (max-width: 480px) {
  .tools-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
}

/* ────────────────────────────
   UTILIDADES
──────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-faint);
  font-size: 14px;
}
.empty-state span { font-size: 40px; display: block; margin-bottom: 1rem; }

.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border); border-top-color: var(--gold);
  border-radius: 50%; animation: spin 0.8s linear infinite;
  margin: 2rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
