/**
 * ==============================================================================
 * Capa de Físicas Fluidas, Micro-interacciones y Materiales Apple (WWDC Guidelines)
 * Proyecto: Condominio La Sultana Agrupación C
 * Guía: Apple Fluid Interfaces (WWDC 2018-2026 / Emil Kowalski)
 * ==============================================================================
 * Arquitectura: Capa 100% desacoplada y reversible. Se puede activar o desactivar
 * comentando el <link> en app/Views/layouts/main.php.
 */

/* --------------------------------------------------------------------------
   1. TIPOGRAFÍA ÓPTICA (Optical Sizing & Dynamic Tracking)
   -------------------------------------------------------------------------- */
h1, h2, h3, .font-heading, .h1, .h2, .h3 {
    letter-spacing: -0.024em !important;
    text-rendering: optimizeLegibility;
}

h4, h5, h6, .h4, .h5, .h6 {
    letter-spacing: -0.012em !important;
}

body, p, .small, .form-label, .nav-link-custom {
    letter-spacing: -0.006em;
}

/* Desplazamiento Suave Nativo */
html {
    scroll-behavior: smooth;
}

/* Selección de texto suave con acento de marca */
::selection {
    background-color: rgba(14, 133, 105, 0.22) !important;
    color: #0A6650 !important;
}

/* --------------------------------------------------------------------------
   2. MATERIALES Y PROFUNDIDAD (Translucent Chrome & Depth)
   -------------------------------------------------------------------------- */

