/**
 * Estilos responsivos FMC
 * Breakpoints y adaptaciones para móviles y tablets
 */

/* === BREAKPOINTS === */
/* 
xs: 0px - 575.98px (móviles)
sm: 576px - 767.98px (móviles grandes)
md: 768px - 991.98px (tablets)
lg: 992px - 1199.98px (escritorio)
xl: 1200px+ (escritorio grande)
*/

/* === UTILIDADES RESPONSIVAS === */

/* Mostrar/ocultar por dispositivo */
@media (max-width: 575.98px) {
    .d-xs-none {
        display: none !important;
    }

    .d-xs-block {
        display: block !important;
    }

    .d-xs-flex {
        display: flex !important;
    }
}

@media (min-width: 576px) and (max-width: 767.98px) {
    .d-sm-none {
        display: none !important;
    }

    .d-sm-block {
        display: block !important;
    }

    .d-sm-flex {
        display: flex !important;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .d-md-none {
        display: none !important;
    }

    .d-md-block {
        display: block !important;
    }

    .d-md-flex {
        display: flex !important;
    }
}

@media (min-width: 992px) {
    .d-lg-none {
        display: none !important;
    }

    .d-lg-block {
        display: block !important;
    }

    .d-lg-flex {
        display: flex !important;
    }
}

/* === MÓVILES (xs: 0-575px) === */
@media (max-width: 575.98px) {

    /* Top bar */
    .top-bar {
        padding: 2px 0;
        font-size: 10px;
    }

    .top-bar-content {
        flex-direction: column;
        gap: var(--fmc-spacing-xs);
        text-align: center;
    }

    .top-bar-right {
        flex-direction: column;
        gap: var(--fmc-spacing-xs);
    }

    .language-selector {
        order: -1;
        /* Mostrar primero en móviles */
    }

    /* Header */
    .fmc-header {
        padding: var(--fmc-spacing-sm) 0;
    }

    .header-content {
        flex-direction: column;
        gap: var(--fmc-spacing-sm);
        text-align: center;
    }

    .logo-img {
        height: 40px;
    }

    .logo-text .logo-icon {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }

    .logo-details {
        font-size: 12px;
    }

    .header-links {
        font-size: 11px;
    }



    /* Contenido principal */
    .fmc-main {
        padding: var(--fmc-spacing-md) 0;
    }

    .fmc-main .container-fluid {
        padding: 0 var(--fmc-spacing-md);
    }

    /* Tarjetas */
    .fmc-card {
        margin-bottom: var(--fmc-spacing-md);
    }

    .fmc-card-header,
    .fmc-card-body,
    .fmc-card-footer {
        padding: var(--fmc-spacing-md);
    }

    /* Botones */
    .fmc-btn {
        width: 100%;
        margin-bottom: var(--fmc-spacing-sm);
    }

    .fmc-btn-group {
        flex-direction: column;
        width: 100%;
    }

    .fmc-btn-group .fmc-btn {
        border-radius: var(--fmc-radius);
        margin-left: 0;
        margin-bottom: var(--fmc-spacing-xs);
    }

    .fmc-btn-group .fmc-btn:last-child {
        margin-bottom: 0;
    }

    /* Formularios */
    .fmc-form-group {
        margin-bottom: var(--fmc-spacing-md);
    }

    .fmc-form-control {
        font-size: 16px;
        /* Evita zoom en iOS */
    }

    /* Tablas */
    .fmc-table-responsive {
        font-size: var(--fmc-font-size-sm);
    }

    .fmc-table th,
    .fmc-table td {
        padding: var(--fmc-spacing-sm);
        white-space: nowrap;
    }

    /* Modales */
    .fmc-modal-dialog {
        margin: var(--fmc-spacing-sm);
        max-width: calc(100% - 1rem);
    }

    .fmc-modal-header,
    .fmc-modal-body,
    .fmc-modal-footer {
        padding: var(--fmc-spacing-md);
    }

    /* Breadcrumb */
    .fmc-breadcrumb {
        padding: var(--fmc-spacing-xs) 0;
    }

    .breadcrumb {
        font-size: var(--fmc-font-size-xs);
        flex-wrap: wrap;
    }

    /* Alertas */
    .fmc-alert {
        padding: var(--fmc-spacing-sm) var(--fmc-spacing-md);
        margin-bottom: var(--fmc-spacing-md);
    }
}

/* === MÓVILES GRANDES (sm: 576-767px) === */
@media (min-width: 576px) and (max-width: 767.98px) {
    .fmc-header .row>div {
        margin-bottom: var(--fmc-spacing-md);
    }

    .fmc-title {
        text-align: center;
    }

    .fmc-user-info {
        text-align: center;
    }

    .fmc-btn-group {
        justify-content: center;
        flex-wrap: wrap;
        gap: var(--fmc-spacing-sm);
    }

    .fmc-btn-group .fmc-btn {
        flex: 1;
        min-width: 120px;
    }

    .fmc-modal-dialog {
        max-width: 500px;
        margin: 1.75rem auto;
    }
}

/* === TABLETS (md: 768-991px) === */
@media (min-width: 768px) and (max-width: 991.98px) {
    .fmc-header {
        padding: var(--fmc-spacing-lg) 0;
    }

    .fmc-title h1 {
        font-size: var(--fmc-font-size-2xl);
    }

    .navbar-collapse {
        justify-content: space-between;
    }

    .navbar-nav {
        flex-direction: row;
        gap: var(--fmc-spacing-sm);
    }



    .fmc-main {
        padding: var(--fmc-spacing-lg) 0;
    }

    /* Grid responsivo para tablets */
    .fmc-row-tablet {
        display: flex;
        flex-wrap: wrap;
        margin: 0 -var(--fmc-spacing-sm);
    }

    .fmc-col-tablet-6 {
        flex: 0 0 50%;
        max-width: 50%;
        padding: 0 var(--fmc-spacing-sm);
    }

    .fmc-col-tablet-4 {
        flex: 0 0 33.333333%;
        max-width: 33.333333%;
        padding: 0 var(--fmc-spacing-sm);
    }

    .fmc-col-tablet-3 {
        flex: 0 0 25%;
        max-width: 25%;
        padding: 0 var(--fmc-spacing-sm);
    }

    /* Botones en tablets */
    .fmc-btn-group {
        justify-content: flex-start;
    }

    .fmc-btn-group .fmc-btn {
        flex: 0 0 auto;
    }

    /* Formularios en tablets */
    .fmc-form-row {
        display: flex;
        flex-wrap: wrap;
        margin: 0 -var(--fmc-spacing-sm);
    }

    .fmc-form-col {
        flex: 1;
        padding: 0 var(--fmc-spacing-sm);
    }

    .fmc-form-col-6 {
        flex: 0 0 50%;
        max-width: 50%;
        padding: 0 var(--fmc-spacing-sm);
    }
}

/* === ESCRITORIO (lg: 992px+) === */
@media (min-width: 992px) {
    .fmc-header {
        padding: var(--fmc-spacing-xs) 0;
    }

    .fmc-title h1 {
        font-size: var(--fmc-font-size-3xl);
    }

    .fmc-main {
        padding: var(--fmc-spacing-2xl) 0;
    }

    /* Sidebar para escritorio */
    .fmc-sidebar {
        position: sticky;
        top: 100px;
        height: calc(100vh - 120px);
        overflow-y: auto;
        background: var(--fmc-bg-primary);
        border-radius: var(--fmc-radius-md);
        box-shadow: var(--fmc-shadow);
        padding: var(--fmc-spacing-lg);
    }

    .fmc-sidebar-nav {
        list-style: none;
        padding: 0;
        margin: 0;
    }

    .fmc-sidebar-nav .nav-item {
        margin-bottom: var(--fmc-spacing-sm);
    }

    .fmc-sidebar-nav .nav-link {
        display: flex;
        align-items: center;
        gap: var(--fmc-spacing-sm);
        padding: var(--fmc-spacing-sm) var(--fmc-spacing-md);
        color: var(--fmc-text-secondary);
        text-decoration: none;
        border-radius: var(--fmc-radius);
        transition: all 0.2s ease;
    }

    .fmc-sidebar-nav .nav-link:hover {
        background-color: var(--fmc-bg-secondary);
        color: var(--fmc-primary);
    }

    .fmc-sidebar-nav .nav-link.active {
        background-color: var(--fmc-primary);
        color: var(--fmc-text-light);
    }

    /* Layout de dos columnas */
    .fmc-layout-sidebar {
        display: grid;
        grid-template-columns: 250px 1fr;
        gap: var(--fmc-spacing-xl);
        align-items: start;
    }

    /* Modales más grandes en escritorio */
    .fmc-modal-lg {
        max-width: 800px;
    }

    .fmc-modal-xl {
        max-width: 1140px;
    }
}

/* === ESCRITORIO GRANDE (xl: 1200px+) === */
@media (min-width: 1200px) {
    .fmc-layout-sidebar {
        grid-template-columns: 300px 1fr;
        gap: var(--fmc-spacing-2xl);
    }

    .fmc-main .container-fluid {
        max-width: 85%;
        margin: 0 auto;
    }

    /* Footer en escritorio grande */
    .footer-content {
        max-width: 1400px;
        gap: var(--fmc-spacing-2xl);
    }
}

/* === RESPONSIVE FOOTER === */

/* Tablets (768px-991px) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .footer-content {
        grid-template-columns: 1fr 1fr 1fr;
        gap: var(--fmc-spacing-lg);
        padding: 0 var(--fmc-spacing-md);
    }

    .footer-logo-section {
        align-items: center;
        text-align: center;
    }

    .footer-contact-section {
        align-items: center;
        text-align: center;
    }

    .footer-links-section {
        align-items: center;
        text-align: center;
    }

    .footer-back-to-top {
        justify-content: flex-end;
    }
}

/* Mobile (max-width: 767px) */
@media (max-width: 767.98px) {
    .fmc-footer-redesigned {
        padding: var(--fmc-spacing-xl) 0;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: var(--fmc-spacing-lg);
        padding: 0 var(--fmc-spacing-md);
        text-align: center;
    }

    .footer-logo-section {
        align-items: center;
        text-align: center;
    }

    .footer-logo-text {
        justify-content: center;
    }

    .footer-contact-section {
        align-items: center;
        text-align: center;
    }

    .footer-contact {
        align-items: center;
    }

    .footer-links-section {
        align-items: center;
        text-align: center;
    }

    .footer-nav-list {
        align-items: center;
    }

    .footer-back-to-top {
        justify-content: center;
        margin-top: var(--fmc-spacing-md);
    }

    .back-to-top-btn {
        width: 50px;
        height: 50px;
        font-size: 18px;
    }
}

/* Small Mobile (max-width: 479px) */
@media (max-width: 479px) {
    .fmc-footer-redesigned {
        padding: var(--fmc-spacing-lg) 0;
    }

    .footer-content {
        gap: var(--fmc-spacing-md);
        padding: 0 var(--fmc-spacing-sm);
    }

    .footer-logo-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .footer-logo-title {
        font-size: 12px;
    }

    .footer-logo-subtitle {
        font-size: 11px;
    }

    .footer-contact-line {
        font-size: 12px;
    }

    .footer-nav-link {
        font-size: 12px;
        padding: var(--fmc-spacing-xs) var(--fmc-spacing-sm);
    }

    .back-to-top-btn {
        width: 45px;
        height: 45px;
        font-size: 16px;
    }

    .footer-logo-section,
    .footer-contact-section,
    .footer-links-section {
        align-items: center;
        text-align: center;
    }
}

/* === ADAPTACIONES ESPECÍFICAS === */

/* Formularios táctiles */
@media (hover: none) and (pointer: coarse) {

    .fmc-form-control,
    .fmc-form-select {
        min-height: 44px;
        /* Tamaño mínimo táctil */
    }

    .fmc-btn {
        min-height: 44px;
        padding: var(--fmc-spacing-md) var(--fmc-spacing-lg);
    }

    .nav-link {
        min-height: 44px;
    }
}

/* Modo oscuro en dispositivos que lo soporten */
@media (prefers-color-scheme: dark) {
    .fmc-auto-dark {
        --fmc-bg-primary: #1e293b;
        --fmc-bg-secondary: #334155;
        --fmc-bg-tertiary: #475569;
        --fmc-text-primary: #ffffff;
        --fmc-text-secondary: #cbd5e1;
        --fmc-text-muted: #94a3b8;
        --fmc-border-color: #475569;
        --fmc-border-light: #334155;
    }
}

/* Reducir movimiento para usuarios que lo prefieran */
@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;
    }
}

