/* Styles principais do Advoga Online */

:root {
    --primary-color: #003366;
    --secondary-color: #0066cc;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
}

/* Layout geral */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
}

/* Navbar padronizada em todas as páginas */
.navbar {
    background: linear-gradient(120deg, #09111e, #123157) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Navbar glass effect para páginas secundárias - sobrescreve estilo genérico */
.navbar-top {
    background: rgba(255, 255, 255, 0.84) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08) !important;
    backdrop-filter: blur(10px) !important;
}

.navbar-top .nav-link {
    color: rgba(0, 0, 0, 0.7) !important;
}

.navbar-top .nav-link:hover {
    color: var(--primary-color) !important;
}

.navbar-top .navbar-brand {
    color: var(--primary-color) !important;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.3rem;
    color: #fff !important;
}

.navbar-brand:hover {
    color: #e0e0e0 !important;
}

.navbar-dark .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    transition: color 0.3s ease;
}

.navbar-dark .navbar-nav .nav-link:hover {
    color: #fff !important;
}

.navbar-dark .navbar-nav .nav-link.active {
    color: #fff !important;
    font-weight: 600;
}

footer.bg-dark {
    background: linear-gradient(120deg, #09111e, #123157) !important;
}

/* Hero section */
.hero-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    min-height: 60vh;
    display: flex;
    align-items: center;
}

/* Feature cards */
.feature-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #e9ecef;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
}

.feature-icon {
    font-size: 2rem;
}

/* Plan cards */
.plan-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-radius: 10px;
}

.plan-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
}

.plan-card.border-primary {
    border-width: 2px !important;
}

/* Contact items */
.contact-item {
    padding: 2rem 1rem;
}

.contact-icon {
    font-size: 1.5rem;
}

/* Forms */
.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 51, 102, 0.25);
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Step indicator */
.step-indicator {
    padding: 0;
    margin: 0;
}

.step-indicator li {
    flex: 1;
    text-align: center;
    padding: 0.5rem;
    position: relative;
    font-weight: 500;
}

.step-indicator li:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 15px;
    right: -50%;
    width: 100%;
    height: 2px;
    background: #dee2e6;
    z-index: -1;
}

.step-indicator li.completed:not(:last-child)::after {
    background: var(--success-color);
}

.step-indicator li.active:not(:last-child)::after {
    background: linear-gradient(to right, var(--primary-color) 50%, #dee2e6 50%);
}

/* Dashboard styles */
.dashboard-card {
    border-radius: 10px;
    border: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}

.dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 1rem;
}

.stat-icon {
    font-size: 3rem;
    opacity: 0.8;
}

/* Navbar customization */
.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
}

/* Footer */
footer a {
    text-decoration: none;
    transition: color 0.3s ease;
}

