/* modals.css — overlays, modales y formularios */

/* ─── Overlay ────────────────────────────────────────────────────────────── */
.overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.45); z-index: 20;
  align-items: center; justify-content: center;
}
.overlay.active { display: flex; }

/* ─── Modal base ─────────────────────────────────────────────────────────── */
.modal {
  background: #ffffff; border: 0.5px solid rgba(0,0,0,.12);
  border-radius: 12px; padding: 2rem;
  width: 400px; max-width: 96vw; max-height: 92vh; overflow-y: auto;
}
.modal-chess {
  width: min(820px, 96vw);
  max-width: 96vw;
  max-height: 92vh;
  overflow-y: auto;
  padding: 1.25rem;
}
.modal-wide  { width: 460px; }

.modal h2       { font-size: 18px; font-weight: 500; margin-bottom: 4px; }
.modal-sub      { font-size: 13px; color: #666; margin-bottom: 1.25rem; }
.modal-close    { float: right; background: none; border: none; font-size: 20px; cursor: pointer; color: #666; margin-top: -4px; }
.modal-close:hover { color: #111; }

/* ─── Campos de formulario ───────────────────────────────────────────────── */
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: 12px; color: #666; margin-bottom: 5px; }
.field input,
.field textarea,
.field select   { width: 100%; font-family: sans-serif; font-size: 13px; }
.field textarea  { height: 70px; resize: vertical; }
.field textarea.mono { font-family: monospace; font-size: 12px; height: 90px; }

.error-msg  { font-size: 12px; color: #A32D2D; margin-top: 6px; display: none; }
.field-error { font-size: 11px; color: #A32D2D; margin-top: 3px; display: none; }

/* ─── Botones dentro de modal ────────────────────────────────────────────── */
.btn-primary {
  width: 100%; padding: 9px; background: #185FA5; color: #E6F1FB;
  border: none; border-radius: 8px; font-size: 14px; cursor: pointer; margin-top: 4px;
}
.btn-primary:hover { background: #0C447C; }
.btn-link { background: none; border: none; font-size: 12px; color: #666; cursor: pointer; margin-top: 10px; width: 100%; text-align: center; }

.modal-footer { display: flex; gap: 8px; margin-top: 14px; }
.modal-footer button {
  flex: 1; padding: 9px; border-radius: 8px; font-size: 13px;
  cursor: pointer; border: 0.5px solid rgba(0,0,0,.15); background: none;
}
.modal-footer button.confirm { background: #185FA5; color: #E6F1FB; border: none; }
.modal-footer button.confirm:hover { background: #0C447C; }
.modal-footer button.cancel:hover  { border-color: rgba(0,0,0,.3); }
.modal-footer button.danger  { background: #A32D2D; color: #fff; border: none; }
.modal-footer button.danger:hover  { background: #791F1F; }

/* ─── Modal de perfil ────────────────────────────────────────────────────── */
.modal-profile {
  width: 480px;
  max-width: 96vw;
  max-height: 92vh;
  overflow-y: auto;
  padding: 0;
  border-radius: 16px;
  border: none;
}

/* Hero header */
.profile-hero {
  background: linear-gradient(140deg, #1a1f3c 0%, #232a5a 100%);
  padding: 2rem 1.75rem 1.75rem;
  text-align: center;
  position: relative;
  border-radius: 16px 16px 0 0;
}

.profile-close-btn {
  position: absolute;
  top: .875rem; right: .875rem;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.14);
  color: rgba(255,255,255,.6);
  width: 30px; height: 30px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
  line-height: 1;
  flex-shrink: 0;
}
.profile-close-btn:hover {
  background: rgba(255,255,255,.2);
  color: #fff;
}

.profile-avatar-lg {
  width: 82px; height: 82px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 700; color: #fff;
  border: 3px solid rgba(201,148,58,.75);
  box-shadow: 0 0 0 5px rgba(201,148,58,.14), 0 6px 20px rgba(0,0,0,.35);
  margin-bottom: 12px;
}

.profile-name-display {
  font-size: 18px; font-weight: 700; color: #fff;
  letter-spacing: .01em;
}

.profile-role-badge {
  display: inline-block;
  font-size: 10.5px;
  color: #C9943A;
  background: rgba(201,148,58,.14);
  border: 1px solid rgba(201,148,58,.28);
  border-radius: 20px;
  padding: 3px 14px;
  margin-top: 8px;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
}

/* Body */
.profile-body {
  padding: 1.5rem 1.75rem 1.75rem;
}

.profile-section {
  margin-bottom: 1.5rem;
}

.profile-section-header {
  display: flex; align-items: center; gap: 7px;
  margin-bottom: 1rem;
  padding-bottom: .55rem;
  border-bottom: 1.5px solid #eef0f5;
}

.profile-section-label {
  display: block; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .08em; color: #aaa; font-weight: 700;
  margin: 0;
}

.profile-field-hint {
  display: block; font-size: 11px; color: #bbb; margin-top: 4px;
}

/* Fields inside profile body */
.profile-body .field { margin-bottom: .875rem; }

.profile-body .field label {
  display: block; font-size: 12px; font-weight: 500;
  color: #555; margin-bottom: 5px;
}

.profile-body .field input {
  width: 100%; padding: 9px 12px;
  border: 1px solid rgba(0,0,0,.12); border-radius: 8px;
  font-size: 13px; color: #333; background: #fff;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
  box-sizing: border-box;
}
.profile-body .field input:focus {
  outline: none;
  border-color: #185FA5;
  box-shadow: 0 0 0 3px rgba(24,95,165,.1);
}

.profile-readonly-wrap { position: relative; }
.profile-readonly-wrap input {
  background: #f5f7fa !important; color: #aaa !important;
  cursor: not-allowed; padding-right: 2.25rem;
}
.profile-lock {
  position: absolute; right: 10px; top: 50%;
  transform: translateY(-50%); font-size: 11px; opacity: .38;
  pointer-events: none;
}

/* Password toggle */
.profile-pwd-toggle {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 14px;
  background: #f8f9fc;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 10px;
  cursor: pointer; font-size: 13px; color: #444; user-select: none;
  transition: background .12s, border-color .12s;
}
.profile-pwd-toggle:hover { background: #f0f2f7; border-color: rgba(0,0,0,.12); }
.profile-pwd-toggle-label { display: flex; align-items: center; }

.profile-pwd-chevron {
  display: flex; align-items: center;
  color: #bbb;
  transition: transform .2s;
}
.profile-pwd-toggle.open .profile-pwd-chevron { transform: rotate(180deg); }

.profile-pwd-section {
  display: none;
  background: #f8f9fc;
  border: 1px solid rgba(0,0,0,.08);
  border-top: none;
  border-radius: 0 0 10px 10px;
  padding: 1rem 1rem .5rem;
}

/* Save button */
.btn-profile-save {
  width: 100%;
  padding: 11px 16px;
  background: #C9943A;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: .02em;
  transition: background .15s, transform .1s;
}
.btn-profile-save:hover { background: #b07e2f; }
.btn-profile-save:active { transform: scale(.98); }

/* Mobile — slide up from bottom */
@media (max-width: 540px) {
  #profileOverlay { align-items: flex-end; }
  .modal-profile {
    width: 100%;
    max-width: 100%;
    max-height: 90vh;
    border-radius: 20px 20px 0 0;
  }
  .profile-hero { padding: 1.5rem 1.25rem 1.5rem; }
  .profile-body { padding: 1.25rem 1.25rem 1.5rem; }
}

/* ─── Fila de carga de archivo PGN ──────────────────────────────────────── */
.pgn-file-row { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.btn-file {
  background: none; border: 0.5px solid rgba(0,0,0,.2); border-radius: 6px;
  padding: 5px 10px; font-size: 12px; cursor: pointer;
}
.btn-file:hover { border-color: rgba(0,0,0,.4); }
.pgn-filename { font-size: 12px; color: #888; }