/* ============================================================
   public/assets/css/app.css  –  Sistema de Diseño Cementos Tequendama v2.0
   Materialize CSS overrides + Custom Tokens
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700;900&display=swap');
@import url('https://fonts.googleapis.com/icon?family=Material+Icons+Round');

/* ── 1. CSS Custom Properties (Tokens) ── */
:root {
  /* Colores primarios */
  --primary-color: #E31E24;
  /* Rojo Tequendama */
  --primary-dark: #C41E3A;
  /* Rojo Oscuro */
  --primary-light: #FEF2F2;
  /* Fondo rojo claro / hover sutil */
  --secondary-color: #0066CC;
  /* Azul Corporativo */

  /* Colores Neutros */
  --text-main: #111827;
  /* Negro */
  --text-muted: #808080;
  /* Gris Medio */
  --bg-dark: #333333;
  /* Carbón (Footer) */
  --bg-light: #F5F5F5;
  /* Gris Claro */
  --surface: #FFFFFF;
  /* Blanco */
  --border-color: #E5E7EB;

  /* Estados Semánticos */
  --success: #10B981;
  --success-bg: #D1FAE5;
  --success-text: #047857;
  --warning: #F59E0B;
  --warning-bg: #FEF3C7;
  --warning-text: #D97706;
  --error: #E31E24;
  --error-bg: #FEE2E2;
  --error-text: #C41E3A;
  --info: #0066CC;
  --info-bg: #DBEAFE;
  --info-text: #1D4ED8;

  /* Sombras */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-card: 0 4px 8px rgba(0, 0, 0, 0.12);
  --shadow-brand: 0 8px 32px rgba(227, 30, 36, 0.15);

  /* Radios de borde (Industrial-Digital) */
  --radius-none: 0px;
  --radius-sm: 4px;
  /* Botones, inputs */
  --radius-md: 8px;
  /* Tarjetas secundarias */
  --radius-lg: 12px;
  /* Tarjetas principales */
  --radius-xl: 16px;
  --radius-full: 9999px;
  /* Chips, avatares */

  /* Transiciones */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-norm: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  font-family: 'Roboto', Arial, system-ui, sans-serif;
  background: var(--bg-light);
  color: var(--text-main);
  margin: 0;
  min-height: 100vh;
}

/* ── 2. Tipografía & Layout base ── */
h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--text-main);
  font-weight: 700;
}

.text-uppercase {
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.text-xs {
  font-size: 0.75rem;
}

.text-sm {
  font-size: 0.875rem;
}

/* ── 3. Componentes Nucleares ── */

/* Iconos */
.material-icons-round {
  color: var(--primary-color);
}

.btn .material-icons-round,
.btn-large .material-icons-round,
.btn-outline .material-icons-round,
.btn-flat .material-icons-round,
.badge-estado .material-icons-round,
.flash-message .material-icons-round,
nav .brand-logo .material-icons-round {
  color: inherit;
}

/* Botones Principales (#E31E24) */
.btn,
.btn-large {
  background-color: var(--primary-color) !important;
  color: #FFFFFF !important;
  border-radius: var(--radius-sm) !important;
  font-weight: 700 !important;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  box-shadow: none !important;
  transition: all var(--transition-fast) !important;
}

.btn:hover,
.btn-large:hover {
  background-color: var(--primary-dark) !important;
  transform: translateY(-1px);
  box-shadow: var(--shadow-brand) !important;
}

/* Botones Secundarios (Outline) */
.btn-outline,
.btn-flat {
  background: transparent !important;
  border: 1px solid var(--primary-color) !important;
  color: var(--primary-color) !important;
  border-radius: var(--radius-sm) !important;
  font-weight: 700 !important;
  box-shadow: none !important;
  transition: background var(--transition-fast) !important;
}

.btn-outline:hover,
.btn-flat:hover {
  background: var(--primary-light) !important;
  box-shadow: none !important;
}


/* ── 4. Navegación (Materialize overrides) ── */
nav {
  background: var(--surface) !important;
  box-shadow: var(--shadow-sm);
  border-bottom: 4px solid var(--primary-color);
}

nav .brand-logo {
  font-weight: 900;
  color: var(--text-main) !important;
  letter-spacing: -0.5px;
}

nav a,
nav .sidenav-trigger {
  color: var(--text-main) !important;
  font-weight: 500;
  transition: color var(--transition-fast);
}

nav a:hover,
nav .sidenav-trigger:hover {
  color: var(--primary-color) !important;
}

/* Sidebar (Materialize Sidenav) */
.sidenav {
  width: 260px;
  background: var(--surface);
  border-right: 1px solid var(--border-color);
}

.sidenav .user-view {
  background: var(--bg-dark);
  padding: 24px 16px;
  border-bottom: 4px solid var(--primary-color);
}

.sidenav .user-view .name,
.sidenav .user-view .email {
  color: #FFFFFF;
  font-weight: 500;
}

.sidenav li>a {
  font-weight: 500;
  color: var(--text-main);
  border-radius: 0;
  border-left: 4px solid transparent;
  transition: all var(--transition-fast);
}

.sidenav li>a:hover {
  background: var(--bg-light);
  color: var(--text-main);
}

.sidenav li>a.active {
  background: var(--primary-light);
  color: var(--primary-color);
  border-left: 4px solid var(--primary-color);
}

.sidenav li>a .material-icons-round {
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.sidenav li>a.active .material-icons-round {
  color: var(--primary-color);
}

.sidenav li>a:hover .material-icons-round {
  color: var(--text-main);
}


/* ── 5. Tarjetas (Cards) ── */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-card) !important;
  border: 1px solid var(--bg-light);
  transition: box-shadow var(--transition-norm), border-color var(--transition-norm);
}

