/* ── Admin Panel ─────────────────────────────────────────────── */

.admin-panel {
  display: none;
  flex-direction: column;
  height: 100%;
  background: #f1f3f4;
  overflow: hidden;
}

.admin-panel.is-visible {
  display: flex;
}

/* Header */
.admin-panel__header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  background: white;
  border-bottom: 1px solid var(--color-gray-300);
  flex-shrink: 0;
}

.admin-panel__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #1a73e8;
  color: white;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  text-transform: uppercase;
}

.admin-panel__title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1a1a2e;
  flex: 1;
}

.admin-panel__back-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: none;
  border: none;
  cursor: pointer;
  color: #1a73e8;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  transition: background 0.12s;
}
.admin-panel__back-btn:hover { background: #e8f0fe; }

/* Tabs */
.admin-panel__tabs {
  display: flex;
  gap: 0;
  background: white;
  border-bottom: 1px solid var(--color-gray-300);
  padding: 0 1.5rem;
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.admin-panel__tabs::-webkit-scrollbar { display: none; }

.admin-tab {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.75rem 1rem;
  background: none;
  border: none;
  border-bottom: 2.5px solid transparent;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-gray-500);
  white-space: nowrap;
  transition: color 0.12s, border-color 0.12s;
}
.admin-tab:hover { color: #1a73e8; }
.admin-tab.is-active {
  color: #1a73e8;
  border-bottom-color: #1a73e8;
}

.admin-tab__badge {
  background: #ea4335;
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.1rem 0.4rem;
  line-height: 1.4;
  min-width: 1.2rem;
  text-align: center;
}

/* Content */
.admin-panel__content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.admin-section { display: none; }
.admin-section.is-active { display: block; }

/* Section header */
.admin-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.admin-section__title {
  font-size: 1rem;
  font-weight: 700;
  color: #1a1a2e;
}

.admin-section__count {
  font-size: 0.8rem;
  color: var(--color-gray-500);
  margin-left: 0.4rem;
  font-weight: 400;
}

/* Reload button */
.admin-reload-btn {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: none;
  border: 1px solid var(--color-gray-300);
  border-radius: 8px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-gray-500);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.admin-reload-btn:hover {
  background: var(--color-gray-100);
  color: #1a1a2e;
}
.admin-reload-btn.is-loading svg {
  animation: admin-spin 0.7s linear infinite;
}
@keyframes admin-spin { to { transform: rotate(360deg); } }

/* Table wrapper */
.admin-table-wrap {
  background: white;
  border-radius: 12px;
  border: 1px solid var(--color-gray-300);
  overflow: hidden;
  overflow-x: auto;
}

/* Table */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.admin-table thead {
  background: var(--color-gray-100);
}

.admin-table th {
  padding: 0.6rem 0.9rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--color-gray-300);
  white-space: nowrap;
}

.admin-table td {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
  color: #2d2d2d;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-table tr:last-child td { border-bottom: none; }

.admin-table tbody tr:hover { background: #fafbff; }

/* Color dot */
.admin-color-dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  margin-right: 0.4rem;
  flex-shrink: 0;
}

/* Tags */
.admin-tag {
  display: inline-block;
  background: #e8f0fe;
  color: #1a73e8;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  margin: 0.1rem;
  white-space: nowrap;
}

.admin-tag--gray {
  background: var(--color-gray-100);
  color: var(--color-gray-500);
}

/* Action buttons */
.admin-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.admin-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 600;
  transition: background 0.12s, opacity 0.12s;
  white-space: nowrap;
}
.admin-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.admin-btn--approve {
  background: #e6f4ea;
  color: #137333;
}
.admin-btn--approve:hover:not(:disabled) { background: #ceead6; }

.admin-btn--deny {
  background: #fce8e6;
  color: #c5221f;
}
.admin-btn--deny:hover:not(:disabled) { background: #f5c6c4; }

.admin-btn--delete {
  background: none;
  color: #c5221f;
  border: 1px solid #fce8e6;
  padding: 0.25rem 0.5rem;
}
.admin-btn--delete:hover:not(:disabled) { background: #fce8e6; }

.admin-btn--secondary {
  background: var(--color-gray-100);
  color: var(--color-gray-500);
}
.admin-btn--secondary:hover:not(:disabled) { background: var(--color-gray-300); }

/* Empty / loading states */
.admin-empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--color-gray-400);
  font-size: 0.85rem;
}

.admin-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem;
  color: var(--color-gray-400);
  font-size: 0.85rem;
  gap: 0.5rem;
}

.admin-spinner svg {
  animation: admin-spin 0.8s linear infinite;
}

/* Member emails list in companies table */
.admin-members-list {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  max-width: 16rem;
}

.admin-member-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
}

