/* ═══════════════════════════════════════════════════════════════════
   APP.CSS - Sistema MultiAcert - Estilos Globais
   Bootstrap 5.3 base
   ═══════════════════════════════════════════════════════════════════ */

:root {
    --bg-main: #f0f2f5;
    --bg-card: #ffffff;
    --bg-section: #f8f9fb;
    --border-color: #e2e5ea;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff4ff;
    --success: #16a34a;
    --success-hover: #15803d;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --danger: #ef4444;
    --radius: 10px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
}

* { 
    box-sizing: border-box; 
}

/* ══════════════════════════════
   FIX LARGURA iOS/Mobile
   ══════════════════════════════ */
html, body {
    overflow-x: hidden;
    width: 100%;
}

body {
    background: var(--bg-main);
    font-family: 'DM Sans', sans-serif;
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    padding-top: 62px; /* espaço do navbar fixo */
    position: relative;
    -webkit-text-size-adjust: 100%;
}

/* Previne overflow em containers */
.container, .container-fluid {
    max-width: 100%;
    padding-left: 12px;
    padding-right: 12px;
}

#pagina, .main-card, .section-block, .row {
    max-width: 100%;
}

/* Select2 não ultrapassar tela */
.select2-container {
    max-width: 100% !important;
}

/* Inputs não ultrapassar tela */
input, select, textarea, .form-control, .form-select {
    max-width: 100%;
}

/* Tabelas responsivas */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Previne elementos grandes */
img, video, iframe, embed, object {
    max-width: 100%;
    height: auto;
}

/* ══════════════════════════════
   NAVBAR
   ══════════════════════════════ */
.navbar-main {
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
    box-shadow: var(--shadow-md);
    padding: 0 16px;
    min-height: 62px;
}
.navbar-main .navbar-brand {
    color: #fff;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.navbar-main .navbar-brand:hover { color: #fff; }
.navbar-main .nav-link {
    color: rgba(255,255,255,0.8);
    font-size: 0.88rem;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: 8px;
    transition: all 0.2s;
    white-space: nowrap;
}
.navbar-main .nav-link:hover,
.navbar-main .nav-link.active {
    color: #fff;
    background: rgba(255,255,255,0.15);
}
.navbar-main .nav-link i { margin-right: 4px; }
.navbar-main .navbar-toggler {
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    padding: 4px 10px;
}
.navbar-main .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255,255,255,0.8%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}
/* Utilitários dropdown */
.navbar-main .dropdown-menu {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    padding: 6px;
    min-width: 220px;
}
.navbar-main .dropdown-item {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: 6px;
    padding: 8px 12px;
    transition: all 0.15s;
}
.navbar-main .dropdown-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

/* ══════════════════════════════
   CONTEÚDO PRINCIPAL
   ══════════════════════════════ */
#pagina {
    padding: 20px 0;
}

/* ══════════════════════════════
   MODAL / LOADING GLOBAL
   ══════════════════════════════ */
#modal {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.5);
    backdrop-filter: blur(4px);
    display: none;
    z-index: 9990;
    align-items: center;
    justify-content: center;
}
#modal.show { display: flex; }
#aguarde {
    background: #fff;
    padding: 40px 50px;
    border-radius: 16px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    position: static;
    width: auto;
    height: auto;
}
#aguarde .spinner-border {
    width: 3rem;
    height: 3rem;
    color: var(--primary);
}
#aguarde p {
    margin-top: 16px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ══════════════════════════════
   MODAL EDITAR (overlay)
   ══════════════════════════════ */
#modal_editar {
    position: fixed;
    inset: 0;
    background: var(--bg-main);
    z-index: 9980;
    overflow: auto;
    padding: 20px;
}

/* ══════════════════════════════
   MODAL MANUTENÇÃO
   ══════════════════════════════ */
#manut {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 600px;
    z-index: 9985;
}
#manut .modal-content {
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    padding: 20px;
}

/* ══════════════════════════════
   ANOTAR VENDA MODAL
   ══════════════════════════════ */
.modal .modal-dialog { max-width: 600px; }
.modal .modal-content {
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

/* ══════════════════════════════
   TABELAS
   ══════════════════════════════ */
.tabela {
    width: 100%;
    font-size: 0.85rem;
}
.tabela th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 8px 10px;
}
.tabela td {
    padding: 6px 10px;
    color: var(--text-primary);
}
.tb-secundary {
    background: var(--bg-section);
}

/* ══════════════════════════════
   RELATÓRIO BOXES (rodando, parada, etc)
   ══════════════════════════════ */
.status-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 12px 16px;
    overflow: auto;
}
.status-box-title {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--primary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ══════════════════════════════
   BOTÕES GLOBAIS
   ══════════════════════════════ */
.btn-sm {
    font-size: 0.82rem;
    border-radius: 6px;
    padding: 4px 12px;
}

/* ══════════════════════════════
   SELECT2 GLOBAL
   ══════════════════════════════ */
.select2-container--bootstrap-5 .select2-selection {
    border-radius: 8px !important;
    border-color: var(--border-color) !important;
    min-height: 38px !important;
    font-size: 0.88rem !important;
}

/* ══════════════════════════════
   COMPATIBILIDADE COM TELAS ANTIGAS
   Bootstrap 3 classes que ainda podem ser usadas
   ══════════════════════════════ */
.panel { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius); margin-bottom: 20px; }
.panel-heading { padding: 12px 16px; font-weight: 600; border-bottom: 1px solid var(--border-color); background: var(--bg-section); border-radius: var(--radius) var(--radius) 0 0; }
.panel-body { padding: 16px; }
.panel-footer { padding: 12px 16px; border-top: 1px solid var(--border-color); background: var(--bg-section); }
.panel-default { border-color: var(--border-color); }
.form-signin { max-width: 400px; margin: 0 auto; }
.filtro { padding-left: 15px; padding-right: 20px; color: #999; }

/* ══════════════════════════════
   BOTÕES DE AÇÃO (relatório)
   ══════════════════════════════ */
.retangulo {
    display: inline-block;
    width: 28px;
    height: 28px;
    text-align: center;
    vertical-align: middle;
    padding: 2px;
    cursor: default;
}
.retangulo.mouse_move { cursor: pointer; }
.retangulo.mouse_move:hover { opacity: 0.7; }
.down {
    width: 24px;
    height: 24px;
    object-fit: contain;
}
.opaco { opacity: 0.3; }
/* Tabela de botões: forçar ocupar 100% e não exceder */
.status-body table.table {
    width: 100%;
    table-layout: fixed;
}
.status-body table.table td {
    padding: 2px 1px;
    text-align: center;
    border: none;
}

/* ══════════════════════════════
   COPIED TOOLTIP
   ══════════════════════════════ */
.btn_toltip { position: relative; }
.btn_toltip.copied::after {
    content: "Copiado!";
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: #fff;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

/* ══════════════════════════════
   RESPONSIVO
   ══════════════════════════════ */
@media (max-width: 768px) {
    body { padding-top: 56px; }
    #pagina { padding: 12px 0; }
    #modal_editar { padding: 10px; }
    #manut { width: 96%; }
    .navbar-main .nav-link { padding: 8px 12px; font-size: 0.85rem; }
}
@media print {
    .navbar-main, #no_print { display: none !important; }
    body { padding-top: 0; }
}
