/* ================================
   FUENTE GENERAL
================================ */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap');

body {
    font-family: 'Poppins', sans-serif;
    background-color: #f4f7f6;
    margin: 0;
    padding: 0;
}

/* ================================
   CONTENEDOR LOGIN
================================ */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

/* ================================
   TARJETA LOGIN
================================ */
.login-card {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border-radius: 15px;
    border: none;
    background: white;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
}

/* ================================
   LOGO
================================ */
.logo-container {
    margin-bottom: 1.2rem;
    text-align: center;
}

.logo-img {
    max-width: 120px;
    height: auto;
}

/* ================================
   ICONO USUARIO
================================ */
.user-icon {
    color: #017DB0;
    font-size: 4rem;
    margin-bottom: 1rem;
}

/* ================================
   TITULOS
================================ */
.login-card .card-title {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    text-align: center;
}

.login-card .text-muted {
    font-size: 1rem;
    margin-bottom: 2rem;
    text-align: center;
}

/* ================================
   INPUTS
================================ */
.login-card .input-group {
    margin-bottom: 1.5rem;
}

.login-card .input-group-text {
    background-color: #e9ecef;
    border: 1px solid #ced4da;
    min-width: 50px;
    justify-content: center;
    font-size: 1.2rem;
    border-radius: 8px 0 0 8px;
}

.login-card .form-control {
    min-height: 50px;
    font-size: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 0 8px 8px 0;
}

.login-card .form-control::placeholder {
    color: #6c757d;
}

.login-card .form-control:focus {
    box-shadow: none;
    border-color: #86b7fe;
}

/* ================================
   BOTÓN
================================ */
.login-card .btn-primary {
    background-color: #017DB0;
    border-color: #017DB0;
    padding: 0.75rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 10px;
    margin-top: 0.5rem;
    min-height: 50px;
    transition: all 0.3s ease;
}

.login-card .btn-primary:hover {
    background-color: #015a7a;
    border-color: #015a7a;
    transform: translateY(-2px);
}

/* ================================
   ALERTAS
================================ */
.alert {
    border-radius: 10px;
    font-size: 0.95rem;
}

/* ================================
   RESPONSIVE
================================ */
@media (max-width: 576px) {
    .login-container {
        padding: 0.5rem;
    }

    .login-card {
        max-width: 100%;
    }

    .user-icon {
        font-size: 3.2rem;
    }

    .login-card .card-title {
        font-size: 1.5rem;
    }

    .login-card .text-muted {
        font-size: 0.9rem;
    }

    .login-card .form-control {
        min-height: 45px;
        font-size: 0.95rem;
    }

    .login-card .btn-primary {
        font-size: 1rem;
        min-height: 45px;
    }
}

/* ================================
   SIDEBAR
================================ */
.sidebar {
    min-height: 100vh;
    background: linear-gradient(135deg, #017DB0 0%, #015a7a 100%);
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}

.sidebar-icon {
    font-size: 3rem;
    color: white;
}

.sidebar .nav-link {
    color: rgba(255,255,255,0.85);
    padding: 0.9rem 1.5rem;
    border-radius: 8px;
    margin: 0.2rem 0.5rem;
    transition: all 0.3s ease;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background-color: rgba(255,255,255,0.15);
    color: white;
    transform: translateX(5px);
}

.sidebar .nav-link i {
    margin-right: 0.5rem;
}

/* ================================
   HEADER
================================ */
.main-header {
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-bottom: 3px solid #017DB0;
    border-radius: 15px;
    margin: 1.5rem 1rem 2rem 1rem;
    padding: 1rem 2rem;
}

.main-title {
    font-size: 1.7rem;
    font-weight: 700;
    margin: 0;
}

.main-subtitle {
    font-size: 0.9rem;
    color: #6c757d;
    font-style: italic;
    margin: 0;
}

/* ================================
   KPIs
================================ */
.stats-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin: 0 1rem 2rem 1rem;
}

.stat-card {
    border-radius: 12px;
    border: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    height: 90px;
    display: flex;
    overflow: hidden;
}

.stat-left {
    width: 60%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    text-align: center;
    padding: 1rem;
    font-size: 0.85rem;
    text-transform: uppercase;
}

