* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  min-height: 100vh;
  padding: 20px;
  line-height: 1.6;
}

.container {
  max-width: 500px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(226, 232, 240, 0.8);
}

.container-wide {
  max-width: 1200px;
}

.header {
  background: linear-gradient(135deg, #64748b, #475569);
  color: white;
  padding: 30px 25px;
  text-align: center;
  position: relative;
}

.admin-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  color: white;
  text-decoration: none;
}

.admin-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.admin-icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

h1 {
  font-size: 1.8rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.subtitle {
  opacity: 0.9;
  font-size: 0.95rem;
}

.form-container {
  padding: 30px 25px;
}

.form-group {
  margin-bottom: 20px;
  position: relative;
}

label {
  display: block;
  margin-bottom: 8px;
  color: #475569;
  font-weight: 500;
  font-size: 0.9rem;
}

input, textarea, select {
  width: 100%;
  padding: 15px 18px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 16px;
  transition: all 0.3s ease;
  background: #f8fafc;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: #64748b;
  background: white;
  box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.1);
  transform: translateY(-1px);
}

input:valid, textarea:valid, select:valid {
  border-color: #10b981;
}

.submit-btn, .btn {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, #64748b, #475569);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.submit-btn:hover, .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(100, 116, 139, 0.3);
  background: linear-gradient(135deg, #475569, #334155);
}

.submit-btn:active, .btn:active {
  transform: translateY(0);
}

.submit-btn:disabled, .btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: linear-gradient(135deg, #6b7280, #4b5563);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #059669);
}

/* Loading animation */
.loading {
  position: relative;
}

.loading::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
}

@keyframes spin {
  0% { transform: translateY(-50%) rotate(0deg); }
  100% { transform: translateY(-50%) rotate(360deg); }
}

/* Messages */
.message {
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-weight: 500;
  text-align: center;
}

.message.success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.message.error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.message.warning {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

/* Form validation styles */
.form-group.error input,
.form-group.error textarea,
.form-group.error select {
  border-color: #ef4444;
  background: #fef2f2;
}

.form-group.error label {
  color: #ef4444;
}

/* Tables */
.table-container {
  overflow-x: auto;
  margin: 20px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

th, td {
  padding: 12px 15px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

th {
  background: #f8fafc;
  font-weight: 600;
  color: #475569;
}

tr:hover {
  background: #f8fafc;
}

/* Navigation */
.nav {
  background: white;
  padding: 15px 25px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-links {
  display: flex;
  gap: 20px;
}

.nav-link {
  color: #64748b;
  text-decoration: none;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.nav-link:hover, .nav-link.active {
  background: #f1f5f9;
  color: #334155;
}

/* Dashboard Cards */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin: 20px 0;
}

.dashboard-card {
  background: white;
  padding: 25px;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.dashboard-card h3 {
  color: #64748b;
  font-size: 0.9rem;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dashboard-card .number {
  font-size: 2.5rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 5px;
}

.dashboard-card .description {
  color: #64748b;
  font-size: 0.9rem;
}

/* Status badges */
.status-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
}

.status-pendiente {
  background: #fef3c7;
  color: #92400e;
}

.status-firmado {
  background: #d1fae5;
  color: #065f46;
}

.status-cancelado {
  background: #fee2e2;
  color: #991b1b;
}

/* Action buttons */
.action-buttons {
  display: flex;
  gap: 8px;
}

.action-btn {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.action-btn-view {
  background: #3b82f6;
  color: white;
}

.action-btn-edit {
  background: #f59e0b;
  color: white;
}

.action-btn-delete {
  background: #ef4444;
  color: white;
}

/* Responsive Design */
@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  .container {
    margin: 10px auto;
    border-radius: 15px;
  }

  .header {
    padding: 25px 20px;
  }

  h1 {
    font-size: 1.5rem;
  }

  .form-container {
    padding: 25px 20px;
  }

  .nav {
    flex-direction: column;
    gap: 15px;
  }

  .nav-links {
    flex-wrap: wrap;
    justify-content: center;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .action-buttons {
    flex-direction: column;
  }

  /* --- INICIO: CÓDIGO AÑADIDO PARA ARREGLAR VISUALIZACIÓN EN CELULARES --- */

  /*
   * Esto anula el estilo de dos columnas en los datos del cliente
   * y lo convierte en una sola columna para que no se superponga.
   */
  div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important; /* ¡La clave está aquí! */
    gap: 12px !important;
  }
  /* --- FIN: CÓDIGO AÑADIDO --- */
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  body {
    background: linear-gradient(135deg, #1f2937 0%, #374151 100%);
  }
  
  .container {
    background: rgba(31, 41, 55, 0.95);
    color: #f9fafb;
  }
  
  label {
    color: #d1d5db;
  }
  
  input, textarea, select {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
  }
  
  input:focus, textarea:focus, select:focus {
    background: #4b5563;
  }

  table {
    background: #374151;
  }

  th {
    background: #4b5563;
    color: #d1d5db;
  }

  .dashboard-card {
    background: #374151;
  }
}
