/* ============================================================
   ARCO SEGUROS — Responsive Global
   Archivo maestro que garantiza diseño responsive en cualquier
   dispositivo y tamaño de pantalla.
   Cargar al final de todos los CSS en navbar.php / layouts.
   ============================================================ */

/* ── Variables base ────────────────────────────────────────── */
:root {
    --bp-xs:  360px;
    --bp-sm:  576px;
    --bp-md:  768px;
    --bp-lg:  992px;
    --bp-xl:  1200px;
    --bp-xxl: 1400px;
}

/* ── Utilidades responsive globales ────────────────────────── */
.hide-mobile { display: block !important; }
.hide-desktop { display: none !important; }

/* ══════════════════════════════════════════════════════════════
   MÓVIL PEQUEÑO (≤ 360px) — relojes, plegables
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 360px) {
    /* Navbar */
    .site-navbar { min-height: 3.6rem; }
    .nav-logo img { max-height: 38px; max-width: 140px; }
    .nav-container { padding: 0 0.75rem; }
    .nav-link { font-size: 0.8rem !important; padding: 0.6rem 0.5rem !important; }
    .nav-login-btn { font-size: 0.72rem; padding: 0.5rem 0.9rem; }

    /* Hero */
    .hero-inner { padding: 5.5rem 0 3.5rem !important; }
    .hero-title { font-size: 2.2rem !important; }
    .hero-lead { font-size: 0.9rem !important; }
    .hero-stats { gap: 0.75rem 1rem !important; }
    .stat-num { font-size: 1.8rem !important; }
    .stat-label { font-size: 0.62rem !important; }
    .hero-card { padding: 1.2rem !important; }
    .hero-card h3 { font-size: 1.2rem !important; }

    /* Secciones */
    .section-space { padding: 2.5rem 0 !important; }
    .section-space-sm { padding: 2rem 0 !important; }
    .section-title { font-size: 1.6rem !important; }
    .section-lead { font-size: 0.88rem !important; }

    /* Botones */
    .btn-arco { padding: 0.7rem 1.2rem; font-size: 0.72rem; }
    .btn-outline-custom { padding: 0.7rem 1.2rem; font-size: 0.72rem; }

    /* Service cards */
    .service-card { padding: 0 !important; }
    .service-img { height: 140px !important; }
    .service-card-body { padding: 1.2rem !important; }
    .service-card h3 { font-size: 1.15rem !important; }

    /* Testimonios */
    .testimonial-card { padding: 1.5rem !important; }
    .testimonial-text { font-size: 0.95rem !important; }

    /* Footer */
    .footer-grid { gap: 1.5rem !important; padding-bottom: 1.5rem !important; }
    .footer-bottom { flex-direction: column; gap: 0.75rem; }
    .footer-bottom-links { gap: 0.5rem 1rem; }

    /* Login */
    .login-panel-right { padding: 1rem 0.9rem !important; }
    .form-header h2 { font-size: 1.6rem !important; }
    .panel-headline { font-size: 1.4rem !important; }

    /* About */
    .page-title { font-size: 2rem !important; }
    .page-hero { min-height: 350px !important; }
    .historia-title, .block-title { font-size: 1.8rem !important; }
    .cta-title { font-size: 1.8rem !important; }
    .valor-card { padding: 2rem 1rem !important; }
    .mv-card { padding: 1.5rem 1.2rem !important; }
    .join-title { font-size: 1.6rem !important; }

    /* Aseguradoras */
    .dir-hero { padding: 60px 0 40px !important; }
    .dir-title { font-size: 1.8rem !important; }
    .dir-heading h2 { font-size: 1.5rem !important; }
    .dir-card-logo { height: 120px !important; padding: 16px !important; }
    .dir-logo-img { width: 100px !important; height: 60px !important; }

    /* Servicios */
    .hero-services { padding: 80px 0 50px !important; min-height: 350px !important; }
    .hero-services h1 { font-size: 1.5rem !important; }
    .service-body { padding: 1rem !important; }

    /* Paneles admin */
    .dash-content { padding: 12px 10px 24px !important; }
    .kpi-grid { grid-template-columns: 1fr !important; gap: 10px !important; }
    .kpi-card { padding: 12px 14px !important; gap: 10px !important; }
    .kpi-value { font-size: 1.15rem !important; }
    .charts-row { grid-template-columns: 1fr !important; gap: 10px !important; }
    .lower-grid { grid-template-columns: 1fr !important; gap: 10px !important; }
    .quick-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .fin-grid { grid-template-columns: 1fr !important; }
    .fin-card { padding: 12px 14px !important; }

    /* Topbar */
    .dash-topbar { padding: 0 10px !important; height: 52px !important; }
    .topbar-left h1 { font-size: 0.85rem !important; }
}

