/* =========================================
   main.css - Estilos Globales Compartidos
========================================= */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background: #0b0b0b;
  color: #fff;
  font-family: Arial, Helvetica, sans-serif;
}

/* =========================================
   Layout & Sidebar
========================================= */
.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: #111;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding: 24px 18px;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  transition: transform 0.3s ease, padding 0.3s ease, max-height 0.3s ease;
  z-index: 1040;
}

.sidebar.collapsed {
  transform: translateX(-100%);
}

/* Sidebar Scrollbar */
.sidebar::-webkit-scrollbar {
  width: 6px;
}
.sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.logo {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 30px;
}

.logo-img {
  width: 150px;
  max-width: 100%;
  object-fit: contain;
  border-radius: 50%;
  background: #fff;
  padding: 8px;
}

.menu {
  list-style: none;
  padding: 0;
  margin: 0;
}

.menu li {
  margin-bottom: 12px;
}

.menu a {
  display: block;
  text-decoration: none;
  color: #d8d8d8;
  padding: 12px 14px;
  border-radius: 10px;
  transition: 0.3s;
}

.menu a:hover,
.menu a.active {
  background: #e50914;
  color: #fff;
}

/* =========================================
   Área Principal (Main)
========================================= */
.main {
  margin-left: 240px;
  width: calc(100% - 240px);
  padding: 28px;
  transition: margin-left 0.3s ease, width 0.3s ease;
}

.main.expanded {
  margin-left: 0;
  width: 100%;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 20px;
}

.page-title {
  font-size: 42px;
  font-weight: bold;
  margin: 0;
}

/* =========================================
   Botones Generales
========================================= */
.btn-save {
  background: #e50914;
  border: none;
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
  transition: 0.3s;
  cursor: pointer;
}

.btn-save:hover {
  background: #ff1f2d;
  color: #fff;
}

.btn-cancel {
  background: rgba(255, 255, 255, 0.12);
  border: none;
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
  transition: 0.3s;
  cursor: pointer;
}

.btn-cancel:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.btn-export {
  background: #198754;
  border: none;
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
  transition: 0.3s;
  cursor: pointer;
}

.btn-export:hover {
  background: #157347;
  color: #fff;
}

