/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    color: #333;
    background-color: #f5f6fa;
}

/* Login Page */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0a1628 0%, #112240 40%, #1a3a6b 100%);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.login-card-img {
    display: block;
    margin: 0 auto 16px;
    max-width: 180px;
}

.login-title {
    text-align: center;
    font-size: 2rem;
    color: #1e3c72;
    margin-bottom: 4px;
}

.login-subtitle {
    text-align: center;
    color: #888;
    margin-bottom: 30px;
    font-size: 1.2rem;
    font-weight: bold;
}

.login-card form {
    text-align: left;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.9rem;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #2a5298;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: #2a5298;
    color: #fff;
}

.btn-primary:hover {
    background: #1e3c72;
}

.btn-block {
    width: 100%;
}

.btn-logout {
    background: transparent;
    color: #e74c3c;
    border: 1px solid #e74c3c;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-logout:hover {
    background: #e74c3c;
    color: #fff;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.alert-error {
    background: #fde8e8;
    color: #c0392b;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background: #e8f5e9;
    color: #27ae60;
    border: 1px solid #c8e6c9;
}

/* Dashboard Layout */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: #1e3c72;
    color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
}

.sidebar-header {
    padding: 24px 20px;
    background-color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
}

.sidebar-nav {
    padding: 16px 0;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.nav-icon {
    margin-right: 12px;
    font-size: 0.8rem;
}

/* Nav Sections - Collapsible */
.nav-section {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-arrow {
    margin-left: auto;
    font-size: 0.6rem;
}

.nav-filters .sidebar-filtros {
    border-top: none;
    margin-top: 0;
    padding-top: 8px;
}

/* Date Input (PorPeriodo) */
.filtro-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
}

.filtro-input::-webkit-calendar-picker-indicator {
    filter: invert(1);
}

/* PorPeriodo Table */
.comp-row-clickable {
    cursor: pointer;
    transition: background-color 0.15s;
}

.comp-row-clickable:hover {
    background-color: #e8f0fe !important;
}

.comp-row-selected {
    background-color: #d6e4f7 !important;
}

#compDetalheCard .chart-body-donut {
    height: 320px;
}

.detalhe-dia-titulo {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e3c72;
    margin: 24px 0 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #2a5298;
}

#compDetalheCard .table-card.chart-half {
    margin-bottom: 0;
}

#compDetalheCard .charts-row {
    margin-bottom: 24px;
}

#compDetalheCard .table-card {
    margin-bottom: 24px;
}

/* Sidebar Filters */
.sidebar-filtros {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 8px;
}

.filtros-titulo {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 16px;
}

.filtro-group {
    margin-bottom: 12px;
}

.filtro-label {
    display: block;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 4px;
    font-weight: 600;
}

.filtro-select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    appearance: auto;
}

.filtro-select:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.filtro-select option {
    background: #1e3c72;
    color: #fff;
}

.btn-filtrar {
    width: 100%;
    padding: 9px;
    border: none;
    border-radius: 6px;
    background: #fff;
    color: #1e3c72;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 4px;
    transition: background 0.2s;
}

.btn-filtrar:hover {
    background: #e0e0e0;
}

.btn-hoje {
    width: 100%;
    padding: 9px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.2s;
}

.btn-hoje:hover {
    background: rgba(255, 255, 255, 0.1);
}

.filtro-ativo {
    margin-top: 12px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    font-size: 0.8rem;
    color: #fff;
    text-align: center;
    font-weight: 600;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 250px;
}

/* Top Header */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 32px;
    background: #fff;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.top-header h1 {
    font-size: 1.4rem;
    color: #333;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #555;
}

.user-role {
    background: #e8f0fe;
    color: #2a5298;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Content Area */
.content {
    padding: 32px;
}

/* Cards */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    font-weight: 700;
    font-size: 1rem;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
}

