/* ========================================
   RESPONSIVIDAD MEJORADA - BOMBEROS NAVALES
   Mobile-first responsive enhancements
   ======================================== */

/* ============================================
   MOBILE FIRST - Extra Small (xs) - 320px+
   ============================================ */

@media (max-width: 375px) {
    :root {
        font-size: 14px; /* Reducir base para mobile muy pequeños */
    }
    
    .hero-title {
        font-size: 1.75rem;
        line-height: 1.1;
    }
    
    .hero-subtitle {
        font-size: 0.9rem;
        margin-top: 1rem;
    }
    
    .bn-navbar .navbar-brand img {
        height: 40px !important;
    }
    
    .section-title {
        font-size: 1.4rem;
        padding-left: 0.75rem;
    }
    
    .btn-primary-red,
    .btn-tactical-primary {
        padding: 0.65rem 1.2rem;
        font-size: 0.75rem;
        gap: 6px;
    }
    
    .bn-card-title {
        font-size: 0.95rem;
    }
    
    .bn-card-desc {
        font-size: 0.8rem;
    }
    
    .container,
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

/* ============================================
   SMALL - 576px+
   ============================================ */

@media (max-width: 575.98px) {
    :root {
        font-size: 15px;
    }
    
    .hero-section {
        min-height: 80vh;
        padding-top: 60px;
    }
    
    .hero-title {
        font-size: clamp(1.75rem, 6vw, 2.5rem);
        margin: 1rem 0;
    }
    
    .hero-badge {
        font-size: 0.6rem;
        padding: 4px 12px;
    }
    
    .hero-slider-frame {
        border-radius: 8px;
    }
    
    .hero-slider-frame .carousel-inner {
        height: 220px;
    }
    
    .hero-slider-frame .carousel-caption {
        padding: 1rem 1rem 0.8rem;
    }
    
    .page-header {
        min-height: 25vh;
    }
    
    .section-label {
        font-size: 0.65rem;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .stat-number {
        font-size: clamp(1.75rem, 5vw, 2.5rem);
    }
    
    /* Cards responsivos */
    .bn-card {
        margin-bottom: 1rem;
    }
    
    .bn-card-img {
        height: 180px;
    }
    
    .bn-card-body {
        padding: 1.2rem;
    }
    
    /* Buttons para mobile */
    .btn-primary-red,
    .btn-tactical-primary,
    .btn-tactical-secondary {
        width: 100%;
        justify-content: center;
        margin-bottom: 0.75rem;
    }
    
    /* Forms responsivos */
    .form-control,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    textarea {
        font-size: 16px !important; /* Evitar zoom en iOS */
        padding: 0.75rem;
    }
    
    label {
        font-size: 0.85rem;
        margin-bottom: 0.4rem;
    }
    
    /* Navbar mobile */
    .bn-navbar .nav-link {
        padding: 0.6rem 0.5rem !important;
        font-size: 0.75rem;
    }
    
    .bn-navbar .navbar-collapse {
        background: rgba(10, 14, 23, 0.95) !important;
        backdrop-filter: blur(20px);
        padding: 1rem;
        border-radius: 8px;
        margin-top: 0.5rem;
        border: 1px solid var(--navy-border);
    }

    body.light-mode .bn-navbar .navbar-collapse {
        background: #ffffff !important;
        border: 1px solid #e2e8f0 !important;
        box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05) !important;
    }
}

/* Menú colapsado (navbar-expand-xl): centrar enlaces y acciones */
@media (max-width: 1199.98px) {
    .bn-navbar .navbar-nav {
        align-items: center;
        text-align: center;
    }

    .bn-navbar .nav-link {
        text-align: center;
    }

    .bn-navbar #mainNavbar > .d-flex {
        justify-content: center;
        flex-wrap: wrap;
        width: 100%;
    }

    body.light-mode .bn-navbar .navbar-collapse {
        background: #ffffff !important;
        border: 1px solid #e2e8f0 !important;
        box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05) !important;
    }

    body.light-mode .bn-navbar .nav-link {
        color: #1e293b !important;
    }

    body.light-mode .bn-navbar .nav-link:hover,
    body.light-mode .bn-navbar .nav-link.active {
        color: var(--primary-red) !important;
    }

    body.light-mode .bn-navbar #themeToggleBtn {
        color: #1e293b !important;
    }
}

