/* ============================================
   Mirabyte Gestión - Mobile First Custom CSS
   ============================================ */

/* --- Variables de color --- */
:root {
    --mb-primary: #1e3c72;
    --mb-primary-light: #2a5298;
    --mb-accent: #00b4d8;
    --mb-success: #2ecc71;
    --mb-warning: #f39c12;
    --mb-danger: #e74c3c;
    --mb-dark: #2c3e50;
    --mb-gray: #6c757d;
    --mb-light: #f4f6f9;
    --mb-white: #ffffff;
    --mb-radius: 14px;
    --mb-shadow: 0 2px 12px rgba(0,0,0,0.08);
    --mb-bottom-nav-height: 64px;
}

/* --- Reset & Base Mobile --- */
* {
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 15px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--mb-light);
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
}

/* --- Ocultar sidebar de AdminLTE en mobile --- */
.main-sidebar {
    display: none !important;
}

/* --- Navbar superior simplificada --- */
.main-header.navbar {
    background: var(--mb-primary) !important;
    border: none;
    padding: 8px 12px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1040;
    min-height: 56px;
}

.main-header .navbar-nav .nav-link {
    color: rgba(255,255,255,0.85) !important;
    font-size: 1.15rem;
    padding: 8px 10px;
}

.main-header .navbar-nav .nav-link:hover,
.main-header .navbar-nav .nav-link:active {
    color: #fff !important;
}

.main-header .navbar-brand-mobile {
    color: #fff !important;
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: 0.3px;
}

.main-header .navbar-brand-mobile i {
    color: var(--mb-accent);
    margin-right: 6px;
}

/* --- Content wrapper ajustado --- */
.content-wrapper {
    margin-left: 0 !important;
    padding-top: 56px;
    padding-bottom: calc(var(--mb-bottom-nav-height) + 16px);
    min-height: 100vh;
    background: var(--mb-light);
}

.content-header {
    padding: 12px 16px 4px;
}

.content-header h1 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--mb-dark);
}

.content {
    padding: 0 12px 12px;
}

/* --- Footer oculto en mobile --- */
.main-footer {
    display: none !important;
}

/* --- Preloader --- */
.preloader {
    background: var(--mb-primary) !important;
}

.preloader i {
    color: #fff !important;
}

.preloader p {
    color: rgba(255,255,255,0.8) !important;
}

/* ============================================
   Bottom Navigation Bar (estilo app nativa)
   ============================================ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--mb-bottom-nav-height);
    background: var(--mb-white);
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -2px 16px rgba(0,0,0,0.10);
    z-index: 1050;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--mb-gray);
    font-size: 0.68rem;
    font-weight: 500;
    padding: 4px 2px;
    min-width: 56px;
    transition: color 0.2s;
    position: relative;
}

.bottom-nav a i {
    font-size: 1.3rem;
    margin-bottom: 2px;
    transition: transform 0.2s;
}

.bottom-nav a.active {
    color: var(--mb-primary);
    font-weight: 700;
}

.bottom-nav a.active i {
    transform: scale(1.15);
}

.bottom-nav a:active {
    transform: scale(0.92);
}

/* Botón central del menú (más grande) */
.bottom-nav .nav-menu-btn {
    background: var(--mb-primary);
    color: #fff !important;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    margin-top: -20px;
    box-shadow: 0 4px 16px rgba(30,60,114,0.35);
    font-size: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bottom-nav .nav-menu-btn i {
    font-size: 1.5rem;
    color: #fff;
    margin: 0;
}

.bottom-nav .nav-menu-btn.active {
    background: var(--mb-accent);
}

/* ============================================
   Menú Overlay (pantalla completa)
   ============================================ */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(30,60,114,0.97);
    z-index: 1060;
    display: none;
    flex-direction: column;
    padding: 20px;
    padding-top: 60px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: fadeIn 0.25s ease;
}

.menu-overlay.show {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.menu-overlay .menu-close {
    position: absolute;
    top: 14px;
    right: 16px;
    color: #fff;
    font-size: 1.8rem;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    z-index: 10;
}

.menu-overlay .menu-header {
    text-align: center;
    margin-bottom: 24px;
}

.menu-overlay .menu-header h3 {
    color: #fff;
    font-weight: 700;
    font-size: 1.2rem;
    margin: 0;
}

.menu-overlay .menu-header small {
    color: rgba(255,255,255,0.6);
    font-size: 0.8rem;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    max-width: 400px;
    margin: 0 auto;
    width: 100%;
}

.menu-grid .menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.12);
    border-radius: var(--mb-radius);
    padding: 18px 8px;
    text-decoration: none;
    color: #fff;
    transition: all 0.2s;
    min-height: 95px;
}

.menu-grid .menu-item:hover,
.menu-grid .menu-item:active {
    background: rgba(255,255,255,0.22);
    transform: scale(0.96);
    text-decoration: none;
    color: #fff;
}

.menu-grid .menu-item i {
    font-size: 1.8rem;
    margin-bottom: 8px;
    color: var(--mb-accent);
}

.menu-grid .menu-item span {
    font-size: 0.78rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
}

.menu-grid .menu-item.active i {
    color: var(--mb-warning);
}

/* ============================================
   Cards Mobile (Dashboard)
   ============================================ */
.info-box {
    border-radius: var(--mb-radius);
    box-shadow: var(--mb-shadow);
    margin-bottom: 12px;
    min-height: auto;
    padding: 12px;
}

.info-box .info-box-icon {
    border-radius: 12px;
    width: 56px;
    height: 56px;
    font-size: 1.4rem;
}

.info-box .info-box-content {
    padding: 4px 0 4px 12px;
}