.admin-member-badge {
  font-size: 0.62rem;
  background: #fef3c7;
  color: #92400e;
  border-radius: 4px;
  padding: 0.05rem 0.3rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-member-badge--cuti {
  background: #dbeafe;
  color: #1e3a8a;
}

/* Activity feed */
.admin-activity {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: white;
  border-radius: 12px;
  border: 1px solid var(--color-gray-300);
  overflow: hidden;
}

.admin-activity-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.1s;
}
.admin-activity-item:last-child { border-bottom: none; }
.admin-activity-item:hover { background: #fafbff; }

.admin-activity-icon {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.admin-activity-icon--event   { background: #e8f0fe; }
.admin-activity-icon--attend  { background: #e6f4ea; }
.admin-activity-icon--register { background: #fef3c7; }

.admin-activity-body { flex: 1; min-width: 0; }

.admin-activity-title {
  font-size: 0.84rem;
  font-weight: 600;
  color: #1a1a2e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-activity-meta {
  font-size: 0.76rem;
  color: var(--color-gray-500);
  margin-top: 0.1rem;
}

.admin-activity-time {
  font-size: 0.74rem;
  color: var(--color-gray-400);
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 0.2rem;
}

/* Responsive */
@media (max-width: 700px) {
  .admin-panel__content { padding: 1rem 0.75rem; }
  .admin-panel__header { padding: 0.65rem 1rem; }
  .admin-panel__tabs { padding: 0 0.5rem; }
  .admin-table td, .admin-table th { padding: 0.6rem 0.6rem; }
}

/* ── Toolbar selección múltiple empresas ── */
.admin-companies-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  margin-bottom: 0.75rem;
}

.admin-companies-toolbar__count {
  font-size: 0.82rem;
  font-weight: 500;
  color: #1d4ed8;
  flex: 1;
}

/* ── Settings Panel ── */
.settings-panel__layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 0 1rem 1rem;
  width: 11rem;
  flex-shrink: 0;
  border-right: 1px solid var(--color-gray-300);
  background: white;
}

.settings-nav__tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.85rem;
  border: none;
  background: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--color-gray-500);
  text-align: left;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}
.settings-nav__tab:hover {
  background: var(--color-gray-100);
  color: #1a1a2e;
}
.settings-nav__tab.is-active {
  background: #e8f0fe;
  color: #1a73e8;
  font-weight: 600;
}

.settings-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.settings-section {
  display: none;
}
.settings-section.is-active {
  display: block;
}

.settings-section__inner {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 36rem;
}
.settings-section__inner .sidebar-empresa-profile { margin-bottom: 0.5rem; }

/* ── TOS Rich Editor ── */
.settings-tos-wrap {
  display: flex;
  flex-direction: column;
  max-width: 44rem;
  margin: 0 auto;
  width: 100%;
  height: 100%;
  position: relative;
}
.settings-tos-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0;
}
.settings-tos-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0.75rem 0;
}
.tos-toolbar {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.45rem 0.6rem;
  background: #f8f9fa;
  border: 1px solid var(--color-gray-300);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  flex-wrap: wrap;
}
.tos-toolbar__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: none;
  background: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.82rem;
  color: #3c4043;
  transition: background 0.1s;
}
.tos-toolbar__btn:hover { background: #e8eaed; }
.tos-toolbar__btn.is-active { background: #d2e3fc; color: #1a73e8; }
.tos-toolbar__sep {
  width: 1px;
  height: 1.4rem;
  background: #dadce0;
  margin: 0 0.3rem;
}
.tos-toolbar__select {
  border: 1px solid var(--color-gray-300);
  border-radius: 6px;
  padding: 0.25rem 0.4rem;
  font-size: 0.78rem;
  color: #3c4043;
  background: white;
  cursor: pointer;
  outline: none;
}
.tos-toolbar__select:focus { border-color: #1a73e8; }

.tos-editor {
  flex: 1;
  overflow-y: auto;
  border: 1px solid var(--color-gray-300);
  border-radius: 0 0 10px 10px;
  padding: 1.25rem 1.5rem;
  font-size: 0.88rem;
  line-height: 1.7;
  color: #2d2d2d;
  background: white;
  outline: none;
  min-height: 12rem;
}
.tos-editor:focus { border-color: #1a73e8; box-shadow: 0 0 0 2px #1a73e814; }
.tos-editor[contenteditable="false"] { border-radius: 10px; cursor: default; }
.tos-editor p { margin: 0 0 0.6rem; }
.tos-editor ul, .tos-editor ol { padding-left: 1.5rem; margin: 0.4rem 0; }
.tos-editor h2 { font-size: 1.1rem; font-weight: 700; margin: 1rem 0 0.4rem; color: #1a1a2e; }
.tos-editor h3 { font-size: 0.95rem; font-weight: 600; margin: 0.8rem 0 0.3rem; color: #1a1a2e; }

.tos-editor-footer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  padding-bottom: 0.5rem;
}
.tos-save-status {
  font-size: 0.78rem;
  color: #16a34a;
}

/* ── Link Overlay ── */
.tos-link-overlay {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 10;
  background: rgba(0,0,0,0.15);
  backdrop-filter: blur(2px);
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}
.tos-link-overlay.is-open {
  display: flex;
  animation: overlayFadeIn 0.2s ease-out;
}
.tos-link-overlay.is-closing {
  animation: overlayFadeOut 0.18s ease-in forwards;
}
.tos-link-overlay__card {
  background: white;
  border-radius: 12px;
  padding: 1.75rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  max-width: 28rem;
  width: 90%;
  position: relative;
  animation: cardScaleIn 0.2s ease-out;
}
.tos-link-overlay.is-closing .tos-link-overlay__card {
  animation: cardScaleOut 0.18s ease-in forwards;
}
.tos-link-overlay__close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  color: #9ca3af;
  line-height: 0;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.tos-link-overlay__close:hover { color: #374151; background: #f3f4f6; }
.tos-link-overlay__title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0 0 1rem;
}
.tos-link-overlay__fields {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.tos-link-overlay__label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #4b5563;
  margin-bottom: 0.25rem;
  display: block;
}
.tos-link-overlay__fields input { width: 100%; }
.tos-link-overlay__actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes overlayFadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}
@keyframes cardScaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes cardScaleOut {
  from { opacity: 1; transform: scale(1); }
  to { opacity: 0; transform: scale(0.92); }
}

/* ── Confirm Overlay ── */
.tos-confirm-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,0.25);
  backdrop-filter: blur(3px);
  align-items: center;
  justify-content: center;
}
.tos-confirm-overlay.is-open {
  display: flex;
  animation: overlayFadeIn 0.2s ease-out;
}
.tos-confirm-overlay.is-closing {
  animation: overlayFadeOut 0.18s ease-in forwards;
}
.tos-confirm-overlay__card {
  background: white;
  border-radius: 14px;
  padding: 2rem;
  box-shadow: 0 12px 40px rgba(0,0,0,0.2);
  max-width: 22rem;
  width: 90%;
  text-align: center;
  animation: cardScaleIn 0.2s ease-out;
}
.tos-confirm-overlay.is-closing .tos-confirm-overlay__card {
  animation: cardScaleOut 0.18s ease-in forwards;
}
.tos-confirm-overlay__icon {
  margin-bottom: 0.75rem;
}
.tos-confirm-overlay__title {
  font-size: 1rem;
  font-weight: 700;
  color: #1a1a2e;
  margin: 0 0 0.35rem;
}
.tos-confirm-overlay__msg {
  font-size: 0.85rem;
  color: #6b7280;
  margin: 0 0 1.25rem;
  line-height: 1.5;
}
.tos-confirm-overlay__actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}