/* ══════════════════════════════════════════════════════════════
   MÓVIL (≤ 576px)
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 576px) {
    .hide-mobile { display: none !important; }
    .hide-desktop { display: block !important; }

    /* Navbar */
    .site-navbar { min-height: 4rem; }
    .nav-logo img { max-height: 42px; max-width: 160px; }
    .nav-container { padding: 0 1rem; }

    /* Hero */
    .hero-inner { padding: 6rem 0 4rem; }
    .hero-title { font-size: 2.5rem; }
    .hero-lead { font-size: 0.95rem; max-width: none; }
    .hero-stats { flex-wrap: wrap; gap: 1rem 1.5rem; }
    .stat-num { font-size: 2rem; }
    .hero-card { padding: 1.5rem; }
    .hero-card h3 { font-size: 1.3rem; }

    /* Secciones */
    .section-space { padding: 3rem 0; }
    .section-title { font-size: 1.8rem; }

    /* Promise / Compromiso */
    .promise-image-wrap { height: 200px !important; }
    .promise-content { padding: 1.5rem 1rem !important; }

    /* Service cards */
    .service-card { border-radius: 12px; }
    .service-img { height: 160px; }

    /* Testimonios */
    .testimonial-card { padding: 1.5rem; }
    .testimonial-text { font-size: 1rem; }

    /* Partners */
    .partners-logos { gap: 1.5rem 2rem; }
    .partner-logo { height: 28px; }

    /* CTA */
    .cta-section { padding: 3rem 0 !important; }
    .cta-inner h2 { font-size: 1.8rem !important; }

    /* Footer */
    .site-footer { padding-top: 2.5rem; }
    .footer-grid { grid-template-columns: 1fr !important; gap: 2rem; }
    .footer-logo img { max-width: 150px; max-height: 40px; }
    .footer-brand p { max-width: none; }
    .footer-bottom { flex-direction: column; align-items: flex-start; }
    .footer-bottom-links { gap: 0.5rem 1rem; }

    /* Login */
    .login-panel-right { padding: 1.2rem 1rem; }
    .form-area { padding: 0.5rem 0; }
    .form-header h2 { font-size: 1.7rem; }
    .panel-headline { font-size: 1.5rem; }
    .panel-sub { font-size: 0.85rem; }
    .social-row { grid-template-columns: 1fr; }

    /* About */
    .page-title { font-size: 2.2rem; }
    .page-hero { min-height: 400px; }
    .page-lead { font-size: 1.1rem; }
    .section-space { padding: 50px 0; }
    .historia-img-wrap { aspect-ratio: 16/9; }
    .historia-title, .block-title { font-size: 2rem; }
    .cta-title { font-size: 2rem; }
    .cta-section .cta-inner { flex-direction: column; text-align: center; }
    .cta-section .cta-btn { width: 100%; }
    .join-title { font-size: 1.8rem; }
    .btn-join { width: 100%; text-align: center; }
    .cta-buttons { flex-direction: column; gap: 10px; }
    .btn-cta-outline, .btn-cta-fill { width: 100%; text-align: center; }

    /* Aseguradoras */
    .dir-hero { padding: 70px 0 50px; }
    .dir-title { font-size: 2rem; }
    .dir-heading h2 { font-size: 1.6rem; }
    .dir-heading::after { width: 80px; }
    .dir-grid { grid-template-columns: 1fr !important; gap: 16px; }
    .dir-card { border-radius: 14px; }
    .dir-card-logo { height: 130px; }
    .dir-cta { padding: 50px 0; }
    .dir-cta h2 { font-size: 1.8rem; }
    .srv2-header { flex-direction: column; align-items: flex-start; }
    .srv2-slide { flex-direction: column; }
    .srv2-img { width: 100%; min-height: 150px; }

    /* Servicios */
    .hero-services { padding: 90px 0 60px; min-height: 400px; }
    .hero-services h1 { font-size: 1.8rem; }
    .badge-arco { font-size: 0.75rem; padding: 8px 18px; }
    .service-grid .row { margin-top: -30px; }
    .section-title { font-size: 1.5rem; }
    .service-body { padding: 1.2rem; }

    /* Paneles admin */
    .dash-content { padding: 14px 12px 30px; }
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .kpi-card { padding: 14px 16px; }
    .charts-row { grid-template-columns: 1fr; }
    .lower-grid { grid-template-columns: 1fr; }
    .quick-grid { grid-template-columns: repeat(3, 1fr); }
    .fin-grid { grid-template-columns: 1fr 1fr; }

    /* Topbar */
    .topbar-left h1 { font-size: 0.95rem; }
    .topbar-right { gap: 10px; }

    /* Profile */
    .profile-hero { flex-direction: column; text-align: center; padding: 20px; }
    .profile-hero-meta { justify-content: center; }
    .profile-hero-meta div { text-align: center; }
    .profile-grid { grid-template-columns: 1fr; }
    .profile-avatar-row { flex-direction: column; text-align: center; }
    .profile-form-actions { justify-content: center; }
    .profile-readonly-grid { grid-template-columns: 1fr; }

    /* Users */
    .users-page-header { flex-direction: column; align-items: stretch; }
    .btn-agregar { justify-content: center; }
    .users-stats { grid-template-columns: 1fr 1fr; }
    .users-table-toolbar { flex-direction: column; align-items: stretch; }
    .users-tabs { overflow-x: auto; flex-wrap: nowrap; }
    .um-kpi-grid { grid-template-columns: 1fr 1fr; }
    .um-form-grid { grid-template-columns: 1fr; }
    .um-form-group.full { grid-column: auto; }
    .um-modal { max-width: 100%; border-radius: 12px; }
    .um-modal-body { padding: 16px; }
    .um-modal-footer { padding: 12px 16px 16px; }

    /* CRM */
    .crm-detail-header { flex-direction: column; align-items: center; text-align: center; }
    .crm-detail-actions { justify-content: center; }
    .crm-stats-row { grid-template-columns: 1fr 1fr; }
    .crm-form-row { grid-template-columns: 1fr; }
    .crm-tabs { overflow-x: auto; flex-wrap: nowrap; }
    .crm-tabs li { padding: 8px 10px; font-size: 0.75rem; }

    /* Tablas general */
    .users-table-wrap { margin: 0 -12px; }
    .users-table { min-width: 500px; }
}