.info-box .info-box-text {
    font-size: 0.78rem;
    color: var(--mb-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-box .info-box-number {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--mb-dark);
}

.small-box {
    border-radius: var(--mb-radius);
    box-shadow: var(--mb-shadow);
    margin-bottom: 12px;
}

.small-box .inner h3 {
    font-size: 1.6rem;
    font-weight: 700;
}

.small-box .inner p {
    font-size: 0.82rem;
}

.small-box .icon > i {
    font-size: 50px;
}

/* --- Cards genéricas --- */
.card {
    border-radius: var(--mb-radius);
    box-shadow: var(--mb-shadow);
    border: none;
    margin-bottom: 12px;
}

.card-header {
    border-radius: var(--mb-radius) var(--mb-radius) 0 0 !important;
    padding: 12px 16px;
}

.card-body {
    padding: 14px 16px;
}

/* ============================================
   Greeting Card (Dashboard)
   ============================================ */
.greeting-card {
    background: linear-gradient(135deg, var(--mb-primary), var(--mb-primary-light));
    border-radius: var(--mb-radius);
    color: #fff;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 4px 20px rgba(30,60,114,0.25);
}

.greeting-card h4 {
    font-weight: 700;
    margin-bottom: 4px;
    font-size: 1.15rem;
}

.greeting-card p {
    opacity: 0.8;
    margin: 0;
    font-size: 0.85rem;
}

.greeting-card .greeting-date {
    font-size: 0.75rem;
    opacity: 0.6;
    margin-top: 8px;
}

/* ============================================
   Quick Actions (Dashboard)
   ============================================ */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.quick-action-btn {
    display: flex;
    align-items: center;
    background: var(--mb-white);
    border-radius: var(--mb-radius);
    padding: 14px;
    text-decoration: none;
    color: var(--mb-dark);
    box-shadow: var(--mb-shadow);
    transition: all 0.2s;
}

.quick-action-btn:hover,
.quick-action-btn:active {
    transform: scale(0.97);
    text-decoration: none;
    color: var(--mb-dark);
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.quick-action-btn .qa-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #fff;
    margin-right: 10px;
    flex-shrink: 0;
}

.quick-action-btn .qa-text {
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.2;
}

.quick-action-btn .qa-sub {
    font-size: 0.68rem;
    color: var(--mb-gray);
    font-weight: 400;
}

/* ============================================
   Activity List
   ============================================ */
.activity-item {
    display: flex;
    align-items: flex-start;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: #fff;
    margin-right: 10px;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
}

.activity-content strong {
    font-size: 0.82rem;
    display: block;
}

.activity-content small {
    color: var(--mb-gray);
    font-size: 0.72rem;
}

/* ============================================
   Login Page Mobile
   ============================================ */
.login-page {
    background: linear-gradient(135deg, var(--mb-primary) 0%, var(--mb-primary-light) 50%, var(--mb-primary) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.login-box {
    width: 100% !important;
    max-width: 380px;
}

.login-box .card {
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
    overflow: hidden;
}

.login-box .card-header {
    background: transparent;
    border-bottom: none;
    padding: 28px 20px 8px;
}

.login-box .card-body {
    padding: 8px 24px 28px;
}

.login-box .form-control {
    border-radius: 10px;
    height: 46px;
    font-size: 0.95rem;
}

.login-box .input-group-text {
    border-radius: 0 10px 10px 0;
}

.btn-mirabyte {
    background: linear-gradient(135deg, var(--mb-primary), var(--mb-primary-light));
    border: none;
    color: #fff;
    font-weight: 600;
    padding: 11px;
    border-radius: 10px;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.btn-mirabyte:hover,
.btn-mirabyte:active {
    background: linear-gradient(135deg, var(--mb-primary-light), var(--mb-primary));
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(30,60,114,0.4);
}

/* ============================================
   Page placeholders (módulos futuros)
   ============================================ */
.module-placeholder {
    text-align: center;
    padding: 40px 20px;
}

.module-placeholder i {
    font-size: 3rem;
    color: #ddd;
    margin-bottom: 16px;
}

.module-placeholder h4 {
    color: var(--mb-gray);
    font-weight: 600;
}

.module-placeholder p {
    color: #adb5bd;
    font-size: 0.85rem;
}

/* ============================================
   Badges & Status
   ============================================ */
.badge {
    border-radius: 8px;
    padding: 4px 10px;
    font-weight: 600;
    font-size: 0.72rem;
}

/* ============================================
   Scrollbar thin
   ============================================ */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

/* ============================================
   Modals - Por encima del bottom nav
   ============================================ */
.modal {
    z-index: 1070 !important;
}

.modal-backdrop {
    z-index: 1069 !important;
}

.modal-dialog {
    margin-bottom: calc(var(--mb-bottom-nav-height) + 16px);
}

/* ============================================
   Responsive adjustments
   ============================================ */
@media (max-width: 576px) {
    .content-header h1 {
        font-size: 1.15rem;
    }
    
    .info-box .info-box-number {
        font-size: 1.2rem;
    }
    
    .small-box .inner h3 {
        font-size: 1.3rem;
    }
}

@media (min-width: 768px) {
    .bottom-nav {
        max-width: 480px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: 20px 20px 0 0;
    }
    
    .menu-grid {
        grid-template-columns: repeat(3, 1fr);
        max-width: 420px;
    }
    
    .modal-dialog {
        margin-bottom: 0;
    }
}

/* PWA-like feel */
@supports (padding: env(safe-area-inset-bottom)) {
    .bottom-nav {
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .content-wrapper {
        padding-bottom: calc(var(--mb-bottom-nav-height) + env(safe-area-inset-bottom) + 16px);
    }
}