/* Impresión */
@media print {

    .fmc-header,
    .fmc-navbar,
    .fmc-breadcrumb,
    .navbar-toggler,
    .fmc-btn,
    .fmc-alert {
        display: none !important;
    }

    .fmc-main {
        padding: 0 !important;
    }

    .fmc-card {
        border: 1px solid #000 !important;
        box-shadow: none !important;
        page-break-inside: avoid;
    }

    .fmc-table {
        border-collapse: collapse !important;
    }

    .fmc-table th,
    .fmc-table td {
        border: 1px solid #000 !important;
    }
}

/* === UTILIDADES RESPONSIVAS ADICIONALES === */

/* Espaciado responsivo */
@media (max-width: 767.98px) {
    .p-mobile-sm {
        padding: var(--fmc-spacing-sm) !important;
    }

    .p-mobile-md {
        padding: var(--fmc-spacing-md) !important;
    }

    .m-mobile-sm {
        margin: var(--fmc-spacing-sm) !important;
    }

    .m-mobile-md {
        margin: var(--fmc-spacing-md) !important;
    }
}

/* Texto responsivo */
@media (max-width: 575.98px) {
    .text-mobile-center {
        text-align: center !important;
    }

    .text-mobile-left {
        text-align: left !important;
    }
}

/* Flex responsivo */
@media (max-width: 767.98px) {
    .flex-mobile-column {
        flex-direction: column !important;
    }

    .flex-mobile-wrap {
        flex-wrap: wrap !important;
    }
}

/* Ancho responsivo */
@media (max-width: 575.98px) {
    .w-mobile-100 {
        width: 100% !important;
    }
}

@media (min-width: 768px) {
    .w-tablet-50 {
        width: 50% !important;
    }

    .w-tablet-33 {
        width: 33.333333% !important;
    }

    .w-tablet-25 {
        width: 25% !important;
    }
}

/* Overflow responsivo */
@media (max-width: 767.98px) {
    .overflow-mobile-auto {
        overflow: auto !important;
    }

    .overflow-x-mobile-auto {
        overflow-x: auto !important;
    }
}