/* ============================================
   PAINEL ADMINISTRATIVO - ESTILOS
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-dark: #1a1a1a;
    --bg-darker: #0f0f0f;
    --bg-card: #252525;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --border-color: #333333;
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --inactive-color: #6b7280;
    --sidebar-width: 205px;
    --header-height: 72px;
    --container-padding: 30px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ============================================
   LAYOUT PRINCIPAL
   ============================================ */

.container-main {
    display: flex;
    height: 100vh;
    overflow: hidden;
    width: 100%;
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-darker);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: transform 0.3s ease, width 0.25s ease, border-right-color 0.25s ease;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-admin {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
}

.sidebar-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.sidebar-nav {
    flex: 1;
    padding: 8px 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-section {
    margin-bottom: 8px;
}

.nav-section h3 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 0 16px;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-section ul {
    list-style: none;
}

.nav-section ul li + li {
    margin-top: 1px;
}

.nav-link {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 6px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.nav-alert-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    margin-left: 2px;
    flex-shrink: 0;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}

.nav-alert-badge.is-blinking {
    animation: navBadgeBlink 1s ease-in-out infinite;
}

@keyframes navBadgeBlink {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.45;
        transform: scale(1.08);
    }
}

@media (prefers-reduced-motion: reduce) {
    .nav-alert-badge.is-blinking {
        animation: none;
    }
}

.nav-link:hover {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border-left-color: var(--primary-color);
}

.nav-link.active {
    background-color: var(--bg-card);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    font-weight: 600;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.btn-logout {
    width: 100%;
    padding: 10px;
    background-color: var(--danger-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.btn-logout:hover {
    background-color: #dc2626;
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    transition: width 0.25s ease;
}

.header {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 15px 30px;
    min-height: var(--header-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-left h1 {
    font-size: clamp(18px, 2vw, 28px);
    font-weight: 600;
}

.btn-menu {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
}

.btn-sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: #1a1a1a;
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-sidebar-toggle:hover {
    color: var(--text-primary);
    border-color: #4b5563;
    background-color: #222;
}

.container-main.sidebar-collapsed .sidebar {
    width: 0;
    min-width: 0;
    border-right-color: transparent;
    overflow: hidden;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    transition: color 0.3s ease;
}

.btn-icon:hover {
    color: var(--text-primary);
}

#auto-refresh-btn {
    transition: all 0.3s ease;
    opacity: 0.7;
}

#auto-refresh-btn:hover {
    opacity: 1;
}

#auto-refresh-btn.active {
    color: var(--success-color);
    opacity: 1;
}

.user-info {
    color: var(--text-secondary);
    font-size: 14px;
}

/* ============================================
   PAGES CONTAINER
   ============================================ */

.pages-container {
    flex: 1;
    overflow-y: auto;
    padding: var(--container-padding);
    min-width: 0;
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ============================================
   PAGE HEADER
   ============================================ */

.page-header {
    margin-bottom: 30px;
}

.toolbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.search-input,
.filter-select {
    padding: 10px 15px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
}

.search-input {
    flex: 1;
    min-width: 250px;
}

.search-input::placeholder {
    color: var(--text-secondary);
}

.notif-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}

.notif-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: #1a1a1a;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
}

#page-notificacoes .page-header .toolbar {
    margin-top: 6px;
}

.notif-tab:hover {
    color: var(--text-primary);
    border-color: #4b5563;
}

.notif-tab.is-active {
    background: rgba(250, 204, 21, 0.16);
    border-color: #facc15;
    color: #fde68a;
}

.notif-tab-count {
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    background: #374151;
    color: #fff;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
}

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

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

.btn-secondary {
    background-color: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: #333333;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: #059669;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-back {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
}

.btn-back:hover {
    color: var(--primary-hover);
}

/* ============================================
   STATISTICS CARDS
   ============================================ */

.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
    color: var(--text-primary);
}

.stat-active .stat-value {
    color: var(--success-color);
}

.stat-inactive .stat-value {
    color: var(--inactive-color);
}

.stat-warning .stat-value {
    color: var(--warning-color);
}

/* Ajuste específico da página Instalações para 5 cards lado a lado */
#page-instalacoes .stats-container {
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    gap: 10px;
}

#page-instalacoes .stat-card {
    padding: 14px;
    gap: 6px;
}

#page-instalacoes .stat-label {
    font-size: 13px;
}

#page-instalacoes .stat-value {
    font-size: 28px;
    line-height: 1.1;
}

/* ============================================
   TABLES
   ============================================ */

.table-container {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
}

.data-table thead {
    background-color: #1a1a1a;
    border-bottom: 2px solid var(--border-color);
}