.btn {
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-edit {
  background: transparent;
  color: #5aa2ff;
  border: 1px solid #5aa2ff;
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 13px;
  text-decoration: none;
  transition: 0.3s;
  cursor: pointer;
  margin-right: 8px;
}

.btn-edit:hover {
  background: #5aa2ff;
  color: #fff;
}

.btn-delete {
  background: transparent;
  color: #ff4c57;
  border: 1px solid #ff4c57;
  border-radius: 10px;
  padding: 7px 12px;
  font-size: 13px;
  text-decoration: none;
  transition: 0.3s;
  cursor: pointer;
}

.btn-delete:hover {
  background: #ff4c57;
  color: #fff;
}

/* =========================================
   COMPONENTE: TARJETAS DASHBOARD (GLOBAL)
========================================= */
.dashboard-totals {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 26px;
}

.dashboard-card {
  border-radius: 20px;
  padding: 22px 22px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  background: linear-gradient(135deg, #1f2937, #111827);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.dashboard-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.36);
}

.dashboard-label {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dashboard-value {
  font-size: 34px;
  font-weight: 800;
  line-height: 1.1;
  color: #fff;
}

/* =========================================
   Formularios
========================================= */
.form-box {
  background: #181818;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 18px;
  padding: 22px;
  margin-bottom: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.form-label {
  color: #f0f0f0;
  font-weight: 500;
  margin-bottom: 8px;
  display: block;
}

.form-control,
.form-select {
  background: #242424 !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: #fff !important;
  border-radius: 10px;
  padding: 12px 14px;
}

.form-control:focus,
.form-select:focus {
  background: #242424 !important;
  color: #fff !important;
  border-color: #e50914 !important;
  box-shadow: 0 0 0 0.15rem rgba(229, 9, 20, 0.2) !important;
  outline: none;
}

.form-control.is-invalid,
.form-select.is-invalid {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 0.15rem rgba(239, 68, 68, 0.15) !important;
}

.form-control.is-valid,
.form-select.is-valid {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 0.15rem rgba(16, 185, 129, 0.15) !important;
}

.feedback-text {
  font-size: 0.8rem;
  margin-top: 4px;
  display: none;
}

.feedback-text.error {
  color: #ef4444;
  display: block;
}

.feedback-text.success {
  color: #10b981;
  display: block;
}

.form-select option {
  background: #242424;
  color: #fff;
}

/* =========================================
   Tablas (Generales)
========================================= */
.table-box {
  background: #181818;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.table {
  width: 100%;
  margin: 0;
  color: #fff;
  border-collapse: collapse;
}

.table thead {
  background: linear-gradient(180deg, #222, #1a1a1a);
}

.table thead th {
  border: none;
  color: #fff;
  font-size: 15px;
  padding: 18px 14px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  text-align: left;
}

.table tbody tr {
  transition: background 0.25s ease;
}

.table tbody tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

.table tbody td {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 14px;
  vertical-align: middle;
  color: #e2e2e2;
  white-space: nowrap;
  text-align: left;
}

/* =========================================
   Modales Base
========================================= */
.delete-modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.delete-modal-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.delete-modal {
  background-color: #1e1e24;
  width: 90%;
  max-width: 400px;
  max-height: 90vh;        /* Asegura que no sobrepase la pantalla */
  overflow-y: auto;        /* Añade scroll interno */
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transform: scale(1) translateY(0);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-align: center;
}

/* Scrollbar moderno para los modales */
.delete-modal::-webkit-scrollbar {
  width: 6px;
}
.delete-modal::-webkit-scrollbar-track {
  background: transparent;
  margin: 10px 0; /* Agrega espacio a los lados del scroll track */
}
.delete-modal::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
}
.delete-modal::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.delete-modal-overlay.hidden .delete-modal {
  transform: scale(0.9) translateY(10px);
}

.delete-modal-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  background-color: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.delete-modal-icon svg {
  width: 30px;
  height: 30px;
}

.delete-modal-title {
  margin: 0 0 10px;
  color: #f3f4f6;
  font-size: 1.25rem;
  font-weight: 600;
  font-family: inherit;
}

.delete-modal-desc {
  margin: 0 0 24px;
  color: #9ca3af;
  font-size: 0.95rem;
  line-height: 1.5;
}

.delete-modal-desc strong {
  color: #f3f4f6;
  font-weight: 600;
}

.delete-modal-actions {
  display: flex;
  gap: 12px;
}

.delete-modal-actions .btn {
  flex: 1;
}

.btn-cancel-modal {
  background-color: #374151;
  color: #f3f4f6;
}

.btn-cancel-modal:hover:not(:disabled) {
  background-color: #4b5563;
}

.btn-danger {
  background-color: #ef4444;
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background-color: #dc2626;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
}

.btn-danger:active:not(:disabled) {
  background-color: #b91c1c;
}

/* =========================================
   Componentes / Utilitarios
========================================= */
.btn-spinner {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hidden {
  display: none !important;
}

.spinner {
  animation: spin 1s linear infinite;
  width: 18px;
  height: 18px;
}

.opacity-25 { opacity: 0.25; }
.opacity-75 { opacity: 0.75; }

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* =========================================
   Toasts
========================================= */
.custom-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: #1e1e24;
  color: #f3f4f6;
  padding: 14px 24px;
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 10000;
  transition: all 0.3s ease;
  font-size: 0.95rem;
  font-weight: 500;
  opacity: 1;
  visibility: visible;
}

.custom-toast.success { border-left: 4px solid #10b981; }
.custom-toast.error { border-left: 4px solid #ef4444; }

.custom-toast.hidden {
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) translateY(20px);
  pointer-events: none;
}

/* =========================================
   Media Queries Generales
========================================= */
@media (max-width: 1100px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    position: static;
    width: 100%;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .sidebar.collapsed {
    transform: none;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
    border-bottom: none;
  }

  .main {
    margin-left: 0;
    width: 100%;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .page-title {
    font-size: 32px;
  }
}

@media (max-width: 900px) {
  .page-title {
    font-size: 32px;
  }
}

@media (max-width: 1200px) {
  .dashboard-totals {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

@media (max-width: 700px) {
  .dashboard-totals {
    grid-template-columns: 1fr;
  }
}

/* =========================================
   Close Button Custom (X) Global
========================================= */
.btn-close-custom {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #a1a1aa;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
}

.btn-close-custom:hover {
  background: rgba(229, 9, 20, 0.15);
  color: #ff4c57;
  border-color: rgba(229, 9, 20, 0.3);
  transform: rotate(90deg);
}