/* ══════════════════════════════════════════════════════════════
   TABLET (≤ 768px)
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    /* Navbar */
    .site-navbar { min-height: 4.2rem; }
    .nav-collapse-width { max-width: none; }

    /* Hero */
    .hero-inner { padding: 7rem 0 5rem; }
    .hero-title { font-size: clamp(2rem, 6vw, 3rem); }
    .hero-stats { gap: 1.2rem 2rem; }

    /* Secciones */
    .section-space { padding: 3.5rem 0; }
    .section-title { font-size: clamp(1.5rem, 4vw, 2.2rem); }

    /* Promise / Compromiso */
    .promise-image-wrap { height: 250px; }
    .promise-content { padding: 2rem 1.2rem; }

    /* Service cards */
    .service-card { margin-bottom: 1rem; }

    /* Testimonios */
    .testimonial-card { padding: 1.8rem; }

    /* CTA */
    .cta-section { padding: 4rem 0; }
    .cta-inner h2 { font-size: clamp(1.6rem, 5vw, 2.5rem); }

    /* Footer */
    .footer-grid { grid-template-columns: 1fr 1fr; gap: 2rem; }
    .footer-bottom { flex-direction: column; align-items: flex-start; gap: 0.75rem; }

    /* Login */
    .login-panel-right { padding: 1.5rem; }
    .form-header h2 { font-size: 1.8rem; }

    /* About */
    .page-title { font-size: 2.5rem; }
    .page-hero { min-height: 420px; }
    .section-space { padding: 60px 0; }
    .historia-img-wrap { aspect-ratio: 4/3; }
    .historia-title, .block-title { font-size: 2.2rem; }
    .cta-title { font-size: 2.2rem; }
    .cta-section .cta-inner { flex-direction: column; text-align: center; gap: 20px; }
    .join-title { font-size: 2rem; }

    /* Aseguradoras */
    .dir-hero { padding: 80px 0 60px; }
    .dir-title { font-size: 2.5rem; }
    .dir-heading h2 { font-size: 2rem; }
    .dir-grid { grid-template-columns: 1fr 1fr; }
    .dir-cta h2 { font-size: 2.2rem; }

    /* Servicios */
    .hero-services { padding: 100px 0 70px; min-height: 420px; }
    .hero-services h1 { font-size: 2rem; }
    .section-title { font-size: 1.8rem; }

    /* Paneles admin */
    .dash-content { padding: 20px 16px 36px; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .charts-row { grid-template-columns: 1fr 1fr; }
    .charts-row > *:last-child { grid-column: span 2; }
    .lower-grid { grid-template-columns: 1fr 1fr; }
    .lower-grid > *:first-child { grid-column: span 2; }
    .quick-grid { grid-template-columns: repeat(4, 1fr); }
    .fin-grid { grid-template-columns: repeat(2, 1fr); }

    /* Topbar */
    .dash-topbar { padding: 0 16px; }
    .topbar-left h1 { font-size: 1rem; }
    .topbar-user-info { display: none; }
    .topbar-date { display: none; }

    /* Profile */
    .profile-grid { grid-template-columns: 1fr; }

    /* Users */
    .users-stats { grid-template-columns: 1fr 1fr; }
    .um-kpi-grid { grid-template-columns: repeat(2, 1fr); }

    /* CRM */
    .crm-stats-row { grid-template-columns: repeat(2, 1fr); }
}

