/* ── PANEL DE CONTROL CSS ── */
:root {
  --bg-deep: #050505;
  --surface: rgba(18, 18, 22, 1);
  --border: rgba(255, 255, 255, 0.1);
  --orange: #FF8533;
  --violet: #B59BFF;
  --text: #ffffff;
  --muted: #a0a0a0;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --radius: 12px;
}

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

body {
  background-color: var(--bg-deep);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

/* ── HEADER ── */
header {
  height: 64px;
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: #000;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left { display: flex; align-items: center; gap: 24px; }

.back-link {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.back-link:hover { color: var(--text); }

.title-group h1 {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  margin-bottom: 2px;
}
.badge-status {
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--orange);
}

.digital-clock {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ── BENTO GRID ── */
main {
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: auto auto auto;
  gap: 20px;
}

.bento-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  position: relative;
}

.widget-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.widget-header h3 {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.icon-orange { color: var(--orange); }
.icon-violet { color: var(--violet); }

/* WIDGET A (Countdown & Calendar) */
.widget-a { grid-column: span 2; }
.widget-row {
  display: flex;
  gap: 20px;
  margin-bottom: 24px;
  align-items: stretch;
}
.column-left { flex: 1.2; display: flex; flex-direction: column; gap: 12px; }
.column-right { flex: 1; }

.countdown-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 16px;
  background: #000;
  border-radius: 8px;
  height: 100%;
}
.countdown-item { display: flex; flex-direction: column; align-items: center; }
.countdown-item span { font-size: 2.2rem; font-weight: 900; line-height: 1; color: #fff; }
.countdown-item label { font-size: 0.55rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; margin-top: 4px; }
.countdown-separator { font-size: 1.2rem; font-weight: 300; opacity: 0.3; }

.training-summary {
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.t-count { font-size: 1.8rem; font-weight: 900; color: var(--violet); }
.t-label { font-size: 0.6rem; font-weight: 800; color: var(--muted); letter-spacing: 0.05em; line-height: 1.2; }

/* MINI CALENDAR */
.mini-calendar {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  height: 100%;
}
.cal-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.cal-title { font-size: 0.7rem; font-weight: 800; text-transform: uppercase; color: #fff; letter-spacing: 0.05em; }
.cal-btn { background: none; border: none; color: var(--muted); cursor: pointer; padding: 4px; font-size: 0.8rem; display: flex; align-items: center; }
.cal-btn:hover { color: #fff; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.cal-day-header { font-size: 0.5rem; font-weight: 800; text-align: center; color: var(--muted); padding-bottom: 4px; }
.cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--muted);
  border: 1px solid transparent;
}
.cal-day:hover { background: rgba(255,255,255,0.05); color: #fff; }
.day-official { background: var(--orange-dim); color: var(--orange); font-weight: 800; border-color: rgba(255,107,0,0.2) !important; }
.day-extra { background: var(--violet-dim); color: var(--violet); font-weight: 800; border-color: rgba(138,43,226,0.2) !important; }
.day-today { border-color: var(--orange) !important; color: #fff; }
.day-past { opacity: 0.2; pointer-events: none; }
.day-empty { pointer-events: none; }

table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
th { text-align: left; padding-bottom: 8px; color: var(--muted); text-transform: uppercase; font-size: 0.65rem; }
td { padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.03); }
.highlight td { color: var(--violet); font-weight: 700; background: rgba(181, 155, 255, 0.05); border-radius: 4px; padding-left: 8px; }

/* WIDGET B (Foco Trabajable - GRID) */
.widget-b { grid-column: span 2; grid-row: span 2; }
.profiles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.profile-card {
  background: #000;
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: 8px;
  position: relative;
}
.btn-delete-card {
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.2);
  cursor: pointer;
  font-size: 0.7rem;
  padding: 4px;
  transition: color 0.2s;
}
.btn-delete-card:hover { color: #ff4444; }
.p-header { 
  font-size: 0.8rem; font-weight: 800; color: var(--orange); margin-bottom: 8px; letter-spacing: 0.05em; 
  display: flex; align-items: center; gap: 10px;
}
.status-indicator {
  width: 12px; height: 12px;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(0,0,0,0.5);
  transition: all 0.3s;
}
.status-indicator.VERDE { background: #45ea8a; box-shadow: 0 0 10px rgba(69, 234, 138, 0.4); }
.status-indicator.AMARILLO { background: #facc15; box-shadow: 0 0 10px rgba(250, 204, 21, 0.4); }
.status-indicator.ROJO { background: #ef4444; box-shadow: 0 0 10px rgba(239, 68, 68, 0.4); }
.status-indicator:hover { transform: scale(1.2); }
.editable-focus {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.4;
  outline: none;
  min-height: 2.8rem;
  padding: 4px;
  border-radius: 4px;
  transition: background 0.2s;
}
.editable-focus:focus {
  background: rgba(255,255,255,0.05);
  color: #fff;
}

/* WIDGET C (Infographic) */
.widget-c { grid-column: span 2; }
.infographic-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.info-card {
  padding: 12px;
  background: #000;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.info-header { font-size: 0.75rem; font-weight: 800; text-transform: uppercase; margin-bottom: 6px; }
.info-body { font-size: 0.7rem; color: var(--muted); }

.alert-red { border-top: 3px solid #cc3333; }
.alert-orange { border-top: 3px solid var(--orange); }
.alert-yellow { border-top: 3px solid #ffcc00; }
.alert-blue { border-top: 3px solid #3366cc; }
.alert-green { border-top: 3px solid #33cc66; }

/* WIDGET D (Doctrine) */
.widget-d { grid-column: span 2; }
.mantra {
  font-size: 1.4rem;
  font-weight: 900;
  text-align: center;
  margin-bottom: 24px;
  letter-spacing: 0.05em;
  color: #fff;
}
.sequence {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
}
.seq-step { 
  display: flex; align-items: center; gap: 8px;
  font-size: 0.7rem; font-weight: 800; color: var(--muted);
}
.seq-step span {
  width: 22px; height: 22px;
  background: var(--violet);
  color: #000;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem;
}
.seq-arrow { font-size: 0.8rem; color: rgba(255,255,255,0.1); }

.crisis-management { display: flex; gap: 12px; }
.crisis-card {
  flex: 1;
  padding: 12px;
  background: #000;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.crisis-card h4 { font-size: 0.65rem; font-weight: 800; color: var(--violet); margin-bottom: 4px; text-transform: uppercase; }
.crisis-card p { font-size: 0.7rem; color: var(--muted); }

/* WIDGET E (Biblioteca Táctica - GRID DE FICHAS) */
.widget-e { grid-column: span 2; }
.st-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  max-height: 500px;
  overflow-y: auto;
  padding-right: 4px;
}

.st-card {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

.st-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.st-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.st-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.8;
  transition: opacity 0.3s;
}

.st-card:hover .st-thumb img {
  opacity: 1;
}

.st-thumb .file-icon {
  width: 40px;
  height: 40px;
  color: var(--muted);
  opacity: 0.5;
}

.st-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.st-name {
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.st-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.btn-st {
  flex: 1;
  padding: 6px;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: all 0.2s;
}

.btn-st:hover {
  background: var(--violet);
  color: #000;
  border-color: var(--violet);
}

.btn-st.danger:hover {
  background: #ff4444;
  color: #fff;
  border-color: #ff4444;
}

/* BOTONES Y MODAL */
.btn-mini-add {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  color: var(--orange);
  font-size: 0.6rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-mini-add:hover { background: var(--orange); color: #000; border-color: var(--orange); }

.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  display: none;
}
.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 32px;
  border-radius: var(--radius);
  width: 90%;
  max-width: 400px;
}
.modal-content h3 { font-size: 0.9rem; margin-bottom: 20px; color: var(--orange); letter-spacing: 0.1em; }

.custom-select-dark {
  width: 100%;
  background: #000;
  border: 1px solid var(--border);
  color: #fff;
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 20px;
  outline: none;
}

.modal-actions { display: flex; justify-content: flex-end; gap: 12px; }
.btn-cancel, .btn-confirm {
  padding: 10px 20px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 800;
  cursor: pointer;
  border: 1px solid var(--border);
}
.btn-cancel { background: transparent; color: var(--muted); }
.btn-confirm { background: var(--violet); color: #000; border-color: var(--violet); }

.loading-state {
  text-align: center;
  padding: 40px;
  color: var(--muted);
  font-size: 0.75rem;
  font-style: italic;
}

/* FOOTER BAR */
.action-bar-fixed {
  margin-top: 24px;
  padding: 24px 0 48px;
  display: flex;
  justify-content: center;
  gap: 32px;
  border-top: 1px solid var(--border);
}
.action-bar-fixed a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.action-bar-fixed a:hover { color: #fff; }

/* ── RESPONSIVE ── */
@media (max-width: 1200px) {
  main { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  main { grid-template-columns: 1fr; padding: 16px; }
  .bento-item { grid-column: span 1 !important; }
  .infographic-grid { grid-template-columns: 1fr; }
  .countdown-item span { font-size: 1.8rem; }
  .countdown-container { gap: 16px; }
  .header-left { gap: 12px; }
  .title-group h1 { font-size: 0.9rem; }
  header { padding: 0 16px; }
}
