/* ===== ISG Authenticator — Guia de Estilo (ESTILO.md) ===== */

:root {
    /* Cor primária — azul ISG */
    --teal:        #1565c0;
    --teal-dark:   #0d47a1;
    --teal-light:  #e3f2fd;
    --teal-mid:    #bbdefb;

    /* Topbar */
    --topbar-bg:   #0d47a1;

    /* Estrutura */
    --sidebar-bg:  #ffffff;
    --sidebar-w:   210px;
    --topbar-h:    52px;
    --body-bg:     #f4f6f8;
    --card-bg:     #ffffff;

    /* Bordas */
    --border:      #e0e4ea;
    --border-dark: #c8cdd6;

    /* Texto */
    --text-main:   #2d3748;
    --text-sub:    #718096;
    --text-muted:  #a0aec0;

    /* Status */
    --danger:      #ef5350;
    --warning:     #ffa726;
    --info:        #42a5f5;
    --green:       #66bb6a;

    /* Misc */
    --radius:      6px;
    --shadow-sm:   0 1px 4px rgba(0,0,0,0.07);
    --shadow:      0 2px 10px rgba(0,0,0,0.10);
    --font:        'Nunito Sans', sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--body-bg);
    color: var(--text-main);
    font-size: 14px;
}

a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--teal-dark); }

/* ===== Topbar (gradiente azul ISG) ===== */
#topbar {
    height: var(--topbar-h);
    background: linear-gradient(90deg, #0a3880 0%, #0d47a1 50%, #1565c0 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 1px 6px rgba(0,0,0,0.2);
}
#topbar .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: #fff;
}
#topbar .brand img { width: 32px; height: auto; border-radius: 6px; }
#topbar .brand-text { font-size: 15px; font-weight: 800; line-height: 1.1; }
#topbar .brand-sub { font-size: 11px; opacity: .85; }
.topbar-right { display: flex; align-items: center; gap: 6px; }
.topbar-btn {
    color: rgba(255,255,255,.9);
    text-decoration: none;
    padding: 6px 10px;
    border-radius: var(--radius);
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.topbar-btn:hover { background: rgba(255,255,255,.15); color: #fff; }

/* ===== Sidebar (branca, 210px) ===== */
#sidebar {
    position: fixed;
    top: var(--topbar-h);
    bottom: 0;
    left: 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    padding: 14px 10px;
    overflow-y: auto;
}
.sb-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    font-weight: 700;
    padding: 8px 10px 6px;
}
.sb-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    margin-bottom: 2px;
    border-radius: var(--radius);
    color: var(--text-main);
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
}
.sb-link i { width: 18px; text-align: center; color: var(--text-sub); }
.sb-link:hover { background: var(--teal-light); color: var(--teal-dark); }
.sb-link.active { background: var(--teal); color: #fff; }
.sb-link.active i { color: #fff; }
.sb-divider { border-top: 1px solid var(--border); margin: 10px 0; }
.sb-badge { margin-left: auto; font-size: 10px; padding: 2px 7px; border-radius: 10px; background: var(--teal-light); color: var(--teal-dark); font-weight: 700; }
.sb-badge.beta { background: var(--warning); color: #fff; }

/* ===== Main content ===== */
#main-content {
    margin-left: var(--sidebar-w);
    margin-top: var(--topbar-h);
    padding: 20px 24px;
    min-height: calc(100vh - var(--topbar-h));
}
#main-content.no-sidebar { margin-left: 0; }

/* ===== Breadcrumb ===== */
.xd-breadcrumb { font-size: 13px; margin-bottom: 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.xd-breadcrumb a { color: var(--teal); }
.xd-breadcrumb .sep { color: var(--text-muted); }
.xd-breadcrumb .current { color: var(--text-sub); font-weight: 600; }

/* ===== Cabeçalho de página ===== */
.page-header { margin-bottom: 18px; }
.page-title { font-size: 20px; font-weight: 800; color: var(--text-main); }
.page-title i { color: var(--teal); margin-right: 8px; }
.page-subtitle { font-size: 13px; color: var(--text-sub); margin-top: 2px; }

/* ===== Card branco ===== */
.xd-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
}
.xd-card-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.xd-card-header i { color: var(--teal); }
.xd-card-body { padding: 16px; }

/* ===== Formulários ===== */
.f-label {
    display: block;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-sub);
    margin-bottom: 5px;
}
.xd-input, select.xd-input, textarea.xd-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-dark);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 14px;
    color: var(--text-main);
    background: #fff;
}
.xd-input:focus {
    outline: none;
    border-color: var(--teal);
    background: var(--teal-light);
    box-shadow: 0 0 0 3px rgba(21,101,192,.12);
}
.date-pair { display: flex; align-items: center; gap: 6px; }

