/**
 * Estilos Personalizados - CRM Meta Leads
 * Concepto Agencia
 */

/* ========================================
   FIX: Autocompletado del navegador
   ======================================== */
/* FORZAR fondo blanco en campos autocompletados - Chrome/Edge/Safari */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 30px white inset !important;
    -webkit-text-fill-color: #000000 !important;
    caret-color: #000000 !important;
}

/* Específico para campos de login y formularios */
.login-form input:-webkit-autofill,
.login-form input:-webkit-autofill:hover,
.login-form input:-webkit-autofill:focus,
.login-form input:-webkit-autofill:active,
.login-box input:-webkit-autofill,
.login-box input:-webkit-autofill:hover,
.login-box input:-webkit-autofill:focus,
.login-box input:-webkit-autofill:active,
form input:-webkit-autofill,
form input:-webkit-autofill:hover,
form input:-webkit-autofill:focus,
form input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px white inset !important;
    -webkit-text-fill-color: #000000 !important;
    caret-color: #000000 !important;
}

/* Forzar para campos de tipo email y password específicamente */
input[type="email"]:-webkit-autofill,
input[type="email"]:-webkit-autofill:hover,
input[type="email"]:-webkit-autofill:focus,
input[type="email"]:-webkit-autofill:active,
input[type="password"]:-webkit-autofill,
input[type="password"]:-webkit-autofill:hover,
input[type="password"]:-webkit-autofill:focus,
input[type="password"]:-webkit-autofill:active,
input[type="text"]:-webkit-autofill,
input[type="text"]:-webkit-autofill:hover,
input[type="text"]:-webkit-autofill:focus,
input[type="text"]:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px white inset !important;
    -webkit-text-fill-color: #000000 !important;
    caret-color: #000000 !important;
}

/* Para modo oscuro, ajustar a fondo del input del tema */
.dark-mode input:-webkit-autofill,
.dark-mode input:-webkit-autofill:hover,
.dark-mode input:-webkit-autofill:focus,
.dark-mode input:-webkit-autofill:active,
.dark-mode textarea:-webkit-autofill,
.dark-mode textarea:-webkit-autofill:hover,
.dark-mode textarea:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 30px #2b3035 inset !important;
    -webkit-text-fill-color: #fff !important;
    box-shadow: 0 0 0 1000px #2b3035 inset !important;
}

/* ========================================
   LAYOUT
   ======================================== */
/* Ajustar el sidebar para que use flexbox internamente */
.sidebar-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
}

/* Sidebar Footer */
.sidebar-footer {
    margin-top: auto;
    padding: 1rem 0.75rem;
    background-color: rgba(0, 0, 0, 0.05);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.sidebar-footer p {
    font-size: 0.75rem;
    line-height: 1.5;
    color: #6c757d;
}

.sidebar-footer a {
    color: #5b6b79;
    transition: color 0.3s ease;
}

.sidebar-footer a:hover {
    color: #4e5d6c;
    text-decoration: none;
}

.sidebar-footer .fas.fa-heart {
    animation: heartbeat 1.5s ease-in-out infinite;
    font-size: 0.7rem;
}

/* Container fluid del main content con padding inferior */
.main-content > .container-fluid {
    padding-bottom: 1rem;
}

/* Prevenir scroll horizontal en páginas */
.main-content {
    overflow-x: hidden;
    width: 100%;
}

.main-content .container-fluid {
    max-width: 100%;
    overflow-x: hidden;
}

/* Margen inferior para tablas */
.table-responsive {
    margin-bottom: 1.5rem;
}

.footer a {
    transition: color 0.3s ease;
}

.footer a:hover {
    color: #0056b3 !important;
    text-decoration: underline !important;
}

.footer .fas.fa-heart {
    animation: heartbeat 1.5s ease-in-out infinite;
}

@keyframes heartbeat {
    0%, 100% {
        transform: scale(1);
    }
    10%, 30% {
        transform: scale(0.9);
    }
    20%, 40%, 50%, 60% {
        transform: scale(1.1);
    }
}

/* Dark mode support for footer */
.dark-theme .footer {
    background-color: #1a1d21;
    border-top-color: #2d3238;
}

.dark-theme .footer .text-muted {
    color: #8a92a6 !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .footer {
        padding: 1rem 1rem;
    }
    
    .footer p {
        font-size: 0.75rem;
        line-height: 1.6;
    }
}