/* ══════════════════════════════════════════════════════════════
   TABLET GRANDE / LAPTOP PEQUEÑA (≤ 992px)
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 992px) {
    /* Navbar */
    .site-navbar { min-height: 4.4rem; }
    .nav-container { max-width: 100%; }

    /* Hero */
    .hero-inner { padding: 8rem 0 6rem; }
    .hero-title { font-size: clamp(2.5rem, 6vw, 4rem); }

    /* Secciones */
    .section-space { padding: 4rem 0; }

    /* Promise / Compromiso */
    .promise-image-wrap { height: 320px; }
    .promise-content { padding: 2.5rem 1.5rem; }

    /* Footer */
    .footer-grid { grid-template-columns: 1fr 1fr; gap: 2.5rem 3rem; }

    /* About */
    .page-title { font-size: 3rem; }
    .page-hero { min-height: 480px; }
    .historia-title, .block-title { font-size: 2.5rem; }
    .cta-title { font-size: 2.5rem; }
    .mv-card { padding: 2rem 1.8rem; }

    /* Aseguradoras */
    .dir-title { font-size: 3rem; }
    .dir-grid { grid-template-columns: repeat(2, 1fr); }

    /* Servicios */
    .hero-services { padding: 110px 0 80px; }
    .hero-services h1 { font-size: 2.5rem; }
    .service-grid .row { margin-top: -40px; }

    /* Paneles admin */
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .charts-row { grid-template-columns: 1fr 1fr; }
    .charts-row > *:last-child { grid-column: span 2; }
    .lower-grid { grid-template-columns: 1fr 1fr; }
    .lower-grid > *:first-child { grid-column: span 2; }
    .fin-grid { grid-template-columns: repeat(3, 1fr); }

    /* Sidebar toggle visible */
    .sidebar-toggle-btn { display: flex; }
}