@media (min-width: 1200px) {
    .bn-navbar .navbar-collapse,
    body.light-mode .bn-navbar .navbar-collapse {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }
}

/* ============================================
   MEDIUM - 768px+
   ============================================ */

@media (min-width: 768px) {
    :root {
        font-size: 16px;
    }
    
    .hero-title {
        font-size: clamp(2.2rem, 6vw, 3.5rem);
    }
    
    .hero-slider-frame .carousel-inner {
        height: 350px;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .stat-number {
        font-size: clamp(2.2rem, 6vw, 3rem);
    }
    
    /* Cards en grid */
    .cards-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 2rem;
    }
    
    /* Buttons alineación horizontal */
    .btn-group-responsive {
        display: flex;
        gap: 1rem;
        flex-wrap: wrap;
    }
    
    .btn-group-responsive .btn {
        flex: 1;
        min-width: 150px;
    }
}

/* ============================================
   LARGE - 992px+
   ============================================ */

@media (min-width: 992px) {
    .hero-title {
        font-size: clamp(2.8rem, 7vw, 4.2rem);
    }
    
    .hero-slider-frame .carousel-inner {
        height: 420px;
    }
    
    .section-title {
        font-size: clamp(1.8rem, 4vw, 2.4rem);
    }
    
    /* Navbar desktop */
    .bn-navbar .nav-link {
        padding: 0.5rem 1rem !important;
    }
    
    /* Grid de 3 columnas */
    .cards-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    /* Buttons alineación horizontal */
    .btn-group-responsive {
        justify-content: flex-start;
    }
    
    .btn-group-responsive .btn {
        flex: 0 1 auto;
    }
}

/* ============================================
   EXTRA LARGE - 1200px+
   ============================================ */

@media (min-width: 1200px) {
    .hero-title {
        font-size: 4.5rem;
    }
    
    .hero-slider-frame .carousel-inner {
        height: 480px;
    }
    
    .section-title {
        font-size: 2.8rem;
    }
    
    .stat-number {
        font-size: 3.5rem;
    }
    
    /* Grid de 4 columnas */
    .cards-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ============================================
   XXL - 1400px+
   ============================================ */

@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }
    
    .hero-slider-frame .carousel-inner {
        height: 540px;
    }
}

/* ============================================
   LANDSCAPE MODE
   ============================================ */

@media (orientation: landscape) and (max-height: 600px) {
    .hero-section {
        min-height: 100%;
    }
    
    .hero-title {
        font-size: 2rem;
        margin: 0.5rem 0;
    }
    
    .hero-subtitle {
        font-size: 0.85rem;
        display: none;
    }
}

/* ============================================
   ACCESSIBILITY - Reduced Motion
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   DARK MODE SUPPORT (si es necesario)
   ============================================ */

/* Ya está optimizado para dark como tema principal */

/* ============================================
   PRINT MEDIA
   ============================================ */

@media print {
    body {
        background: white;
        color: black;
    }
    
    header,
    footer,
    .no-print {
        display: none !important;
    }
    
    .container {
        max-width: 100%;
    }
    
    .print-page {
        page-break-inside: avoid;
    }
    
    img {
        max-width: 100%;
    }
}

/* ============================================
   FIXES PARA PROBLEMAS COMUNES
   ============================================ */

/* Evitar overflow en mobile */
body {
    overflow-x: hidden;
}

/* Asegurar que las imágenes sean responsive */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Videos responsive */
video {
    max-width: 100%;
    height: auto;
}

/* Iframes responsive */
iframe {
    max-width: 100%;
}

/* ============================================
   TABLAS RESPONSIVE - DataTables & Standard
   ============================================ */

/* DataTables wrapper responsive */
.dataTables_wrapper {
    width: 100%;
    overflow-x: auto;
}

.dataTables_scroll {
    width: 100%;
}