.card:hover {
  box-shadow: var(--shadow-lg) !important;
  border-color: var(--border-color);
}

.card .card-title {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-main);
}

/* Tarjetas de Métrica / KPIs */
.stat-card {
  border-radius: var(--radius-lg);
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.stat-card .stat-value {
  font-size: 2.5rem;
  font-weight: 900;
  /* Extra bold para números */
  line-height: 1.2;
  color: var(--primary-color);
}

.stat-card .stat-label {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-top: 4px;
}

.stat-card .material-icons-round {
  font-size: 2.5rem;
  color: var(--border-color);
  position: absolute;
  right: 20px;
  top: 24px;
}


/* ── 6. Inputs & Formularios ── */
.input-field label {
  color: var(--text-muted) !important;
  font-weight: 500;
}

.input-field input,
.input-field textarea {
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-sm) !important;
  padding: 10px 14px !important;
  box-sizing: border-box !important;
  height: auto !important;
  box-shadow: none !important;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast) !important;
}

.input-field input:focus,
.input-field textarea:focus {
  border-color: var(--primary-color) !important;
  box-shadow: 0 0 0 3px rgba(227, 30, 36, 0.15) !important;
  /* Ring rojo */
  border-bottom: 1px solid var(--primary-color) !important;
}

.input-field input:focus+label,
.input-field textarea:focus+label {
  color: var(--primary-color) !important;
}

.select-wrapper input.select-dropdown {
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-sm) !important;
  padding: 10px 14px !important;
  height: auto !important;
}

.select-wrapper input.select-dropdown:focus {
  border-color: var(--primary-color) !important;
}


/* ── 7. Tablas ── */
.responsive-table {
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  background: var(--surface);
}

table thead {
  background: var(--bg-light);
  border-bottom: 2px solid var(--border-color);
}

table thead th {
  color: var(--text-main) !important;
  font-weight: 700;
  padding: 16px;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}

table tbody tr {
  transition: background var(--transition-fast);
}

table tbody tr:hover {
  background: var(--bg-light);
}

table tbody td {
  vertical-align: middle;
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
}


