/* ============================================================
   RPINFORMES — estilos específicos de la app
   Variables, reset, navbar, footer, landing, login, botones
   comunes y responsive base → rp-shared-style.css (assets)
   ============================================================ */

/* ── Variables específicas de RPInformes ── */
:root {
  --rp-success: #1a7a4a;
}

/* ── Layout app ── */
html, body { overflow-x: hidden; }
#screen-app { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; background: var(--app-bg); }

/* ── Tabs ── */
.tab-content        { display: none; flex-direction: column; padding: 20px 24px; gap: 20px; }
.tab-content.active { display: flex; flex: 1; }
.tab-header  { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.tab-header h2 { font-family: var(--font-ui) !important; font-size: 22px; font-weight: 400; letter-spacing: 1px; color: #fff; }
.tab-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Select en cabeceras de tab ── */
.tab-select {
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 6px;
  color: #fff;
  padding: 7px 32px 7px 12px;
  font-size: 13px;
  font-family: var(--font-ui);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='rgba(255,255,255,0.5)' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  min-width: 160px;
}
.tab-select:focus { outline: none; border-color: rgba(255,255,255,0.6); }
.tab-select option { background: #012C1D; color: #fff; }

body.light-mode .tab-select {
  background: rgba(1,44,29,0.07);
  border-color: rgba(1,44,29,0.3);
  color: #012C1D;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='rgba(1,44,29,0.5)' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
body.light-mode .tab-select option { background: #fff; color: #012C1D; }

/* ── Botones específicos ── */
.btn-danger { background: #c62828; color: #fff; border: none; padding: 5px 10px; border-radius: 4px; cursor: pointer; font-size: 13px; }
.btn-edit   { background: rgba(255,255,255,0.15); color: #fff; border: 1px solid rgba(255,255,255,0.3); padding: 5px 10px; border-radius: 4px; cursor: pointer; font-size: 13px; }

/* ===== TABLA ===== */
.table-wrap { overflow-x: auto; }
.rp-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.rp-table th { background: rgba(0,0,0,0.3); color: var(--app-muted); font-size: 11px;
  text-transform: uppercase; letter-spacing: .8px; padding: 10px 12px; text-align: left;
  font-weight: 600; border-bottom: 1px solid var(--app-border); white-space: nowrap; }
.rp-table td { padding: 10px 12px; border-bottom: 1px solid rgba(255,255,255,0.06); vertical-align: middle; }
.rp-table tr:hover td { background: rgba(255,255,255,0.03); }
.rp-table tr:last-child td { border-bottom: none; }

/* ===== BADGES ===== */
.badge           { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px;
  border-radius: 20px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge-ok        { background: rgba(26,122,74,0.25);  color: #5cde9a; }
.badge-pendiente { background: rgba(255,255,255,0.1); color: var(--app-muted); }
.badge-penal     { background: rgba(198,40,40,0.25);  color: #ff6666; }

/* ===== PROGRESS BAR (subida) ===== */
.progress-wrap      { display: none; flex-direction: column; gap: 6px; }
.progress-wrap.show { display: flex; }
.progress-bar-bg    { height: 8px; background: rgba(255,255,255,0.1); border-radius: 4px; overflow: hidden; }
.progress-bar-fill  { height: 100%; background: #fff; border-radius: 4px; transition: width .2s; width: 0%; }
.progress-text      { font-size: 12px; color: var(--app-muted); text-align: center; }

/* ===== PANEL ADMIN (gestión) ===== */
.mgmt-grid { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.mgmt-list { display: flex; flex-direction: column; gap: 6px; }
.mgmt-item { background: rgba(0,0,0,0.2); border: 1px solid var(--app-border); border-radius: 8px;
  padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.mgmt-item:hover { border-color: rgba(255,255,255,0.3); }
.mi-info   { flex: 1; }
.mi-title  { font-size: 15px; font-weight: 600; color: #fff; }
.mi-sub    { font-size: 12px; color: var(--app-muted); margin-top: 2px; }
.mi-badge-role { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; }
.role-admin      { background: rgba(198,40,40,0.3); color: #ff8888; }
.role-tecnico    { background: rgba(3,105,161,0.3); color: #7dd3fc; }
.role-futbolista { background: rgba(26,122,74,0.3); color: #5cde9a; }
.ei-actions   { display: flex; gap: 6px; flex-wrap: wrap; }

/* ===== FORM PANEL (sticky) ===== */
.form-panel { background: rgba(0,0,0,0.25); border: 1px solid var(--app-border);
  border-radius: 10px; padding: 20px; display: flex; flex-direction: column; gap: 14px;
  position: sticky; top: 76px; }
.form-panel h4 { font-family: var(--font-card); font-size: 16px; color: #fff;
  letter-spacing: 1px; border-bottom: 1px solid var(--app-border); padding-bottom: 10px; }
.fp-field  { display: flex; flex-direction: column; gap: 5px; }
.fp-field label { font-size: 11px; color: var(--app-muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.fp-field input, .fp-field select, .fp-field textarea {
  background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.25);
  border-radius: 6px; color: #fff; padding: 9px 12px; font-size: 14px; font-family: var(--font-ui); }
.fp-field input:focus, .fp-field select:focus, .fp-field textarea:focus { outline: none; border-color: #fff; }
.fp-field input::placeholder { color: rgba(255,255,255,0.35); }
.fp-field select option { background: #012C1D; }
.fp-actions { display: flex; gap: 8px; }

/* ===== STATS CARDS (dashboard) ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(160px,1fr)); gap: 14px; }
.stat-card  { background: var(--app-surface); border: 1px solid var(--app-border);
  border-radius: 10px; padding: 18px 16px; display: flex; flex-direction: column; gap: 6px; }
.stat-num   { font-family: var(--font-card); font-size: 36px; color: #fff; line-height: 1; }
.stat-label { font-size: 12px; color: var(--app-muted); text-transform: uppercase; letter-spacing: .5px; }
.stat-card.accent-green  { border-color: rgba(26,122,74,0.5); }
.stat-card.accent-orange { border-color: rgba(217,119,6,0.5); }
.stat-card.accent-red    { border-color: rgba(198,40,40,0.5); }

/* ===== TOAST ===== */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { padding: 12px 18px; border-radius: 8px; font-size: 14px; font-weight: 600;
  color: #fff; opacity: 0; transform: translateY(10px); transition: all .3s;
  pointer-events: auto; max-width: 320px; }
.toast.show  { opacity: 1; transform: translateY(0); }
.toast-ok    { background: #1a7a4a; }
.toast-err   { background: #c62828; }
.toast-info  { background: #0369a1; }

/* ===== MODAL ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.88);
  display: flex; align-items: center; justify-content: center; z-index: 500; padding: 16px; }
.modal-content { background: var(--app-surface); border: 1px solid var(--app-border);
  border-radius: 12px; padding: 24px; width: 100%; display: flex;
  flex-direction: column; gap: 16px; position: relative; max-height: 92vh; overflow-y: auto; }
.modal-close { position: absolute; top: 14px; right: 14px; background: transparent;
  border: none; color: var(--app-muted); font-size: 20px; cursor: pointer; }
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.modal-wide { max-width: 560px; }
.modal-xl   { max-width: 800px; }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 40px 20px; color: var(--app-muted); }
.empty-state-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }

/* ===== CATEGORÍAS (Previos / Finales / Individual / Partidos) ===== */
.categoria-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 4px; }
.categoria-tab { padding: 8px 16px; border-radius: 20px; border: 1px solid var(--app-border);
  background: rgba(0,0,0,0.2); color: var(--app-muted); cursor: pointer; font-size: 13px;
  font-family: var(--font-ui); transition: all .15s; }
.categoria-tab:hover { border-color: rgba(255,255,255,0.4); }
.categoria-tab.active { background: #fff; color: #012C1D; font-weight: 700; border-color: #fff; }

/* ===== SELECTOR DE CARPETA (análisis) ===== */
.an-row { display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap; }
.an-row-ctrl { height: 38px; box-sizing: border-box; display: inline-flex; align-items: center; }
.an-row select.an-row-ctrl { min-width: 200px; }

/* ===== CONTENIDO (grid de tarjetas) ===== */
.content-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(220px,1fr)); gap: 14px; }
.content-card { background: var(--app-surface); border: 1px solid var(--app-border); border-radius: 10px;
  padding: 16px; display: flex; flex-direction: column; gap: 8px; cursor: pointer; transition: border-color .15s; }
.content-card:hover { border-color: #fff; }
.content-card .cc-icon  { font-size: 28px; text-align: center; }
/* Nombre completo del archivo: hasta 4 líneas (cabe un nombre de ~70-80 caracteres como
   "IF-2026-2027-COPA R-R01-CD GUINIGUADA-CD FEMARGUIN-INFORME VIDEO"), reservando siempre
   las 4 para que todas las tarjetas sigan teniendo la misma altura. overflow-wrap:anywhere
   parte también los tramos largos sin espacios (los guiones no siempre dejan romper línea). */
.content-card .cc-title { font-weight: 600; color: #fff; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; min-height: 5.2em;
  overflow-wrap: anywhere; }
.content-card .cc-meta  { font-size: 12px; color: var(--app-muted); }
.content-card .cc-views { font-size: 11px; color: var(--app-muted); }
.content-card .ei-actions { margin-top: auto; padding-top: 6px; justify-content: center; }

/* ===== VISOR (PDF / vídeo embebido, sin descarga) ===== */
.viewer-overlay { position: fixed; inset: 0; background: #000; z-index: 600; display: flex; flex-direction: column; }
.viewer-overlay.hidden { display: none; }
.viewer-bar { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px;
  background: #012C1D; color: #fff; font-family: var(--font-ui); }
.viewer-bar button { background: transparent; border: none; color: #fff; font-size: 18px; cursor: pointer; }
.viewer-media-wrap { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; position: relative; user-select: none; -webkit-user-select: none; }
.viewer-media-wrap video, .viewer-media-wrap iframe { width: 100%; height: 100%; max-width: 100%; max-height: 100%; object-fit: contain; border: none; background: #000; }

@media (max-width: 600px) {
  .viewer-bar { padding: 8px 12px; }
}

/* ── Modo claro: overrides específicos de RPInformes ── */
body.light-mode .tab-header h2   { color: #012C1D; }
body.light-mode .fp-field input,
body.light-mode .fp-field select,
body.light-mode .fp-field textarea { background: #fff; color: #012C1D; border-color: rgba(1,44,29,0.35); }
body.light-mode .fp-field input::placeholder { color: rgba(1,44,29,0.4); }
body.light-mode .fp-field select option { background: #fff; color: #012C1D; }
body.light-mode .btn-edit { background: rgba(1,44,29,0.1); color: #012C1D; border-color: rgba(1,44,29,0.3); }
body.light-mode .mgmt-item { border-color: rgba(1,44,29,0.2); }
body.light-mode .mi-title  { color: #012C1D; }
body.light-mode .mi-sub    { color: #3a5a4a; }
body.light-mode .rp-table th { background: #012C1D; color: #fff; }
body.light-mode .rp-table td { color: #012C1D; }
body.light-mode .rp-table tr:hover td { background: rgba(1,44,29,0.05); }
body.light-mode .stat-card { background: #fff; border-color: rgba(1,44,29,0.2); }
body.light-mode .stat-num  { color: #012C1D; }
body.light-mode .stat-label { color: #3a5a4a; }
body.light-mode .form-panel { background: rgba(1,44,29,0.05); border-color: rgba(1,44,29,0.2); }
body.light-mode .form-panel h4 { color: #012C1D; border-color: rgba(1,44,29,0.15); }
body.light-mode .fp-field label { color: #3a5a4a; }
body.light-mode .categoria-tab { background: rgba(1,44,29,0.05); color: #3a5a4a; border-color: rgba(1,44,29,0.2); }
body.light-mode .categoria-tab.active { background: #012C1D; color: #fff; border-color: #012C1D; }
body.light-mode .content-card { background: #fff; border-color: rgba(1,44,29,0.2); }
body.light-mode .content-card .cc-title { color: #012C1D; }
body.light-mode .content-card .cc-meta,
body.light-mode .content-card .cc-views { color: #3a5a4a; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .mgmt-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .tab-content { padding: 16px 12px; }
  .content-grid { grid-template-columns: repeat(auto-fill,minmax(150px,1fr)); }
}

@media (min-width: 769px) {
  .tab-header h2 { font-size: 24px; }
  .rp-table th { font-size: 12px; }
  .rp-table td { font-size: 15px; }
  .badge        { font-size: 13px; }
  .mi-title     { font-size: 16px; }
  .mi-sub       { font-size: 13px; }
}
