/* =============================================
   THE ICE - Sistema de Pedidos
   Estilos base extraídos del módulo HubSpot
   ============================================= */

* {
  box-sizing: border-box;
}

body {
  background: url('https://theice.cl/hubfs/theice-emails/bg1.jpg') no-repeat center center fixed;
  background-size: cover;
  color: #333;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  min-height: 100vh;
}

/* Contenedores principales */
.container, .order-form, #superAdminControls {
  max-width: 1200px;
  margin: 20px auto;
  padding: 20px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#superAdminControls {
  background: #eef2ff;
}

/* Tipografía */
h2, h3 {
  color: #111827;
  margin-top: 0;
}

/* Formularios */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.form-group.fixed-width {
  flex: 0 0 100px;
}

.form-group.price-width {
  flex: 0 0 130px;
}

.form-group label {
  font-size: 14px;
  color: #374151;
  font-weight: 500;
  margin-bottom: 2px;
}

select, 
input[type="text"], 
input[type="email"], 
input[type="password"],
input[type="number"], 
input[type="date"] {
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  width: 100%;
  box-sizing: border-box;
}

input:disabled {
  background-color: #f3f4f6;
  color: #6b7280;
  font-weight: normal;
  cursor: not-allowed;
}

input:focus, select:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Líneas de pedido */
.order-line {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  align-items: center;
}

/* Botones */
.button-container {
  margin-top: 20px;
  display: flex;
  gap: 12px;
  justify-content: flex-start;
}

button, .button {
  padding: 10px 18px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

button:hover, .button:hover {
  opacity: 0.9;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.add-button {
  background-color: #4f46e5;
  color: white;
}

.add-button:hover {
  background-color: #4338ca;
}

.submit-button-global {
  background-color: #ec4899;
  color: white;
  width: 100%;
  font-size: 16px;
  padding: 12px;
}

.submit-button-global:hover {
  background-color: #db2777;
}

.delete-button {
  background: transparent;
  border: none;
  padding: 8px;
  color: #ef4444;
  cursor: pointer;
  line-height: 1;
}

.delete-button:hover {
  color: #dc2626;
  background-color: #fee2e2;
}

.delete-button svg {
  width: 20px;
  height: 20px;
}

/* Login */
.login-container {
  max-width: 400px;
  margin: 80px auto;
  padding: 40px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.login-container h1 {
  text-align: center;
  margin-bottom: 8px;
  color: #111827;
}

.login-container .subtitle {
  text-align: center;
  color: #6b7280;
  margin-bottom: 32px;
}

.login-container .logo {
  display: block;
  margin: 0 auto 24px;
  max-width: 150px;
}

.login-form .form-group {
  margin-bottom: 16px;
}

.login-button {
  background-color: #4f46e5;
  color: white;
  width: 100%;
  padding: 12px;
  font-size: 16px;
  margin-top: 8px;
}

.login-button:hover {
  background-color: #4338ca;
}

.login-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 14px;
  color: #6b7280;
}

.login-footer a {
  color: #4f46e5;
  text-decoration: none;
}

.login-footer a:hover {
  text-decoration: underline;
}

.error-message {
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 14px;
  display: none;
}

.error-message.show {
  display: block;
}

.success-message {
  background-color: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #16a34a;
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 16px;
  font-size: 14px;
  display: none;
}

.success-message.show {
  display: block;
}

/* Tablas */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  font-size: 14px;
}

th, td {
  border: 1px solid #e5e7eb;
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
}

thead th {
  background-color: #f3f4f6;
  font-weight: 600;
  color: #374151;
}

#myOrdersTable thead th {
  background-color: #4b5563;
  color: white;
}

td[data-label="Subtotal"], 
td[data-label="Unitario"], 
td[data-label="Total c/ IVA"] {
  text-align: right;
}

td[data-label="Cantidad"], 
td[data-label="Ítems"], 
td[data-label="Guía"], 
td[data-label="Ticket HubSpot"] {
  text-align: center;
}

tbody tr:nth-child(odd) {
  background-color: #f9fafb;
}

tbody tr:hover {
  background-color: #f0f9ff;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(240, 242, 245, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal-content {
  background: white;
  padding: 40px;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  text-align: center;
  max-width: 90%;
}

.modal-image {
  width: 300px;
  height: 300px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 20px;
}

.modal-text {
  font-size: 20px;
  font-weight: 500;
  color: #333;
}

/* Utilidades */
.hidden {
  display: none !important;
}

.user-info {
  display: none;
}

.mt-2 {
  margin-top: 8px;
}

/* Header del usuario logueado */
.user-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: white;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 20px;
}

.user-header .user-info-display {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-header .user-email {
  font-size: 14px;
  color: #374151;
}

.user-header .company-name {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}

.logout-button {
  background-color: #f3f4f6;
  color: #374151;
  padding: 8px 16px;
  font-size: 13px;
}

.logout-button:hover {
  background-color: #e5e7eb;
}

/* Responsive */
@media (max-width: 768px) {
  .order-line {
    flex-direction: column;
    align-items: stretch;
  }
  
  .form-group.fixed-width,
  .form-group.price-width {
    flex: 1;
  }
  
  .login-container {
    margin: 20px;
    padding: 24px;
  }
  
  .container, .order-form {
    margin: 10px;
    padding: 16px;
  }
}

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 0.8s linear infinite;
  margin-right: 8px;
}

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