/**
 * CredMoz V2 - Modern Responsive Design System & Mobile Enhancements
 * Otimizado para "Acesso Básico" em Dispositivos Móveis (Smartphones e Tablets)
 */

/* ==========================================================================
   0. FONTES INTER SELF-HOSTED (Assets Locais com Fallback Offline)
   ========================================================================== */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/assets/fonts/Inter-Regular.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/assets/fonts/Inter-Medium.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/assets/fonts/Inter-SemiBold.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/assets/fonts/Inter-Bold.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 800;
    font-display: swap;
    src: url('/assets/fonts/Inter-ExtraBold.woff2') format('woff2');
}

/* ==========================================================================
   1. VISIBILIDADE CONDICIONAL: DESKTOP vs MOBILE
   ========================================================================== */
.desktop-table-view {
    display: block;
}

.mobile-card-view {
    display: none;
}

/* ==========================================================================
   2. BARRA DE NAVEGAÇÃO INFERIOR MOBILE (BACKOFFICE BOTTOM NAV)
   ========================================================================== */
.backoffice-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 62px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
    z-index: 55;
    padding: 0 0.5rem;
    align-items: center;
    justify-content: space-around;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.backoffice-bottom-nav .nav-link {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #64748b;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.35rem 0.2rem;
    border-radius: 8px;
    transition: color 0.15s ease, transform 0.1s ease;
    position: relative;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.backoffice-bottom-nav .nav-link i {
    font-size: 1.35rem;
    margin-bottom: 2px;
    transition: transform 0.15s ease;
}

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

.backoffice-bottom-nav .nav-link.active {
    color: #059669;
}

.backoffice-bottom-nav .nav-link.active i {
    color: #059669;
    font-weight: 700;
}

.backoffice-bottom-nav .nav-badge {
    position: absolute;
    top: 2px;
    right: 22%;
    background: #ef4444;
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 999px;
    border: 2px solid #ffffff;
}

/* ==========================================================================
   3. ESTILOS DOS CARTÕES MÓVEIS (MOBILE CARDS)
   ========================================================================== */
.mobile-card-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.m-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 1rem 1.15rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.m-card:active {
    border-color: #10b981;
}

.m-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.m-card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
    text-decoration: none;
    line-height: 1.3;
}

.m-card-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.m-card-badge.badge-success {
    background: #ecfdf5;
    color: #065f46;
}

.m-card-badge.badge-danger {
    background: #fef2f2;
    color: #991b1b;
}

.m-card-badge.badge-warning {
    background: #fffbeb;
    color: #92400e;
}

.m-card-badge.badge-info {
    background: #eff6ff;
    color: #1e40af;
}

.m-card-badge.badge-neutral {
    background: #f1f5f9;
    color: #475569;
}

.m-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    font-size: 0.85rem;
    color: #334155;
    border-top: 1px dashed #f1f5f9;
    padding-top: 0.6rem;
}

.m-card-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.m-card-label {
    color: #64748b;
    font-size: 0.78rem;
    font-weight: 500;
}

.m-card-val {
    font-weight: 600;
    color: #0f172a;
}

.m-card-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-top: 1px solid #f1f5f9;
    padding-top: 0.75rem;
    margin-top: 0.25rem;
}

.m-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.55rem 0.85rem;
    border-radius: 8px;
    font-size: 0.825rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    min-height: 40px;
    transition: background 0.15s, transform 0.1s;
}

.m-btn:active {
    transform: scale(0.97);
}

.m-btn-primary {
    background: #10b981;
    color: #ffffff;
}

.m-btn-primary:hover {
    background: #059669;
}

.m-btn-dark {
    background: #0f172a;
    color: #ffffff;
}

.m-btn-secondary {
    background: #f1f5f9;
    color: #334155;
}

.m-btn-whatsapp {
    background: #25d366;
    color: #ffffff;
}

/* ==========================================================================
   4. MEDIA QUERIES GLOBAIS (<= 900px e <= 640px)
   ========================================================================== */
@media (max-width: 900px) {
    /* Exibir Navegação Inferior */
    .backoffice-bottom-nav {
        display: flex;
    }

    /* Espaço para não cobrir conteúdo com a barra inferior */
    .content-body {
        padding: 1rem 1rem 5.5rem 1rem !important;
    }

    /* Topbar mais compacta */
    .topbar {
        height: 56px !important;
        padding: 0 1rem !important;
    }

    .page-header-title {
        font-size: 1.05rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 200px;
    }

    .btn-logout span {
        display: none;
    }

    .btn-logout {
        padding: 0.45rem 0.65rem !important;
    }
}

@media (max-width: 768px) {
    /* Alternância de Tabela para Cartões Móveis */
    .desktop-table-view {
        display: none !important;
    }

    .mobile-card-view {
        display: block !important;
    }

    /* Grelhas Flexíveis */
    .responsive-grid-split {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    /* Barras de Filtro e Pesquisa Fluidas */
    .responsive-filter-bar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
    }

    .responsive-filter-bar form {
        width: 100% !important;
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .responsive-filter-bar form > div,
    .responsive-filter-bar form select,
    .responsive-filter-bar form input {
        width: 100% !important;
        min-width: 0 !important;
    }

    .responsive-filter-bar .action-btn {
        width: 100% !important;
        justify-content: center !important;
    }

    /* Grelha de Estatísticas 2x2 */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }

    .stat-card {
        padding: 1rem !important;
        border-radius: 12px !important;
    }

    .stat-value {
        font-size: 1.25rem !important;
    }

    .stat-title {
        font-size: 0.72rem !important;
    }

    .stat-icon-wrap {
        width: 30px !important;
        height: 30px !important;
        font-size: 1rem !important;
    }

    /* Banners SaaS e KYC Adaptáveis */
    .responsive-banner {
        flex-direction: column !important;
        align-items: stretch !important;
        text-align: left !important;
        padding: 1rem !important;
        gap: 0.75rem !important;
    }

    .responsive-banner a {
        width: 100% !important;
        justify-content: center !important;
    }

    /* Modal adaptado a ecrãs verticais */
    .responsive-modal-card {
        width: 95% !important;
        max-height: 90vh !important;
        margin: 1rem !important;
        overflow-y: auto !important;
        border-radius: 16px !important;
    }

    /* Abas de Período com Scroll Suave */
    .responsive-tab-scroll {
        display: flex !important;
        overflow-x: auto !important;
        padding-bottom: 0.5rem !important;
        gap: 0.4rem !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .responsive-tab-scroll::-webkit-scrollbar {
        display: none;
    }

    .responsive-tab-scroll a {
        white-space: nowrap !important;
        flex-shrink: 0 !important;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr !important;
    }

    .stat-card {
        padding: 0.85rem !important;
    }

    .stat-value {
        font-size: 1.15rem !important;
    }

    .content-body {
        padding: 0.75rem 0.75rem 5.5rem 0.75rem !important;
    }

    /* Auth Layout */
    .auth-container {
        padding: 1.5rem 1.15rem !important;
        border-radius: 16px !important;
    }
}