.card-body {
    padding: 20px;
    font-size: 0.95rem;
    color: #555;
    line-height: 1.6;
}

.status-online {
    color: #27ae60;
    font-weight: 700;
    font-size: 1.1rem;
}

/* Loading Modal */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-modal {
    background: #fff;
    border-radius: 16px;
    padding: 48px 56px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e0e0e0;
    border-top: 4px solid #2a5298;
    border-radius: 50%;
    margin: 0 auto 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    font-size: 1.2rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
}

.loading-subtext {
    font-size: 0.9rem;
    color: #888;
}

/* ===== Dashboard Widgets ===== */

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.summary-card {
    border-radius: 10px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    color: #fff;
}

.summary-card.card-blue   { background: #2a5298; }
.summary-card.card-green  { background: #27ae60; }
.summary-card.card-orange { background: #f39c12; }
.summary-card.card-purple { background: #8e44ad; }

.summary-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 4px;
    border-color: #0a1628;
}

.summary-label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.summary-sub {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.65);
}

/* Charts */
.charts-row {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
}

.chart-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.chart-large {
    flex: 2;
}

.chart-small {
    flex: 1;
}

.chart-half {
    flex: 1;
}

.chart-body {
    padding: 20px;
    height: 300px;
    position: relative;
}

.chart-body-donut {
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#map {
    height: 100%;
    min-height: 260px;
    border-radius: 0 0 10px 10px;
}

/* Tables */
.table-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin-bottom: 24px;
}

.table-body {
    overflow-x: auto;
}

.dashboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.dashboard-table thead th {
    background: #f8f9fa;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #e0e0e0;
    white-space: nowrap;
}

.dashboard-table tbody td {
    padding: 10px 16px;
    border-bottom: 1px solid #f0f0f0;
    color: #444;
}

.dashboard-table tbody tr:hover {
    background: #f8f9fc;
}

.dashboard-table tbody tr:last-child td {
    border-bottom: none;
}

.txid-cell {
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: #888;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.table-loading,
.table-empty {
    text-align: center;
    padding: 24px !important;
    color: #aaa;
    font-style: italic;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-blue {
    background: #e8f0fe;
    color: #2a5298;
}

.badge-orange {
    background: #fef3e2;
    color: #e67e22;
}

.badge-green {
    background: #e8f5e9;
    color: #27ae60;
}

/* Change Password Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-card {
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    width: 100%;
    max-width: 420px;
    text-align: left;
}

.modal-title {
    text-align: center;
    font-size: 1.4rem;
    color: #1e3c72;
    margin-bottom: 8px;
}

.modal-text {
    text-align: center;
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 24px;
    line-height: 1.5;
}

/* Menu Toggle Button (hidden on desktop) */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    margin-right: 12px;
}

.menu-toggle span {
    display: block;
    width: 22px;
    height: 2.5px;
    background: #333;
    border-radius: 2px;
    transition: all 0.3s;
}

/* Sidebar Close Button (hidden on desktop) */
.sidebar-close {
    display: none;
    position: absolute;
    top: 18px;
    right: 16px;
    background: none;
    border: none;
    color: #1e3c72;
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
}

/* Sidebar Overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 49;
}

.sidebar-overlay.active {
    display: block;
}

/* Responsive */
@media (max-width: 1200px) {
    .summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    .charts-row {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 50;
    }

    .sidebar.sidebar-open {
        transform: translateX(0);
    }

    .sidebar-close {
        display: block;
    }

    .sidebar-header {
        position: relative;
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: flex;
    }

    .header-left {
        display: flex;
        align-items: center;
    }

    .top-header {
        padding: 12px 16px;
    }

    .top-header h1 {
        font-size: 1.1rem;
    }

    .content {
        padding: 16px;
    }

    .summary-cards {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .summary-card {
        padding: 16px;
    }

    .summary-value {
        font-size: 1.3rem;
    }

    .chart-body {
        height: 250px;
    }
}
