/* ============================================
   VARIABLES Y RESET
   ============================================ */

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

:root {
  /* Colores principales */
  --primary-color: #2563eb;
  --primary-dark: #1e40af;
  --secondary-color: #0f172a;
  --accent-color: #06b6d4;
  --text-color: #1f2937;
  --text-light: #6b7280;
  --bg-light: #f9fafb;
  --bg-white: #ffffff;
  --border-color: #e5e7eb;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s ease;
  
  /* 🖼️ FONDO - CAMBIAR AQUÍ 🖼️
     Ejemplos:
     - Imagen remota: url('https://images.unsplash.com/photo-xxxxx.jpg')
     - Imagen local: url('/images/fondo.jpg')
     - Gradiente: linear-gradient(135deg, #667eea 0%, #764ba2 100%)
     Ver BACKGROUNDS.md para más opciones
  */
  --bg-image-url: url('https://i.imgur.com/bgXCWN1.jpeg');
    /* 🏢 LOGO - CAMBIAR AQUÍ 🏢
     Proporciona una URL a tu logo (PNG, SVG, JPG)
     Se mostrará como logo horizontal en el header
     Ejemplos:
     - URL remota: url('https://tu-dominio.com/logo.png')
     - Imagen local: url('/images/logo.png')
     Si está vacío, mostrará el logo SVG por defecto
  */
  --logo-url: '';
    /* Transparencia de elementos con fondo */
  --bg-opacity: 0.92;          /* Opacidad de header, footer, cards (0.9 = 90% opaco, 10% transparencia) */
  --bg-opacity-light: 0.88;    /* Opacidad para elementos secundarios */
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--text-color);
  background-color: var(--bg-light);
  background-image: var(--bg-image-url);
  background-attachment: fixed;
  background-size: cover;
  background-position: center;
  line-height: 1.6;
}

/* ============================================
   PÁGINA DE LOGIN
   ============================================ */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background-image: var(--bg-image-url);
  background-attachment: fixed;
  background-size: cover;
  background-position: center;
  position: relative;
}

.login-page::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.5) 0%, rgba(6, 182, 212, 0.5) 100%);
  z-index: 1;
}

.login-container {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  z-index: 2;
}

.login-box {
  background: rgba(255, 255, 255, var(--bg-opacity));
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  animation: slideUp 0.5s ease;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-logo {
  width: 150px;
  height: 150px;
  margin: 0 auto 20px;
  color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-logo svg {
  width: 100%;
  height: 100%;
}

.login-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.login-box h1 {
  text-align: center;
  font-size: 28px;
  margin-bottom: 5px;
  color: var(--secondary-color);
}

.login-subtitle {
  text-align: center;
  color: var(--text-light);
  margin-bottom: 25px;
  font-size: 14px;
}

.error-message {
  background-color: #fee2e2;
  color: #991b1b;
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 20px;
  border-left: 4px solid #dc2626;
  font-size: 14px;
}

.login-form {
  display: flex;
  flex-direction: column;
}

.form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 18px;
}

.form-group label {
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-color);
  font-size: 14px;
}

.form-group input {
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 14px;
  transition: var(--transition);
  font-family: inherit;
}

.form-group input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.btn-login {
  padding: 10px 16px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  margin-top: 10px;
}