.data-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    user-select: none;
}

.data-table th:hover {
    color: var(--text-primary);
    background-color: #252525;
}

.data-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.data-table tbody tr:hover {
    background-color: #1a1a1a;
}

.candidaturas-acoes {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.candidaturas-col-acoes {
    width: 260px;
    min-width: 260px;
    max-width: 260px;
    text-align: center;
    vertical-align: middle;
}

.candidaturas-acoes .btn-sm {
    margin-right: 0;
    flex-shrink: 0;
}

.candidaturas-acoes .btn-danger {
    width: 84px;
    min-width: 84px;
    text-align: center;
    padding: 5px 0;
}

.cand-status-select {
    width: 148px;
    min-width: 148px;
    flex: 0 0 148px;
    height: 32px;
    padding: 0 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: #1a1a1a;
    color: var(--text-primary);
    font-size: 12px;
}

.cand-status-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.status-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-pendente {
    background-color: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.status-liberado {
    background-color: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.status-ativo {
    background-color: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.status-inativo {
    background-color: rgba(107, 114, 128, 0.2);
    color: #6b7280;
}

.status-online {
    background-color: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.status-offline {
    background-color: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.status-banco {
    background-color: rgba(59, 130, 246, 0.18);
    color: #93c5fd;
}

.status-banco-sem-link {
    background-color: rgba(107, 114, 128, 0.28);
    color: #e5e7eb;
}

.status-link-desativado {
    background-color: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.status-entrega-sem-confirmacao {
    background-color: rgba(250, 204, 21, 0.18);
    color: #fde68a;
}

/* Polimento visual específico da tabela de Instalações */
#page-instalacoes .table-container {
    border-radius: 10px;
}

#page-instalacoes .data-table-instalacoes {
    min-width: 1320px;
    table-layout: fixed;
}

#page-instalacoes .data-table-instalacoes th {
    padding: 11px 10px;
    cursor: default;
}

#page-instalacoes .data-table-instalacoes th:hover {
    color: var(--text-secondary);
    background-color: #1a1a1a;
}

#page-instalacoes .data-table-instalacoes td {
    padding: 10px;
    vertical-align: middle;
}

#page-instalacoes .data-table-instalacoes th:nth-child(1),
#page-instalacoes .data-table-instalacoes td:nth-child(1) { width: 190px; }
#page-instalacoes .data-table-instalacoes th:nth-child(2),
#page-instalacoes .data-table-instalacoes td:nth-child(2) { width: 240px; }
#page-instalacoes .data-table-instalacoes th:nth-child(3),
#page-instalacoes .data-table-instalacoes td:nth-child(3) { width: 110px; }
#page-instalacoes .data-table-instalacoes th:nth-child(4),
#page-instalacoes .data-table-instalacoes td:nth-child(4) { width: 95px; text-align: center; }
#page-instalacoes .data-table-instalacoes th:nth-child(5),
#page-instalacoes .data-table-instalacoes td:nth-child(5) { width: 70px; text-align: center; }
#page-instalacoes .data-table-instalacoes th:nth-child(6),
#page-instalacoes .data-table-instalacoes td:nth-child(6) { width: 110px; text-align: center; }
#page-instalacoes .data-table-instalacoes th:nth-child(7),
#page-instalacoes .data-table-instalacoes td:nth-child(7) { width: 125px; }
#page-instalacoes .data-table-instalacoes th:nth-child(8),
#page-instalacoes .data-table-instalacoes td:nth-child(8) { width: 135px; }
#page-instalacoes .data-table-instalacoes th:nth-child(9),
#page-instalacoes .data-table-instalacoes td:nth-child(9) { width: 78px; text-align: center; }
#page-instalacoes .data-table-instalacoes th:nth-child(10),
#page-instalacoes .data-table-instalacoes td:nth-child(10) { width: 75px; text-align: center; }
#page-instalacoes .data-table-instalacoes th:nth-child(11),
#page-instalacoes .data-table-instalacoes td:nth-child(11) { width: 122px; text-align: center; }

#page-instalacoes .data-table-instalacoes td:nth-child(1),
#page-instalacoes .data-table-instalacoes td:nth-child(2),
#page-instalacoes .data-table-instalacoes td:nth-child(3),
#page-instalacoes .data-table-instalacoes td:nth-child(7),
#page-instalacoes .data-table-instalacoes td:nth-child(8) {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#page-instalacoes .data-table-instalacoes .status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 64px;
    padding: 4px 9px;
    font-size: 11px;
    line-height: 1.2;
}

#page-instalacoes .data-table-instalacoes td:last-child {
    white-space: nowrap;
}