/* Barra de Navegación: Vidrio Esmerilado (Frosted Glass Chrome) */
.navbar-custom {
    background: rgba(255, 255, 255, 0.82) !important;
    backdrop-filter: blur(20px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
    border-bottom: 1px solid rgba(229, 233, 232, 0.75) !important;
    box-shadow: 0 4px 24px -2px rgba(23, 50, 77, 0.05) !important;
    transition: background 0.3s ease, border-color 0.3s ease;
}

/* Menús Dropdown: Material Translúcido con Anclaje Visual */
.dropdown-menu {
    border-radius: 16px !important;
    background: rgba(255, 255, 255, 0.90) !important;
    backdrop-filter: blur(25px) saturate(190%) !important;
    -webkit-backdrop-filter: blur(25px) saturate(190%) !important;
    border: 1px solid rgba(255, 255, 255, 0.75) !important;
    box-shadow: 0 18px 38px -6px rgba(23, 50, 77, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04) !important;
    transform-origin: top right;
    animation: appleScaleIn 0.26s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.dropdown-item {
    border-radius: 10px !important;
    margin: 2px 6px !important;
    width: auto !important;
    transition: background-color 0.16s ease, transform 0.16s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.dropdown-item:active {
    transform: scale(0.97) !important;
}

/* Modales: Aparición con física de resorte y desenfoque de fondo */
.modal-backdrop.show {
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    background-color: rgba(17, 35, 54, 0.48) !important;
    transition: opacity 0.28s ease !important;
}

.modal.fade .modal-dialog {
    transform: scale(0.94) translateY(14px) !important;
    transition: transform 0.34s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease !important;
}

.modal.show .modal-dialog {
    transform: scale(1) translateY(0) !important;
}

.modal-content {
    border-radius: 22px !important;
    border: 1px solid rgba(255, 255, 255, 0.85) !important;
    box-shadow: 0 26px 54px -12px rgba(23, 50, 77, 0.20) !important;
}

/* --------------------------------------------------------------------------
   3. RESPUESTA INSTANTÁNEA Y FÍSICA DE RESORTE (Zero Latency & Springs)
   -------------------------------------------------------------------------- */

/* Botones: Retroalimentación inmediata en press/pointer-down */
.btn, .btn-primary-custom, .btn-pill-action, button.btn {
    transition: transform 0.30s cubic-bezier(0.16, 1, 0.3, 1), 
                box-shadow 0.30s cubic-bezier(0.16, 1, 0.3, 1),
                background-color 0.2s ease,
                color 0.2s ease !important;
    -webkit-tap-highlight-color: transparent;
}

/* Sensación háptica en clic (scale 0.96 instantáneo sin latencia) */
.btn:active, .btn-primary-custom:active, .btn-pill-action:active, button.btn:active {
    transform: scale(0.96) !important;
    transition: transform 0.08s cubic-bezier(0.2, 0, 0, 1) !important;
}

/* Enlaces del Navbar con feedback elástico suave */
.nav-link-custom {
    transition: all 0.24s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.nav-link-custom:active {
    transform: scale(0.94) !important;
}

/* Tarjetas (Cards): Elevación sutil al hover y compresión física al presionar */
.card, .card-custom {
    border-radius: 20px !important;
    box-shadow: 0 4px 18px -2px rgba(23, 50, 77, 0.04), 0 1px 3px rgba(23, 50, 77, 0.02) !important;
    transition: transform 0.34s cubic-bezier(0.16, 1, 0.3, 1), 
                box-shadow 0.34s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.25s ease !important;
}

.card:hover, .card-custom:hover {
    box-shadow: 0 14px 30px -4px rgba(23, 50, 77, 0.08), 0 4px 12px -2px rgba(23, 50, 77, 0.03) !important;
}

/* --------------------------------------------------------------------------
   4. SECCIÓN ZONAS COMUNES Y CALENDARIO INTERACTIVO
   -------------------------------------------------------------------------- */

/* Zoom óptico sutil en fotografías de salones al hover */
.card img {
    transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.card:hover img {
    transform: scale(1.035) !important;
}

/* Badges flotantes de Día Completo y Aforo estilo Glassmorphism */
.card .position-absolute.badge {
    backdrop-filter: blur(8px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(8px) saturate(180%) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
}

/* Píldoras de Filtro por Zona Común */
.btn-filtro-zona {
    transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1), 
                background-color 0.2s ease, 
                border-color 0.2s ease !important;
    -webkit-tap-highlight-color: transparent;
}

.btn-filtro-zona:active {
    transform: scale(0.95) !important;
}

/* Eventos del Calendario FullCalendar con amortiguación elástica */
.fc-event {
    border-radius: 8px !important;
    padding: 3px 7px !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08) !important;
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), 
                box-shadow 0.22s ease !important;
    cursor: pointer !important;
}

.fc-event:hover {
    transform: translateY(-1.5px) scale(1.01) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

.fc-event:active {
    transform: scale(0.97) !important;
}

.fc-daygrid-day-frame:hover {
    background-color: rgba(14, 133, 105, 0.02) !important;
    transition: background-color 0.15s ease;
}

/* --------------------------------------------------------------------------
   5. CENTRO DE AYUDA Y PREGUNTAS FRECUENTES (FAQ)
   -------------------------------------------------------------------------- */

/* Buscador en Vivo con resplandor elástico */
.faq-search-box {
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.28s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.faq-search-box:focus-within {
    transform: scale(1.015) !important;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.16) !important;
}

/* Píldoras de Filtro en FAQ */
.btn-filtro-faq {
    transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1), 
                background-color 0.2s ease, 
                border-color 0.2s ease,
                box-shadow 0.24s cubic-bezier(0.16, 1, 0.3, 1) !important;
    -webkit-tap-highlight-color: transparent;
}

.btn-filtro-faq:active {
    transform: scale(0.95) !important;
}

/* Acordeones con elevación suave y rotación amortiguada de chevron */
.accordion-faq-item {
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), 
                box-shadow 0.28s cubic-bezier(0.16, 1, 0.3, 1), 
                border-color 0.2s ease !important;
}

.accordion-faq-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(23, 50, 77, 0.08) !important;
}

.accordion-faq-button::after {
    transition: transform 0.30s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

/* --------------------------------------------------------------------------
   6. PÁGINA DE INICIO (HOME) Y ACCESOS RÁPIDOS
   -------------------------------------------------------------------------- */

/* Tarjetas horizontales de acceso rápido (Pagos, PQRS, Residentes) */
.quick-access-card {
    transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1), 
                box-shadow 0.32s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.2s ease !important;
}

.quick-access-card:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 16px 32px -4px rgba(23, 50, 77, 0.10) !important;
}