.btn-login:hover {
  background-color: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-login:active {
  transform: translateY(0);
}

.login-footer {
  text-align: center;
  margin-top: 25px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.login-footer small {
  display: block;
  color: var(--text-light);
  font-size: 12px;
  margin-bottom: 4px;
}

/* ============================================
   PÁGINA DE DASHBOARD
   ============================================ */

.dashboard-page {
  background-color: var(--bg-light);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  background: linear-gradient(135deg, rgba(15, 23, 42, var(--bg-opacity)) 0%, rgba(30, 41, 59, var(--bg-opacity)) 100%);
  color: white;
  padding: 25px 0;
  box-shadow: var(--shadow-lg);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.main-logo {
  width: 50px;
  height: 50px;
  color: var(--accent-color);
}

.logo-image {
  max-height: 50px;
  max-width: 300px;
  object-fit: contain;
}

.logo-section h1 {
  font-size: 24px;
  margin: 0;
}

.user-section {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
}

.user-name {
  font-size: 14px;
  color: #cbd5e1;
}

.admin-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-admin {
  padding: 8px 16px;
  background-color: #7c3aed;
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
  border: none;
  cursor: pointer;
}

.btn-admin:hover {
  background-color: #6d28d9;
  transform: translateY(-2px);
}

.btn-logout {
  padding: 8px 16px;
  background-color: #dc2626;
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
  border: none;
  cursor: pointer;
}

.btn-logout:hover {
  background-color: #b91c1c;
  transform: translateY(-2px);
}

.btn-back {
  padding: 8px 16px;
  background-color: #6b7280;
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
  border: none;
  cursor: pointer;
}

.btn-back:hover {
  background-color: #4b5563;
  transform: translateY(-2px);
}

.btn-primary {
  padding: 10px 20px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  display: inline-block;
}

.btn-primary:hover {
  background-color: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-delete {
  padding: 6px 12px;
  background-color: #dc2626;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

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

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 20px;
  flex: 1;
  width: 100%;
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  animation: fadeIn 0.6s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.service-card {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, var(--bg-opacity));
  border-radius: 12px;
  padding: 24px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: var(--transition);
  border: 2px solid transparent;
  cursor: pointer;
  backdrop-filter: blur(10px);
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.service-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-color);
}

.card-icon {
  position: relative;
  width: 60px;
  height: 60px;
  margin-bottom: 16px;
  flex-shrink: 0;
}

.card-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: brightness(0.9);
}

.icon-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 24px;
}

.service-card h3 {
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--secondary-color);
}

.service-card p {
  color: var(--text-light);
  font-size: 13px;
  margin-bottom: 12px;
  flex-grow: 1;
  line-height: 1.5;
}

.card-url {
  font-size: 12px;
  color: var(--primary-color);
  font-weight: 500;
  padding-top: 12px;
  border-top: 1px solid var(--border-color);
  display: block;
}

/* ============================================
   FOOTER
   ============================================ */

.footer {
  background-color: rgba(15, 23, 42, var(--bg-opacity));
  color: white;
  text-align: center;
  padding: 20px;
  margin-top: auto;
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer p {
  font-size: 13px;
  color: #94a3b8;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .user-section {
    width: 100%;
    justify-content: space-between;
  }

  .services-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .login-box {
    padding: 30px 20px;
  }

  .logo-section h1 {
    font-size: 20px;
  }

  .container {
    padding: 20px 16px;
  }
}

/* ============================================
   PANEL DE ADMINISTRACIÓN
   ============================================ */

.admin-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 20px;
  flex: 1;
  width: 100%;
}

.admin-panel {
  background: rgba(255, 255, 255, var(--bg-opacity));
  border-radius: 12px;
  padding: 30px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.admin-panel h2 {
  font-size: 28px;
  margin-bottom: 10px;
  color: var(--secondary-color);
}

.admin-subtitle {
  color: var(--text-light);
  margin-bottom: 25px;
}

.admin-section {
  margin-bottom: 35px;
  padding-bottom: 25px;
  border-bottom: 1px solid var(--border-color);
}

.admin-section:last-of-type {
  border-bottom: none;
}

.admin-section h3 {
  font-size: 18px;
  margin-bottom: 20px;
  color: var(--secondary-color);
}

.alert {
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
  border-left: 4px solid;
  display: none;
  backdrop-filter: blur(5px);
}

.alert:not(:empty) {
  display: block;
}

.alert strong {
  display: block;
  margin-bottom: 5px;
}

.alert-error {
  background-color: #fee2e2;
  color: #991b1b;
  border-left-color: #dc2626;
}

.alert-success {
  background-color: #dcfce7;
  color: #166534;
  border-left-color: #22c55e;
}

/* Formulario de administración */

.admin-form {
  background-color: rgba(249, 250, 251, var(--bg-opacity-light));
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  backdrop-filter: blur(5px);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 15px;
  margin-bottom: 15px;
}

.admin-form .form-group {
  display: flex;
  flex-direction: column;
}

.admin-form .form-group label {
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-color);
  font-size: 14px;
}

.admin-form .form-group input[type="text"],
.admin-form .form-group input[type="password"] {
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 14px;
  transition: var(--transition);
  font-family: inherit;
}

.admin-form .form-group input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.form-group-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary-color);
}

.form-group-checkbox label {
  cursor: pointer;
  font-weight: 500;
}

/* Tabla de usuarios */