#page-instalacoes .data-table-instalacoes td:last-child .btn {
    width: 54px;
    min-width: 54px;
    padding: 4px 6px;
    font-size: 11px;
    margin-right: 4px;
}

#page-instalacoes .data-table-instalacoes td:last-child .btn:last-child {
    margin-right: 0;
}

/* ============================================
   DETAIL PAGE
   ============================================ */

.back-button {
    margin-bottom: 20px;
}

.detail-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
    min-width: 0;
}

.detail-left {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 25px;
    min-width: 0;
}

.detail-right {
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 0;
}

.info-group {
    margin-bottom: 20px;
}

.info-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
}

.info-group input,
.info-group select {
    width: 100%;
    padding: 10px 15px;
    background-color: #1a1a1a;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
}

.info-group input:focus,
.info-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.input-readonly {
    background-color: #0f0f0f;
    cursor: not-allowed;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    margin-top: 30px;
    margin-bottom: 15px;
    color: var(--text-primary);
}

.toggle-group {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #6b7280;
    transition: 0.4s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--primary-color);
}

input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

.document-section {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.document-status {
    font-size: 32px;
}

.document-actions {
    display: flex;
    gap: 10px;
}

.document-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.document-item {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
}

.document-item-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 200px;
}

.document-item-actions {
    display: flex;
    gap: 8px;
}

.document-status-badge {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 4px 8px;
    border-radius: 999px;
    background-color: #2d2f3a;
    color: var(--text-secondary);
}