/* ══════════════════════════════════════════════════════════════
   DESKTOP (≤ 1200px)
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 1200px) {
    /* Paneles admin */
    .kpi-grid { grid-template-columns: repeat(4, 1fr); }
    .charts-row { grid-template-columns: 1fr 1.4fr 1fr; }
    .lower-grid { grid-template-columns: repeat(4, 1fr); }
    .fin-grid { grid-template-columns: repeat(4, 1fr); }

    /* Footer */
    .footer-grid { gap: 2rem 4rem; }
}

/* ══════════════════════════════════════════════════════════════
   PANTALLAS GRANDES (> 1400px)
   ══════════════════════════════════════════════════════════════ */
@media (min-width: 1400px) {
    .container { max-width: 1320px; }
}

/* ══════════════════════════════════════════════════════════════
   ORIENTACIÓN LANDSCAPE EN MÓVIL
   ══════════════════════════════════════════════════════════════ */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-section { min-height: auto !important; padding: 2rem 0 !important; }
    .hero-inner { padding: 4rem 0 3rem !important; }
    .hero-title { font-size: 2rem !important; }
    .page-hero { min-height: 300px !important; }
    .login-wrapper { min-height: auto; }
    .login-panel-left { display: none; }
}

/* ══════════════════════════════════════════════════════════════
   MODO LANDSCAPE GENERAL
   ══════════════════════════════════════════════════════════════ */
@media (orientation: landscape) and (max-height: 500px) {
    .hero-section { min-height: 60vh !important; }
    .hero-inner { padding: 5rem 0 3rem !important; }
}

/* ══════════════════════════════════════════════════════════════
   TABLET HORIZONTAL
   ══════════════════════════════════════════════════════════════ */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
    .hero-section { min-height: 70vh !important; }
    .hero-inner { padding: 6rem 0 4rem !important; }
}

/* ══════════════════════════════════════════════════════════════
   MÓVIL PEQUEÑO — Componentes compartidos (≤ 360px)
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 360px) {
    /* Tablas generales */
    .table-wrap { margin: 0 -8px; }
    .data-table { min-width: 420px; font-size: .72rem; }
    .data-table thead th { padding: 8px 8px; font-size: .62rem; }
    .data-table td { padding: 8px; }

    /* Formularios */
    .form-grid { grid-template-columns: 1fr !important; }
    .form-group { margin-bottom: 12px; }
    .form-control { font-size: .8rem; padding: 8px 10px; }
    .form-label { font-size: .75rem; margin-bottom: 4px; }
    .form-actions { flex-direction: column; gap: 8px; }
    .form-actions .btn { width: 100%; justify-content: center; }

    /* Botones */
    .btn { padding: 0.5rem 1rem; font-size: 0.72rem; }
    .btn-sm { padding: 0.4rem 0.8rem; font-size: 0.68rem; }

    /* Modales */
    .modal-content { border-radius: 10px; margin: 8px; max-height: 90vh; }
    .modal-header { padding: 14px 16px; }
    .modal-body { padding: 14px 16px; }
    .modal-footer { padding: 10px 16px 14px; }
}