/* ========================================
   PASSWORD VISIBILITY TOGGLE
   ======================================== */
.password-toggle-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-toggle-wrapper input {
    padding-right: 45px !important;
    flex: 1;
}

.password-toggle-wrapper .password-toggle-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #6c757d;
    transition: color 0.2s;
    z-index: 10;
    font-size: 1.1rem;
    padding: 5px;
}

.password-toggle-wrapper .password-toggle-icon:hover {
    color: #495057;
}

/* ========================================
   TIMELINE
   ======================================== */
/* Timeline para historial de leads */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline-item {
    position: relative;
    padding-bottom: 2rem;
}

.timeline-item-last {
    border-left: 2px solid transparent;
}

.timeline-marker {
    position: absolute;
    left: -6px;
    top: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #0d6efd;
    border: 2px solid #fff;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.2);
}

.timeline-content {
    padding-left: 1.5rem;
    padding-top: 0;
}

.timeline-content strong {
    font-size: 0.95rem;
}

.timeline-content p {
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ========================================
   LOGO - FIX ASPECT RATIO
   ======================================== */
/* Corregir logo rectangular en login para que no se deforme */
.login-box .login-form .login-logo img {
    width: auto !important;
    height: auto !important;
    max-width: 200px !important;
    max-height: 80px !important;
    object-fit: contain;
}

/* Logo en sidebar - mantener proporciones */
.sidebar-brand .logo img {
    width: auto !important;
    max-width: 150px !important;
    max-height: 50px !important;
    object-fit: contain;
}

/* Logo pequeño en navbar móvil */
.logo-sm {
    max-height: 36px !important;
    width: auto !important;
    object-fit: contain;
}

/* ========================================
   RESPONSIVE NAVBAR - USER MENU
   ======================================== */
/* En móvil: ocultar avatar y hacer nombre clickeable */
@media (max-width: 768px) {
    /* Ocultar el avatar en móvil */
    .header-actions .user-settings .avatar {
        display: none !important;
    }
    
    /* Hacer que el texto de bienvenida sea más compacto */
    .header-actions .user-settings .user-welcome {
        margin-right: 0 !important;
        font-size: 0.85rem;
    }
    
    /* Ocultar "Bienvenido," en pantallas muy pequeñas */
    .header-actions .user-settings .user-welcome span:first-child {
        display: none;
    }
    
    /* Estilo del nombre como enlace clickeable */
    .header-actions .user-settings {
        padding: 0.5rem 0.75rem;
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.1);
        transition: background 0.2s;
    }
    
    .header-actions .user-settings:hover {
        background: rgba(255, 255, 255, 0.2);
    }
}

/* Pantallas muy pequeñas */
@media (max-width: 480px) {
    .header-actions .user-settings .user-welcome {
        font-size: 0.8rem;
    }
    
    /* Solo mostrar el nombre del usuario */
    .header-actions .user-settings .user-welcome {
        max-width: 120px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* Dropdown del usuario - sombra y posicionamiento */
.header-actions .dropdown-menu {
    min-width: 160px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    margin-top: 8px !important;
    padding: 0.5rem 0;
}

/* IMPORTANTE: Sobrescribir el comportamiento de hover del template principal */
/* El template main.css fuerza display:block en hover, lo cual impide que Bootstrap */
/* controle correctamente el toggle del dropdown con clics */
.header-actions > li:hover .dropdown-menu,
.header-actions > li:focus .dropdown-menu {
    display: none !important; /* Anular el display:block del hover */
}

/* Mostrar solo cuando Bootstrap añade la clase .show */
.header-actions > li .dropdown-menu.show {
    display: block !important;
}

.header-actions .dropdown-menu .dropdown-item {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.header-actions .dropdown-menu .dropdown-item:hover {
    background-color: #f8f9fa;
}

.header-actions .dropdown-menu .dropdown-item i {
    width: 20px;
}

/* ========================================
   FOOTER MÓVIL (NO FIJO - scroll con contenido)
   ======================================== */
.mobile-footer {
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
    position: relative; /* No fijo */
    width: 100%;
}

.mobile-footer a {
    color: #6c757d;
    transition: color 0.2s;
}

.mobile-footer a:hover {
    color: #495057;
}

.mobile-footer .fa-heart {
    animation: heartbeat 1.5s ease-in-out infinite;
}