/* ===== Botões ===== */
.btn-teal {
    background: var(--teal);
    color: #fff;
    border: 1px solid var(--teal);
    border-radius: var(--radius);
    padding: 8px 14px;
    font-family: var(--font);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}
.btn-teal:hover { background: var(--teal-dark); border-color: var(--teal-dark); color: #fff; }
.btn-outline {
    background: transparent;
    color: var(--teal);
    border: 1px solid var(--teal);
    border-radius: var(--radius);
    padding: 8px 14px;
    font-family: var(--font);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}
.btn-outline:hover { background: var(--teal-light); color: var(--teal-dark); }
.btn-shortcut {
    background: var(--teal-light);
    color: var(--teal-dark);
    border: 1px solid var(--teal-mid);
    border-radius: var(--radius);
    padding: 7px 12px;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.btn-shortcut:hover { background: var(--teal-mid); }

/* ===== Tabelas ===== */
.table-wrapper { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.table-scroll { overflow-x: auto; }
.isg-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.isg-table thead th {
    background: #f8fafc;
    border-bottom: 2px solid var(--border);
    color: var(--text-sub);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 10px 14px;
    text-align: left;
    white-space: nowrap;
}
.isg-table tbody td { padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text-main); }
.isg-table tbody tr:hover { background: var(--teal-light); }
.isg-table .text-center { text-align: center; }
.isg-table .text-end { text-align: right; }
.actions-cell { display: flex; gap: 6px; justify-content: flex-end; }
.action-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: var(--radius);
    color: #fff; text-decoration: none; font-size: 13px;
}
.action-btn.pdf { background: var(--danger); }
.action-btn.search { background: var(--teal); }
.action-btn.xml { background: var(--warning); }
.action-btn.manifest { background: var(--green); }

/* ===== Botões de ação padrão ISG (tabelas admin) ===== */
.btn-sm-teal {
    background: var(--teal); color: #fff; border: none; border-radius: var(--radius);
    padding: 5px 10px; font-size: 12.5px; font-weight: 700; cursor: pointer;
    font-family: var(--font); text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.btn-sm-teal:hover { background: var(--teal-dark); color: #fff; }
.btn-sm-danger {
    background: var(--danger); color: #fff; border: none; border-radius: var(--radius);
    padding: 5px 10px; font-size: 12.5px; font-weight: 700; cursor: pointer;
    font-family: var(--font); text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.btn-sm-danger:hover { background: #d32f2f; color: #fff; }
.btn-sm-outline {
    background: transparent; color: var(--teal); border: 1px solid var(--teal); border-radius: var(--radius);
    padding: 5px 10px; font-size: 12.5px; font-weight: 700; cursor: pointer;
    font-family: var(--font); text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.btn-sm-outline:hover { background: var(--teal-light); }

/* ===== Badges ===== */
.isg-badge {
    display: inline-block; padding: 3px 9px; border-radius: 10px;
    font-size: 11px; font-weight: 700;
}
.isg-badge.success { background: #e8f5e9; color: #2e7d32; }
.isg-badge.danger { background: #ffebee; color: #c62828; }
.isg-badge.info { background: var(--teal-light); color: var(--teal-dark); }
.isg-badge.muted { background: #eceff1; color: var(--text-sub); }
.isg-badge.warning { background: #fff8e1; color: #f57f17; }

/* ===== Login (gradiente ISG) ===== */
.logon-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #0a3880 0%, #0d47a1 40%, #1565c0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.logon-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,.35);
    padding: 34px 32px 28px;
    width: 100%;
    max-width: 380px;
}
.logon-logo { text-align: center; margin-bottom: 22px; }
.logon-logo img { width: 72px; height: auto; margin: 0 auto 14px; display: block; }
.logon-logo h1 { font-size: 22px; font-weight: 800; margin: 0; color: var(--text-main); }
.logon-logo p { font-size: 13px; color: var(--text-sub); margin: 4px 0 0; }
.logon-form .fld { margin-bottom: 16px; }
.logon-form .fld label { display: block; font-size: 12.5px; font-weight: 700; color: var(--text-sub); margin-bottom: 5px; }
.logon-form .fld input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-dark);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 14px;
}
.logon-form .fld input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(21,101,192,.12); }
.btn-logon {
    width: 100%;
    background: var(--teal);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 11px;
    font-family: var(--font);
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-logon:hover { background: var(--teal-dark); }
.logon-powered { text-align: center; margin-top: 18px; font-size: 12px; color: var(--text-muted); }
.logon-powered strong { color: var(--teal); }

/* ===== Alerts ===== */
.isg-alert { padding: 11px 14px; border-radius: var(--radius); font-size: 13.5px; margin-bottom: 14px; border-left: 4px solid; }
.isg-alert.success { background: #e8f5e9; border-color: var(--green); color: #2e7d32; }
.isg-alert.danger { background: #ffebee; border-color: var(--danger); color: #c62828; }
.isg-alert.info { background: var(--teal-light); border-color: var(--teal); color: var(--teal-dark); }
.isg-alert.warning { background: #fff8e1; border-color: var(--warning); color: #f57f17; }

/* ===== Cards de estatística ===== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px; }
.stat-card .stat-value { font-size: 26px; font-weight: 800; color: var(--teal); }
.stat-card .stat-label { font-size: 12px; color: var(--text-sub); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-top: 4px; }

/* ===== Quick links / list group ISG ===== */
.quick-list { list-style: none; margin: 0; padding: 0; }
.quick-list li { border-bottom: 1px solid var(--border); }
.quick-list li:last-child { border-bottom: none; }
.quick-list a { display: flex; align-items: center; gap: 10px; padding: 11px 6px; color: var(--text-main); font-weight: 600; font-size: 13.5px; }
.quick-list a:hover { color: var(--teal-dark); background: var(--teal-light); border-radius: var(--radius); }
.quick-list a i { color: var(--teal); width: 18px; text-align: center; }

/* ===== Paginação ===== */
.pagination-bar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; font-size: 13px; color: var(--text-sub); }
.pagination-controls { display: flex; gap: 6px; }
.pag-btn {
    background: #fff; border: 1px solid var(--border-dark); border-radius: var(--radius);
    padding: 5px 10px; cursor: pointer; font-family: var(--font); font-size: 13px; color: var(--text-main);
}
.pag-btn:hover:not(:disabled) { background: var(--teal-light); border-color: var(--teal); }
.pag-btn.active { background: var(--teal); color: #fff; border-color: var(--teal); }
.pag-btn:disabled { opacity: .5; cursor: default; }

/* ===== Overlay de loading ===== */
#query-overlay {
    display: none; position: fixed; inset: 0; background: rgba(255,255,255,.85); z-index: 9999;
    flex-direction: column; align-items: center; justify-content: center; gap: 16px; backdrop-filter: blur(3px);
}
#query-overlay .ov-spinner { width: 44px; height: 44px; border: 4px solid var(--border); border-top-color: var(--teal); border-radius: 50%; animation: spin .8s linear infinite; }
#query-overlay .ov-msg { font-size: 14px; font-weight: 600; color: var(--text-sub); }
#query-overlay .ov-sub { font-size: 12px; color: var(--text-muted); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Overrides Bootstrap → azul ISG ===== */
.bg-primary { background-color: var(--teal) !important; }
.btn-primary { background-color: var(--teal) !important; border-color: var(--teal) !important; }
.btn-primary:hover, .btn-primary:focus { background-color: var(--teal-dark) !important; border-color: var(--teal-dark) !important; }
.btn-outline-primary { color: var(--teal) !important; border-color: var(--teal) !important; }
.btn-outline-primary:hover { background-color: var(--teal) !important; color: #fff !important; }
.text-primary { color: var(--teal) !important; }
.card { border-color: var(--border) !important; box-shadow: var(--shadow-sm) !important; }
.table { color: var(--text-main) !important; }

/* ===== Layout responsivo ===== */
@media (max-width: 768px) {
    #sidebar { display: none; }
    #main-content { margin-left: 0; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
}