.dataTables_scrollBody {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Tabla base responsive */
table {
    width: 100%;
    border-collapse: collapse;
}

table thead th {
    background-color: var(--navy-dark, #0f1419);
    color: white;
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
}

table tbody td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--navy-border, #e2e8f0);
    word-break: break-word;
}

table tbody tr:hover {
    background-color: rgba(229, 28, 35, 0.05);
}

/* Mobile: Tablas colapsadas */
@media (max-width: 767.98px) {
    .table-responsive {
        font-size: 0.85rem;
        border: none;
    }
    
    /* Hide scrollbar but keep scrolling */
    .table-responsive,
    .table-tactical {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* DataTables responsivo */
    .dataTables_wrapper {
        font-size: 0.85rem;
    }
    
    .dataTables_wrapper .dataTables_filter {
        margin-bottom: 1rem;
    }
    
    .dataTables_wrapper .dataTables_filter input {
        width: 100%;
        max-width: 100%;
        padding: 0.5rem;
    }
    
    .dataTables_wrapper .dataTables_info {
        font-size: 0.75rem;
    }
    
    .dataTables_wrapper .dataTables_paginate {
        text-align: center;
        padding-top: 1rem;
    }
    
    .dataTables_wrapper .dataTables_paginate .paginate_button {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    table {
        font-size: 0.8rem;
    }
    
    table thead {
        display: table;
        width: 100%;
    }
    
    table tbody {
        display: table;
        width: 100%;
    }
    
    table tr {
        display: table-row;
        width: 100%;
    }
    
    table td {
        display: table-cell;
        padding: 0.5rem;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    /* Columnas de acciones más pequeñas */
    table th:last-child,
    table td:last-child {
        min-width: 80px;
        width: 80px;
    }
    
    /* Buttons en tablas */
    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
    }
    
    /* Forms en modales mobile */
    .modal-content {
        border-radius: 0;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
}

/* ============================================
   PANEL ADMINISTRADOR RESPONSIVE
   ============================================ */

/* Admin sidebar collapse en mobile */
@media (max-width: 991.98px) {
    .admin-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        width: 100%;
        max-width: 300px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
    }
    
    .admin-sidebar.show {
        transform: translateX(0);
    }
    
    .admin-content {
        margin-left: 0;
    }
}

/* Admin top bar responsive */
@media (max-width: 767.98px) {
    .admin-top-bar .d-none.d-md-flex {
        display: none !important;
    }
}

/* Admin forms responsive */
@media (max-width: 575.98px) {
    .admin-form-group {
        margin-bottom: 1rem;
    }
    
    .admin-form-group input,
    .admin-form-group select,
    .admin-form-group textarea {
        width: 100%;
        padding: 0.75rem;
        font-size: 16px;
    }
    
    .admin-form-buttons {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .admin-form-buttons button {
        width: 100%;
    }
    
    /* Admin cards en mobile */
    .admin-card {
        margin-bottom: 1rem;
    }
    
    .admin-card-header {
        padding: 1rem 0.75rem;
    }
    
    .admin-card-body {
        padding: 0.75rem;
    }
}

/* Admin stats responsive */
@media (max-width: 767.98px) {
    .admin-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .admin-stat-card {
        padding: 1rem;
    }
    
    .admin-stat-number {
        font-size: 1.75rem;
    }
}

/* Admin forms de dos columnas a una en mobile */
@media (max-width: 767.98px) {
    .row [class*="col-"] {
        width: 100%;
    }
    
    .form-row > [class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* Tablas responsive - Estilos generales */
/* Ya están configuradas arriba en sección Mobile */

/* ============================================
   UTILITY CLASSES RESPONSIVE
   ============================================ */

.show-xs { display: none; }
.show-sm { display: none; }
.show-md { display: none; }
.show-lg { display: none; }
.show-xl { display: none; }

@media (max-width: 375px) {
    .show-xs { display: block; }
    .hide-xs { display: none; }
}

@media (max-width: 575.98px) {
    .show-sm { display: block; }
    .hide-sm { display: none; }
}

@media (min-width: 768px) {
    .show-md { display: block; }
    .hide-md { display: none; }
}

@media (min-width: 992px) {
    .show-lg { display: block; }
    .hide-lg { display: none; }
}

@media (min-width: 1200px) {
    .show-xl { display: block; }
    .hide-xl { display: none; }
}