.users-table-container {
  overflow-x: auto;
  margin-bottom: 20px;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  background-color: rgba(255, 255, 255, var(--bg-opacity-light));
}

.users-table thead {
  background-color: rgba(249, 250, 251, var(--bg-opacity));
  border-bottom: 2px solid rgba(229, 231, 235, 0.5);
}

.users-table th {
  padding: 12px;
  text-align: left;
  font-weight: 600;
  color: var(--secondary-color);
  font-size: 14px;
}

.users-table td {
  padding: 12px;
  border-bottom: 1px solid rgba(229, 231, 235, 0.5);
  font-size: 14px;
}

.users-table tr:hover {
  background-color: rgba(249, 250, 251, 0.5);
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.badge-admin {
  background-color: #fef08a;
  color: #854d0e;
}

.badge-user {
  background-color: #dbeafe;
  color: #0c4a6e;
}

.badge-current {
  background-color: #d1fae5;
  color: #065f46;
  margin-left: 8px;
}

.delete-form {
  margin: 0;
}

.text-muted {
  color: var(--text-light);
}

.no-users {
  text-align: center;
  color: var(--text-light);
  padding: 20px;
  font-style: italic;
}

/* Información */

.admin-info {
  background-color: #eff6ff;
  padding: 15px;
  border-radius: 8px;
  border-left: 4px solid var(--primary-color);
  margin-top: 20px;
}

.admin-info h4 {
  color: #0c4a6e;
  margin-bottom: 10px;
}

.admin-info ul {
  list-style: none;
  padding-left: 0;
}

.admin-info li {
  color: #0c4a6e;
  margin-bottom: 6px;
  font-size: 14px;
  padding-left: 20px;
  position: relative;
}

.admin-info li:before {
  content: "✓";
  position: absolute;
  left: 0;
  font-weight: bold;
}

/* Página de error */

.error-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}

.error-box {
  background: rgba(255, 255, 255, var(--bg-opacity));
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  max-width: 500px;
  width: 100%;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.error-icon {
  font-size: 48px;
  margin-bottom: 20px;
}

.error-box h1 {
  font-size: 28px;
  margin-bottom: 10px;
  color: var(--secondary-color);
}

.error-box p {
  color: var(--text-light);
  margin-bottom: 25px;
}

/* Setup */

.setup-description {
  background-color: #eff6ff;
  padding: 15px;
  border-radius: 8px;
  color: #0c4a6e;
  margin-bottom: 20px;
  border-left: 4px solid var(--primary-color);
  font-size: 14px;
}

.setup-warning {
  background-color: #fef3c7;
  padding: 15px;
  border-radius: 8px;
  color: #92400e;
  border-left: 4px solid #f59e0b;
  margin-top: 25px;
}

.setup-warning strong {
  display: block;
  margin-bottom: 10px;
}

.setup-warning ul {
  list-style: none;
  padding-left: 0;
  font-size: 14px;
}

.setup-warning li {
  margin-bottom: 6px;
  padding-left: 20px;
  position: relative;
}

.setup-warning li:before {
  content: "!";
  position: absolute;
  left: 0;
  font-weight: bold;
}

/* ============================================
   RESPONSIVE - ADMIN
   ============================================ */

@media (max-width: 768px) {
  .admin-panel {
    padding: 20px;
  }

  .admin-container {
    padding: 20px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .users-table {
    font-size: 12px;
  }

  .users-table th,
  .users-table td {
    padding: 8px;
  }

  .btn-delete {
    padding: 4px 8px;
    font-size: 11px;
  }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .user-section {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
  }

  .services-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .login-box {
    padding: 30px 20px;
  }

  .logo-section h1 {
    font-size: 20px;
  }

  .container {
    padding: 20px 16px;
  }
}

@media (max-width: 480px) {
  .login-box h1 {
    font-size: 24px;
  }

  .services-grid {
    grid-template-columns: 1fr;
  }

  .btn-logout,
  .btn-admin,
  .btn-back {
    padding: 6px 12px;
    font-size: 12px;
  }

  .user-name {
    font-size: 12px;
  }

  .admin-panel {
    padding: 15px;
  }

  .admin-panel h2 {
    font-size: 22px;
  }

  .error-box {
    padding: 25px;
  }

  .error-box h1 {
    font-size: 22px;
  }
}