.quick-access-card:active {
    transform: scale(0.97) translateY(-1px) !important;
}

.quick-access-card:hover .chevron-pill i,
.quick-access-card:hover i.bi-chevron-right {
    transform: translateX(4px);
    transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Indicadores Táctiles (Dots) del Slider estilo iOS: expansión elástica */
.carousel-indicators [data-bs-target] {
    width: 10px !important;
    height: 10px !important;
    border-radius: 50% !important;
    transition: width 0.32s cubic-bezier(0.16, 1, 0.3, 1), 
                border-radius 0.32s cubic-bezier(0.16, 1, 0.3, 1), 
                background-color 0.25s ease !important;
}

.carousel-indicators .active {
    width: 26px !important;
    border-radius: 12px !important;
}

/* --------------------------------------------------------------------------
   7. BOTÓN FLOTANTE DE WHATSAPP (Momentum & Elastic Bounce)
   -------------------------------------------------------------------------- */
.btn-whatsapp-flotante {
    transition: transform 0.42s cubic-bezier(0.34, 1.45, 0.64, 1), 
                box-shadow 0.35s ease !important;
}

.btn-whatsapp-flotante:hover {
    transform: scale(1.08) translateY(-3px) !important;
    box-shadow: 0 10px 24px rgba(37, 211, 102, 0.42) !important;
}

.btn-whatsapp-flotante:active {
    transform: scale(0.93) !important;
    transition: transform 0.08s ease !important;
}

/* --------------------------------------------------------------------------
   8. FORMULARIOS, INPUTS Y SWITCHES
   -------------------------------------------------------------------------- */
.form-control, .form-select {
    border-radius: 12px !important;
    transition: border-color 0.22s cubic-bezier(0.16, 1, 0.3, 1), 
                box-shadow 0.22s cubic-bezier(0.16, 1, 0.3, 1), 
                background-color 0.2s ease !important;
}

.form-control:focus, .form-select:focus {
    border-color: #0E8569 !important;
    box-shadow: 0 0 0 3.5px rgba(14, 133, 105, 0.16) !important;
    background-color: #FFFFFF !important;
}

/* Switches administrativos con transición elástica */
.form-switch .form-check-input {
    transition: background-position 0.26s cubic-bezier(0.16, 1, 0.3, 1), 
                background-color 0.26s ease !important;
    cursor: pointer;
}

.form-check-input:active {
    transform: scale(0.92);
    transition: transform 0.08s ease;
}

/* Filas de tablas interactivas */
.table-hover tbody tr {
    transition: background-color 0.16s ease !important;
}

.table-hover tbody tr:hover {
    background-color: rgba(14, 133, 105, 0.035) !important;
}

/* --------------------------------------------------------------------------
   9. ANIMACIONES AUXILIARES
   -------------------------------------------------------------------------- */
@keyframes appleScaleIn {
    from {
        opacity: 0;
        transform: scale(0.92) translateY(-6px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* --------------------------------------------------------------------------
   10. ACCESIBILIDAD Y REDUCED MOTION (Respeto estricto a WWDC Guidelines)
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *, ::before, ::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .btn:active, .btn-primary-custom:active, .btn-pill-action:active,
    .btn-whatsapp-flotante:active, .card:hover, .card:hover img,
    .quick-access-card:hover, .accordion-faq-item:hover,
    .fc-event:hover, .fc-event:active {
        transform: none !important;
    }
}

@media (prefers-reduced-transparency: reduce) {
    .navbar-custom, .dropdown-menu, .modal-backdrop.show, .card .position-absolute.badge {
        background: #ffffff !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }
}