.document-status-badge.aprovado {
    background-color: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.document-status-badge.rejeitado {
    background-color: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.document-status-badge.pendente {
    background-color: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.info-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.card-label {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.card-value {
    color: var(--primary-color);
    font-size: 18px;
    font-weight: 600;
}

.history-section {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 25px;
    overflow-x: auto;
}

.history-section h3 {
    margin-bottom: 20px;
    font-size: 18px;
}

.history-action-updated {
    color: #86efac;
    font-weight: 700;
}

/* ============================================
   MODAL
   ============================================ */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 30px;
    width: min(92vw, 700px);
    max-width: 500px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h2 {
    margin-bottom: 20px;
    font-size: 20px;
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: var(--text-primary);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
}

.form-group input {
    width: 100%;
    padding: 10px 15px;
    background-color: #1a1a1a;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.form-group textarea {
    width: 100%;
    padding: 10px 15px;
    background-color: #1a1a1a;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}

.modal-notificacao {
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

/* ============================================
   RESPONSIVIDADE
   ============================================ */

/* Tablet grande / notebook pequeno */
@media (max-width: 1199px) {
    :root {
        --container-padding: 20px;
    }

    .btn-menu {
        display: block;
    }

    .btn-sidebar-toggle {
        display: none;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: min(82vw, 320px);
        transform: translateX(-100%);
        transition: transform 0.28s ease;
        z-index: 1100;
        border-right: 1px solid var(--border-color);
        box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .header {
        padding: 12px 20px;
    }

    .header-right {
        gap: 12px;
    }

    .user-info {
        max-width: 280px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .stats-container {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .detail-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .detail-left,
    .history-section {
        padding: 20px;
    }
}

/* Celular e tablet */
@media (max-width: 768px) {
    .container-main {
        flex-direction: column;
    }

    .sidebar {
        width: min(90vw, 320px);
        top: 0;
        border-right: none;
        border-right: 1px solid var(--border-color);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        width: 100%;
    }

    .btn-menu {
        display: block;
    }

    .btn-sidebar-toggle {
        display: none;
    }

    .header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
        position: sticky;
        top: 0;
        z-index: 100;
    }

    .header-right {
        width: 100%;
        justify-content: space-between;
        gap: 8px;
    }

    .user-info {
        display: none;
    }

    .detail-container {
        grid-template-columns: 1fr;
    }

    .stats-container {
        grid-template-columns: repeat(2, 1fr);
    }

    .toolbar,
    .filters {
        flex-direction: column;
        align-items: stretch;
    }

    .search-input {
        min-width: 100%;
    }

    .data-table {
        font-size: 12px;
        min-width: 640px;
    }

    .data-table th,
    .data-table td {
        padding: 10px;
    }

    .candidaturas-acoes {
        flex-wrap: wrap;
    }

    .candidaturas-col-acoes {
        width: 220px;
        min-width: 220px;
        max-width: 220px;
    }

    .cand-status-select {
        width: 132px;
        min-width: 132px;
        flex: 0 0 132px;
    }

    .candidaturas-acoes .btn-danger {
        width: 78px;
        min-width: 78px;
    }

    .document-section {
        align-items: flex-start;
        flex-direction: column;
    }

    .document-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .document-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .document-item-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .btn {
        width: 100%;
    }

    .modal-content {
        width: 94vw;
        max-width: 94vw;
        padding: 18px;
    }
}

@media (max-width: 480px) {
    .pages-container {
        padding: 15px;
    }

    .stats-container {
        grid-template-columns: 1fr;
    }

    .detail-left {
        padding: 15px;
    }

    .modal-content {
        width: 95%;
        padding: 20px;
    }

    .sidebar-header {
        padding: 14px;
    }

    .sidebar-nav {
        padding: 4px 0;
        gap: 1px;
    }

    .nav-section {
        margin-bottom: 4px;
    }

    .nav-section h3 {
        padding: 0 12px;
        margin-bottom: 1px;
        font-size: 10px;
    }

    .nav-link {
        padding: 2px 12px;
        font-size: 12px;
        line-height: 1.15;
    }

    .header-left {
        width: 100%;
        justify-content: space-between;
    }

    .header-left h1 {
        font-size: 18px;
    }

    .stat-value {
        font-size: 26px;
    }
}

/* Notebook / desktop padrão */
@media (min-width: 1200px) and (max-width: 1599px) {
    :root {
        --container-padding: 28px;
        --sidebar-width: 215px;
    }

    .data-table th,
    .data-table td {
        padding: 13px;
    }
}

/* TV / telas muito grandes */
@media (min-width: 1600px) {
    :root {
        --container-padding: 40px;
        --sidebar-width: 225px;
        --header-height: 84px;
    }

    body {
        font-size: 18px;
    }

    .header {
        padding: 20px 40px;
    }

    .header-left h1 {
        font-size: 34px;
    }

    .btn {
        font-size: 16px;
        padding: 12px 22px;
    }

    .search-input,
    .filter-select,
    .info-group input,
    .info-group select,
    .form-group input,
    .form-group textarea {
        font-size: 16px;
        padding: 12px 16px;
    }

    .stats-container {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 20px;
    }

    .stat-card,
    .info-card,
    .detail-left,
    .history-section {
        padding: 28px;
    }

    .stat-value {
        font-size: 40px;
    }

    .data-table {
        min-width: 100%;
    }

    .data-table th,
    .data-table td {
        font-size: 16px;
        padding: 16px;
    }

    .modal-content {
        max-width: 760px;
    }
}

/* TVs 4K */
@media (min-width: 2200px) {
    :root {
        --container-padding: 56px;
        --sidebar-width: 250px;
    }

    body {
        font-size: 21px;
    }

    .header-left h1 {
        font-size: 42px;
    }

    .btn {
        font-size: 18px;
    }

    .nav-link {
        font-size: 20px;
        padding: 14px 24px;
    }

    .nav-section h3 {
        font-size: 15px;
    }

    .data-table th,
    .data-table td {
        font-size: 18px;
        padding: 18px;
    }
}

/* ============================================
   LOGIN
   ============================================ */

.login-screen {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-dark);
    padding: 20px;
    z-index: 1000;
}

body.logged-out #login-screen {
    display: flex;
}

body.logged-out #app-container {
    display: none;
}

.role-installer .admin-only {
    display: none !important;
}

.role-installer .admin-or-operator {
    display: none !important;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
}

.login-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    text-align: center;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.login-form .form-group {
    margin-bottom: 16px;
}

.login-error {
    min-height: 18px;
    color: var(--danger-color);
    font-size: 13px;
    margin-bottom: 12px;
}

.btn-login {
    width: 100%;
    padding: 12px;
    font-size: 15px;
}

.login-hint {
    margin-top: 12px;
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
}

/* ============================================
   TOAST
   ============================================ */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1200;
}

.toast {
    background-color: rgba(37, 99, 235, 0.95);
    color: #fff;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.25);
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    font-size: 14px;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

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

#auto-refresh-btn.spinning {
    animation: spin 0.9s linear 1;
}

/* ============================================
   SESSION WARNING
   ============================================ */

.session-warning {
    position: fixed;
    inset: 0;
    background-color: transparent;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1400;
    padding: 20px;
}

.session-warning.show {
    display: flex;
}

.session-warning-card {
    background-color: #7f1d1d;
    border: 2px solid #fecaca;
    border-radius: 12px;
    padding: 24px;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.55);
}

.session-warning-card h3 {
    color: #fee2e2;
    margin-bottom: 8px;
}

.session-warning-card p {
    color: #fee2e2;
    margin-bottom: 16px;
}