/* ── 8. Status Badges (Etiquetas) ── */
.badge-estado {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge-PENDIENTE {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.badge-PROGRAMADA {
  background: var(--info-bg);
  color: var(--info-text);
}

.badge-RECOLECTADA {
  background: var(--success-bg);
  color: var(--success-text);
}

.badge-CANCELADA {
  background: var(--error-bg);
  color: var(--error-text);
}


/* ── 9. Flash messages (Alertas) ── */
.flash-message {
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.flash-success {
  background: var(--success-bg);
  color: var(--success-text);
  border-left: 4px solid var(--success);
}

.flash-error {
  background: var(--error-bg);
  color: var(--error-text);
  border-left: 4px solid var(--error);
}

.flash-info {
  background: var(--info-bg);
  color: var(--info-text);
  border-left: 4px solid var(--info);
}


/* ── 10. Layout Común ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 16px;
}

.page-header h4 {
  margin: 0;
  font-weight: 900;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 12px;
  text-transform: uppercase;
  font-size: 1.75rem;
}

.page-header h4 .material-icons-round {
  font-size: 2rem;
  color: var(--primary-color);
}

.main-content {
  padding: 32px 16px;
  max-width: 1200px;
  margin: 0 auto;
}

/* Filter Bar */
.filters-bar {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
}

/* Modales */
.modal {
  border-radius: var(--radius-lg) !important;
}

.modal .modal-footer {
  border-top: 1px solid var(--border-color);
  background: var(--bg-light);
}

/* Map container */
#map {
  height: 560px;
  border-radius: var(--radius-none);
  border: 1px solid var(--border-color);
  z-index: 0;
}

/* Upload Zone */
.upload-zone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--surface);
}

.upload-zone:hover {
  border-color: var(--primary-color);
  background: var(--primary-light);
}

.upload-zone .material-icons-round {
  font-size: 3rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.foto-preview {
  display: none;
  width: 100%;
  max-height: 300px;
  object-fit: cover;
  border-radius: var(--radius-md);
  margin-top: 16px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
}

.foto-preview.visible {
  display: block;
  animation: fadeIn var(--transition-norm);
}

.foto-preview:hover {
  transform: scale(1.01);
}


/* ── 11. Login Page (Hero styling) ── */
.login-page {
  min-height: 100vh;
  background: #f8f9fa;
  /* Light, clean background */
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-page::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(circle at 0% 0%, rgba(227, 30, 36, 0.03) 0%, transparent 40%),
    radial-gradient(circle at 100% 100%, rgba(227, 30, 36, 0.05) 0%, transparent 40%);
  pointer-events: none;
}

.login-card {
  width: 100%;
  max-width: 440px;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-brand) !important;
  overflow: hidden;
  background: var(--surface);
  position: relative;
  z-index: 10;
}

.login-card .login-header {
  background: var(--surface);
  padding: 40px 32px 24px;
  text-align: center;
  color: var(--text-main);
  border-bottom: 4px solid var(--primary-color);
}

.login-card .login-header img {
  width: auto;
  height: 50px;
  margin-bottom: 16px;
}

.login-card .login-header h5 {
  margin: 0;
  font-weight: 900;
  color: var(--text-main);
}

.login-card .login-header p {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.login-card .card-content {
  padding: 32px !important;
}

.login-card .card-action {
  padding: 0 32px 40px !important;
  border-top: none !important;
}

.login-card .btn {
  width: 100%;
  border-radius: var(--radius-sm) !important;
  height: 48px;
  font-size: 1rem !important;
}

/* ── Utilities & Animations ── */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

.animate-in {
  animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 600px) {
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .stat-card {
    margin-bottom: 16px;
  }

  #map {
    height: 380px;
  }
}

/* ========================================================================= */
/* 12. Ajustes Awesomplete (Buscador dropdown)                               */
/* ========================================================================= */
.awesomplete {
  width: 100% !important;
  display: block !important;
}

/* Ajustar el input que está dentro de awesomplete para que se comporte como en Materialize */
.awesomplete>input {
  width: 100% !important;
  margin-bottom: 8px !important;
  padding-left: 2.5rem !important;
  /* Espacio para el icono de Materialize */
}

/* Modificar el contenedor de la lista */
.awesomplete>ul {
  width: 100%;
  margin-top: 0;
  max-height: 300px;
  overflow-y: auto;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  z-index: 1000;
}

/* Estilo individual para las opciones */
.awesomplete>ul>li {
  padding: 14px 16px;
  font-size: 0.95rem;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-color);
  line-height: 1.4;
  /* Mejora la legibilidad de textos largos */
  white-space: normal;
  /* Permite que el texto se rompa en varias líneas si es muy largo */
}

.awesomplete>ul>li:last-child {
  border-bottom: none;
}

/* Hover y selección activa */
.awesomplete>ul>li:hover,
.awesomplete>ul>li[aria-selected="true"] {
  background-color: var(--primary-light);
  color: var(--primary-color);
  font-weight: 500;
}

/* Lo que coincide al escribir */
.awesomplete mark {
  background: transparent;
  color: var(--primary-dark);
  font-weight: 900;
  text-decoration: underline;
}