.stat-right {
    width: 40%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-value {
    font-size: 2.2rem;
    font-weight: 700;
}

/* Colores */
.stat-card.total-pedidos .stat-left { background: linear-gradient(135deg,#6a757d,#8a9197); }
.stat-card.pendientes .stat-left { background: linear-gradient(135deg,#eec007,#ffed39); color:#212529; }
.stat-card.completadas .stat-left { background: linear-gradient(135deg,#0d6efd,#3dd5f3); }
.stat-card.en-proceso .stat-left { background: linear-gradient(135deg,#000DB0,#0d6efd); }

/* ================================
   ANIMACIÓN
================================ */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity:0; transform: translateY(20px); }
    to { opacity:1; transform: translateY(0); }
}

/* ================================
   RESPONSIVE
================================ */
@media (max-width: 992px) {
    .stats-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .stats-container {
        grid-template-columns: 1fr;
    }
}

/* ================================
   ESTILOS PARA EL MAPA (POSTES)
================================ */

/* Contenedor del mapa */
#map {
    height: 600px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 1rem;
}

/* Controles del mapa */
.map-controls {
    background: white;
    padding: 10px 15px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 1rem;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Marcador personalizado para postes */
.poste-marker {
    background-color: #017DB0;
    color: white;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border: 3px solid white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    cursor: pointer;
}

/* Popup del mapa (info emergente) */
.leaflet-popup-content {
    min-width: 200px;
}

.leaflet-popup-content h6 {
    color: #017DB0;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* Responsive del mapa */
@media (max-width: 768px) {
    #map {
        height: 400px;
    }
    
    .map-controls {
        flex-direction: column;
    }
    
    .map-controls .btn {
        width: 100%;
    }
}

/* ================================
   ESTILOS PARA CONFIGURACIÓN
================================ */

/* Pestañas */
.nav-tabs .nav-link {
    color: #6c757d;
    font-weight: 500;
    border: none;
    padding: 0.75rem 1.5rem;
}

.nav-tabs .nav-link.active {
    color: #017DB0;
    border-bottom: 3px solid #017DB0;
    background-color: transparent;
}

.nav-tabs .nav-link:hover {
    color: #015a7a;
}

/* Tarjetas de configuración */
.config-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    margin-bottom: 1.5rem;
}

.config-card .card-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    font-weight: 600;
    color: #017DB0;
}

/* Alertas flotantes */
.alert-flotante {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    min-width: 300px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

/* ================================
   ESTILOS PARA PEDIDOS MEJORADO
================================ */

/* Pestañas personalizadas */
.btn-group .btn.active {
    background-color: #017DB0;
    color: white;
    border-color: #017DB0;
}

/* Badges en pestañas */
.btn-group .badge {
    font-size: 0.7em;
    margin-left: 5px;
}

/* Tarjetas de estadísticas */
.stats-container .stat-card {
    cursor: pointer;
    transition: transform 0.2s;
}

.stats-container .stat-card:hover {
    transform: translateY(-5px);
}

/* Estados de pedidos */
.badge-estado {
    padding: 0.4em 0.8em;
    border-radius: 20px;
    font-size: 0.85em;
}

.estado-ingresado {
    background-color: #6c757d;
    color: white;
}

.estado-asignado {
    background-color: #ffc107;
    color: black;
}

.estado-aceptado {
    background-color: #0dcaf0;
    color: black;
}

.estado-proceso {
    background-color: #0d6efd;
    color: white;
}

.estado-finalizado {
    background-color: #198754;
    color: white;
}

.estado-cancelado {
    background-color: #dc3545;
    color: white;
}

.estado-rechazado {
    background-color: #6c757d;
    color: white;
}

/* Acciones rápidas */
.acciones-rapidas {
    display: flex;
    gap: 5px;
}

.acciones-rapidas .btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Modal de detalles */
#detallesPedidoContenido {
    max-height: 60vh;
    overflow-y: auto;
}

.detalle-item {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.detalle-item:last-child {
    border-bottom: none;
}

.detalle-label {
    font-weight: 600;
    color: #017DB0;
    display: block;
    margin-bottom: 0.25rem;
}

.detalle-valor {
    color: #495057;
}

/* ================================
   ESTILOS PARA GEOLOCALIZACIÓN
================================ */

/* Botón de geolocalización */
.btn-geolocalizacion {
    border: 2px dashed #017DB0;
    background-color: rgba(1, 125, 176, 0.1);
    transition: all 0.3s ease;
}

.btn-geolocalizacion:hover {
    background-color: rgba(1, 125, 176, 0.2);
    border-color: #015a7a;
    transform: scale(1.02);
}

/* Indicador de carga para geolocalización */
.geoloading {
    position: relative;
    color: transparent !important;
}

.geoloading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #017DB0;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Mensaje de coordenadas en textarea */
.coordenadas-agregadas {
    background-color: #e8f4fd;
    border-left: 4px solid #017DB0;
    padding: 5px 10px;
    margin: 5px 0;
    font-family: monospace;
    font-size: 0.9em;
}

/* ================================
   GEOLOCALIZACIÓN MEJORADA
================================ */

/* Grupo de inputs para coordenadas */
.input-group .btn {
    padding: 0.375rem 0.75rem;
}

/* Mapa de selección */
#mapaSeleccion {
    z-index: 1;
}

/* Botones de acción en mapa */
.btn-mapa-accion {
    margin: 5px;
    padding: 5px 10px;
    font-size: 0.9em;
}

/* Indicador de coordenadas */
.coordenadas-activas {
    background-color: #e8f4fd;
    border: 1px solid #017DB0;
}

/* Tooltip para botones de ubicación */
.btn[title] {
    position: relative;
}

.btn[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8em;
    white-space: nowrap;
    z-index: 1000;
}

/* Responsive para mapa */
@media (max-width: 768px) {
    #contenedorMapaSeleccion {
        height: 250px;
    }
}

/* ================================
   ESTILOS PARA GEOLOCALIZACIÓN EN POSTES
================================ */

/* Inputs de coordenadas */
.input-group-text {
    font-family: monospace;
    font-weight: bold;
    min-width: 50px;
    justify-content: center;
}

/* Mapa interactivo dentro del modal */
#mapaInteractivoPoste {
    z-index: 1;
}

/* Marcador interactivo personalizado */
.poste-marker-interactivo {
    background: transparent;
    border: none;
}

/* Badge de coordenadas seleccionadas */
#coordenadasSeleccionadas {
    font-family: monospace;
    font-size: 0.9em;
    padding: 0.5em 0.8em;
}

/* Botones de acción para geolocalización */
.btn-geo-accion {
    border-radius: 20px;
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.btn-geo-accion:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Alertas temporales */
.alerta-poste-temporal {
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive para formulario de postes */
@media (max-width: 768px) {
    .btn-geo-accion {
        width: 100%;
        margin-bottom: 5px;
    }
    
    #mapaInteractivoPoste {
        height: 250px;
    }
}