/* ══════════════════════════════════════════════════════════════
   MÓVIL — Componentes compartidos (≤ 576px)
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 576px) {
    /* Tablas generales */
    .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

    /* Formularios */
    .form-grid { grid-template-columns: 1fr; }
    .form-row { flex-direction: column; gap: 12px; }

    /* Paneles / Cards */
    .card-header { flex-direction: column; align-items: stretch; gap: 10px; }
    .card-header .card-title { font-size: .95rem; }

    /* Tabs */
    .nav-tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
    .nav-tabs::-webkit-scrollbar { display: none; }
    .nav-tabs .nav-link { white-space: nowrap; flex-shrink: 0; font-size: .78rem; padding: 8px 12px; }

    /* Pagination */
    .pagination { flex-wrap: wrap; gap: 4px; justify-content: center; }
    .pagination .page-link { padding: 6px 10px; font-size: .78rem; }

    /* Dropdowns */
    .dropdown-menu { min-width: 100%; }

    /* Alerts */
    .alert { padding: 12px 14px; font-size: .82rem; }

    /* Badges */
    .badge { font-size: .65rem; padding: 3px 7px; }
}

/* ══════════════════════════════════════════════════════════════
   TABLET — Componentes compartidos (≤ 768px)
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    /* Tablas generales */
    .table-wrap { overflow-x: auto; }

    /* Formularios */
    .form-grid { grid-template-columns: 1fr 1fr; }

    /* Modales */
    .modal-dialog { max-width: 90vw; margin: 1.5rem auto; }

    /* Tooltips / Popovers se ajustan automáticamente */
}

/* ══════════════════════════════════════════════════════════════
   TABLET GRANDA (≤ 992px)
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 992px) {
    .modal-dialog { max-width: 85vw; }
}

/* ══════════════════════════════════════════════════════════════
   UTILIDADES RESPONSIVE GENÉRICAS
   ══════════════════════════════════════════════════════════════ */

/* Flex wrap automático */
@media (max-width: 768px) {
    .d-flex { flex-wrap: wrap !important; }
    .gap-3 { gap: 0.5rem !important; }
    .gap-4 { gap: 0.75rem !important; }
    .gap-5 { gap: 1rem !important; }
}

/* Contenedores */
@media (max-width: 576px) {
    .container { padding-left: 12px; padding-right: 12px; }
    .container-fluid { padding-left: 12px; padding-right: 12px; }
}

/* Texto responsive */
@media (max-width: 576px) {
    .text-center-mobile { text-align: center !important; }
    .text-start-mobile { text-align: left !important; }
}

/* Imágenes responsive */
img {
    max-width: 100%;
    height: auto;
}

/* Touch devices: hover states */
@media (hover: none) and (pointer: coarse) {
    .service-card:hover { transform: none; }
    .testimonial-card:hover { transform: none; }
    .valor-card:hover { transform: none; }
    .team-card:hover { transform: none; }
    .dir-card:hover { transform: none; }
    .kpi-card:hover { transform: none; }
    .chart-card:hover { transform: none; }
    .panel-card:hover { transform: none; }
    .fin-card:hover { transform: none; }
    .um-kpi-card:hover { transform: none; }
}

/* Prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    html { scroll-behavior: auto; }
}

/* Safe area para dispositivos con notch */
@supports (padding: env(safe-area-inset-top)) {
    .site-navbar { padding-top: env(safe-area-inset-top); }
    .site-footer { padding-bottom: calc(1.5rem + env(safe-area-inset-bottom)); }
    .dash-topbar { padding-top: env(safe-area-inset-top); }
}

/* Print */
@media print {
    .site-navbar, .dash-sidebar, .dash-topbar, .site-footer,
    .nav-toggler, .sidebar-toggle-btn, .topbar-logout { display: none !important; }
    .dash-main { margin-left: 0 !important; width: 100% !important; }
    body { background: #fff; }
}