footer a:hover {
    color: var(--secondary-color) !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .hero-section {
        min-height: 50vh;
        text-align: center;
    }
    
    .hero-section .display-4 {
        font-size: 2rem;
    }
    
    .feature-card {
        margin-bottom: 2rem;
    }
    
    .step-indicator li {
        font-size: 0.9rem;
        padding: 0.25rem;
    }
    
    .step-indicator li::before {
        width: 25px;
        height: 25px;
        font-size: 0.8rem;
    }
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Flash messages */
.alert {
    border-radius: 10px;
    border: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Tables */
.table-responsive {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.table th {
    background-color: var(--light-color);
    border-bottom: 2px solid var(--primary-color);
    font-weight: 600;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Animation utilities */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

.slide-up {
    animation: slideUp 0.6s ease-out;
}

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

/* Print styles */
@media print {
    .navbar, .footer, .btn, .no-print {
        display: none !important;
    }
    
    .container {
        width: 100% !important;
        max-width: none !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .feature-card {
        background: #2d3748;
        color: white;
        border-color: #4a5568;
    }
    
    .dashboard-card {
        background: #2d3748;
        color: white;
    }
}

/* Mobile & Touch UX Best Practices (Fitts' Law, iOS zoom prevention & ergonomics) */
html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    overflow-x: clip;
}

@media (max-width: 768px) {
    /* Evita o zoom indesejado no iOS Safari ao focar em inputs */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    input[type="number"],
    input[type="search"],
    select,
    textarea {
        font-size: 16px !important;
    }

    /* Otimização de toque e scroll momentum */
    .table-responsive,
    .overflow-auto,
    .overflow-scroll {
        -webkit-overflow-scrolling: touch;
    }

    /* Barra de rolagem permanente e visível para tabelas no mobile (evita que pareçam cortadas) */
    .table-responsive::-webkit-scrollbar {
        height: 6px !important;
        -webkit-appearance: none !important;
        display: block !important;
    }
    .table-responsive::-webkit-scrollbar-track {
        background: rgba(148, 163, 184, 0.15) !important;
        border-radius: 99px !important;
    }
    .table-responsive::-webkit-scrollbar-thumb {
        background: #94a3b8 !important;
        border-radius: 99px !important;
    }
    .table-responsive {
        scrollbar-width: thin;
        scrollbar-color: #94a3b8 rgba(148, 163, 184, 0.15);
    }

    /* Alvos de toque acessíveis (mínimo 44px) */
    button,
    .btn,
    .nav-link,
    .form-control,
    .form-select {
        touch-action: manipulation;
    }

    /* Ajuste de cards e tabelas em telas compactas */
    .card {
        border-radius: 12px;
    }

    /* Garante que tabelas não quebrem a largura da tela no mobile */
    table {
        max-width: 100%;
    }

    /* Modais em tela cheia suave no mobile */
    .modal-dialog {
        margin: 0.5rem;
    }

    /* Alívio de espaçamento para navegação mobile inferior (Thumb zone) */
    .has-bottom-tabbar {
        padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
    }

    /* Botões com área de clique ergonômica mínima (44px) para dedos humanos */
    .btn:not(.btn-sm):not(.badge) {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Inputs e selects com altura mínima de 44px (padrão ergonômico mobile) */
    .form-control:not(.form-control-sm),
    .form-select:not(.form-select-sm),
    .input-group-text {
        min-height: 44px;
    }
}

/* Utilitários de largura máxima para títulos e descrições */
.max-w-600 { max-width: 600px; }
.max-w-700 { max-width: 700px; }
.max-w-800 { max-width: 800px; }


/* =============================================================
   SISTEMA GLOBAL DE LISTAGENS MOBILE — ADVOGA.ONLINE
   Tabelas com .table-mobile-cards são convertidas em cards 
   empilhados no mobile usando data-label em cada <td>.
   ============================================================= */

/* --- Cabeçalhos de página de listagem responsive --- */
.page-list-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 1.25rem;
}
.page-list-header .header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

/* --- Card nativo de item de listagem no mobile --- */
.mobile-list-card {
    display: none;
}

/* --- Botão fechar filtros mobile --- */
.mobile-filter-toggle {
    display: none;
}

@media (max-width: 767.98px) {

    /* ── Cabeçalho de listagem ── */
    .page-list-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .page-list-header .header-actions {
        flex-wrap: wrap;
        width: 100%;
    }
    .page-list-header .header-actions .btn {
        flex: 1 1 auto;
        min-width: 100px;
        font-size: 0.85rem;
    }

    /* ── Filtros de busca ── */
    .mobile-filter-toggle {
        display: flex;
        align-items: center;
        gap: 8px;
        width: 100%;
        margin-bottom: 8px;
    }
    .filter-collapsible-body {
        border-radius: 12px;
        overflow: hidden;
    }

    /* ── Tabelas com .table-mobile-cards ── */
    /* Esconde a tabela e o cabeçalho */
    .table-mobile-cards thead {
        display: none !important;
    }
    .table-mobile-cards,
    .table-mobile-cards tbody,
    .table-mobile-cards tr {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }
    /* Cada linha vira um card */
    .table-mobile-cards tbody tr {
        background: #fff;
        border: 1px solid #e5e7eb !important;
        border-radius: 12px !important;
        margin-bottom: 12px !important;
        padding: 0 !important;
        box-shadow: 0 1px 4px rgba(0,0,0,0.06) !important;
        overflow: hidden;
    }
    .table-mobile-cards tbody tr:hover {
        background: #f9fafb !important;
    }
    /* Linha vazia / estado sem dados */
    .table-mobile-cards tbody tr.tr-empty {
        border-radius: 12px !important;
        text-align: center;
        padding: 24px !important;
    }
    .table-mobile-cards tbody tr.tr-empty td {
        display: block !important;
        border: none !important;
        padding: 8px 16px !important;
    }

    /* Cada célula vira uma linha do card com data-label */
    .table-mobile-cards td {
        display: flex !important;
        align-items: flex-start !important;
        gap: 10px !important;
        padding: 10px 14px !important;
        border: none !important;
        border-bottom: 1px solid #f0f0f0 !important;
        font-size: 0.875rem !important;
        min-height: 0 !important;
    }
    .table-mobile-cards td:last-child {
        border-bottom: none !important;
    }
    /* Label automático via data-label */
    .table-mobile-cards td[data-label]::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6b7280;
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        white-space: nowrap;
        min-width: 90px;
        flex-shrink: 0;
        padding-top: 2px;
    }
    /* Células de ações (sem label ou com label Ações) */
    .table-mobile-cards td[data-label=""],
    .table-mobile-cards td[data-label="Ações"],
    .table-mobile-cards td[data-label="Acoes"],
    .table-mobile-cards td[data-label="Ações:"] {
        justify-content: flex-end !important;
        background: #f9fafb;
        border-top: 1px solid #e5e7eb !important;
        padding: 10px 14px !important;
        gap: 8px !important;
        flex-wrap: wrap !important;
    }
    .table-mobile-cards td[data-label=""]::before,
    .table-mobile-cards td[data-label="Ações"]::before,
    .table-mobile-cards td[data-label="Acoes"]::before {
        display: none !important;
    }
    .table-mobile-cards td[data-label=""] .btn,
    .table-mobile-cards td[data-label=""] button,
    .table-mobile-cards td[data-label=""] a.btn,
    .table-mobile-cards td[data-label="Ações"] .btn,
    .table-mobile-cards td[data-label="Ações"] button,
    .table-mobile-cards td[data-label="Ações"] a.btn,
    .table-mobile-cards td[data-label="Acoes"] .btn,
    .table-mobile-cards td[data-label="Acoes"] button,
    .table-mobile-cards td[data-label="Acoes"] a.btn {
        min-height: 44px !important;
        min-width: 44px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 10px !important;
    }
    /* Linha de título/nome destacada */
    .table-mobile-cards td.td-title {
        background: linear-gradient(to right, #f8faff, #fff);
        padding: 12px 14px !important;
        font-size: 0.95rem !important;
        font-weight: 600 !important;
        border-bottom: 2px solid #e5e7eb !important;
    }
    .table-mobile-cards td.td-title::before {
        display: none;
    }
    .table-mobile-cards td.td-title a {
        font-size: 0.95rem;
        font-weight: 700;
    }

    /* ── Esconder colunas secundárias em mobile com .d-mobile-none ── */
    .table-mobile-cards td.d-mobile-none {
        display: none !important;
    }

    /* ── Cards nativos de listagem (alternativa à tabela) ── */
    .mobile-list-card {
        display: block;
        background: #fff;
        border: 1px solid #e5e7eb;
        border-radius: 12px;
        margin-bottom: 12px;
        overflow: hidden;
        box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    }
    .mobile-list-card .mlc-header {
        padding: 12px 14px 8px;
        border-bottom: 1px solid #f0f0f0;
    }
    .mobile-list-card .mlc-title {
        font-weight: 700;
        font-size: 0.95rem;
        color: #111827;
        margin-bottom: 4px;
        line-height: 1.35;
    }
    .mobile-list-card .mlc-subtitle {
        font-size: 0.78rem;
        color: #6b7280;
        line-height: 1.4;
    }
    .mobile-list-card .mlc-body {
        padding: 8px 14px;
    }
    .mobile-list-card .mlc-row {
        display: flex;
        align-items: flex-start;
        gap: 8px;
        padding: 5px 0;
        border-bottom: 1px solid #f5f5f5;
        font-size: 0.82rem;
    }
    .mobile-list-card .mlc-row:last-child {
        border-bottom: none;
    }
    .mobile-list-card .mlc-label {
        font-weight: 600;
        color: #6b7280;
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        min-width: 80px;
        flex-shrink: 0;
        padding-top: 1px;
    }
    .mobile-list-card .mlc-value {
        flex: 1;
        color: #374151;
        word-break: break-word;
    }
    .mobile-list-card .mlc-footer {
        padding: 10px 14px;
        background: #f9fafb;
        border-top: 1px solid #e5e7eb;
        display: flex;
        gap: 6px;
        flex-wrap: wrap;
        align-items: center;
        justify-content: flex-end;
    }
    .mobile-list-card .mlc-footer .btn {
        font-size: 0.78rem;
        padding: 6px 10px;
        min-height: 34px;
    }
    /* Ocultar tabela desktop quando cards mobile existem lado a lado */
    .desktop-table-only {
        display: none !important;
    }
    .mobile-cards-only {
        display: block !important;
    }
}

@media (min-width: 768px) {
    /* No desktop, oculta os cards mobile e mostra a tabela */
    .mobile-cards-only {
        display: none !important;
    }
    .desktop-table-only {
        display: block !important;
    }
}

/* btn-xs utilitário (usado em tabelas com ações compactas) */
.btn-xs {
    padding: 2px 6px;
    font-size: 0.72rem;
    border-radius: 4px;
    line-height: 1.5;
}

/* =============================================================
   MOBILE APP-LIKE NATIVE COMPONENTS (iOS & Android Native Feel)
   ============================================================= */

/* Feedback tátil e touch-action otimizado para polegar */
@media (max-width: 767.98px) {
    button, a.btn, .tabbar-item, .nav-link, .btn-icon {
        -webkit-tap-highlight-color: transparent !important;
        touch-action: manipulation;
    }

    button:active, a.btn:active, .tabbar-item:active {
        transform: scale(0.97);
        transition: transform 0.08s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .mobile-list-card .mlc-footer .btn {
        font-size: 0.82rem !important;
        padding: 8px 12px !important;
        min-height: 44px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        border-radius: 8px !important;
    }
}

/* --- Native Bottom Sheet Component --- */
.native-bottom-sheet-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(8, 20, 38, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1080;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.25s;
}

.native-bottom-sheet-backdrop.show {
    opacity: 1;
    visibility: visible;
}

.native-bottom-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 88vh;
    background: #ffffff;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -12px 35px rgba(0, 0, 0, 0.25);
    z-index: 1090;
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
}

.native-bottom-sheet.show {
    transform: translateY(0);
}

.native-bottom-sheet-handle {
    width: 38px;
    height: 5px;
    background: #cbd5e1;
    border-radius: 99px;
    margin: 12px auto 6px;
    flex-shrink: 0;
    cursor: grab;
}

.native-bottom-sheet-header {
    padding: 10px 20px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #f1f5f9;
}

.native-bottom-sheet-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.native-bottom-sheet-close {
    background: #f1f5f9;
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.15s ease;
}

.native-bottom-sheet-close:active {
    background: #e2e8f0;
}

.native-bottom-sheet-body {
    padding: 16px 20px 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
}

/* Grade de Apps estilo iOS / Android para o Menu "Mais" */
.native-app-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px 10px;
    padding: 8px 0;
}

.native-app-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #1e293b;
    gap: 8px;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
}

.native-app-item:hover,
.native-app-item:focus {
    color: #0f172a;
}

.native-app-icon {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.native-app-item:active .native-app-icon {
    transform: scale(0.92);
}

.native-app-label {
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;
    color: #334155;
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Seções de categoria no Bottom Sheet */
.native-sheet-section-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #94a3b8;
    margin: 16px 0 10px;
}
.native-sheet-section-title:first-child {
    margin-top: 0;
}
