
:root {
    /* Light Mode */
    --table-bg: #ffffff;
    --table-text: #1e293b;
    --table-border: #e2e8f0;
    --table-header-start: #206bc4;
    --table-header-end: #3b82f6;
    --table-header-text: #ffffff;
    --table-hover-bg: #e0edfa;
    --table-row-alt-bg: #f4f8fd;
    --table-shadow: 0 4px 24px rgba(32, 107, 196, 0.10);
    --table-overlay-color: %23718096;
    --table-overlay-opacity: 0.02;
}

/* Dark Mode */
[data-bs-theme="dark"],
html.dark,
body.dark-mode {
    --table-bg: #1e293b;
    --table-text: #e2e8f0;
    --table-border: #334155;
    --table-header-start: #1e40af;
    --table-header-end: #2563eb;
    --table-header-text: #ffffff;
    --table-hover-bg: #334155;
    --table-row-alt-bg: #0f172a;
    --table-shadow: 0 4px 24px rgba(15, 23, 42, 0.25);
    --table-overlay-color: %23ffffff;
    --table-overlay-opacity: 0.03;
}

.disabled-link {
    pointer-events: none;
    opacity: 0.6;
    cursor: not-allowed;
}

.page-body {
    min-height: 100vh;
    position: relative;
}

/* Overlay com padrão sutil */
.page-body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('data:image/svg+xml,<svg width="20" height="20" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><g fill="%23718096" fill-opacity="0.02"><circle cx="3" cy="3" r="3"/></g></svg>');
    pointer-events: none;
    z-index: 0;
}

/* Garante que o conteúdo fique acima do overlay */
.page-body > .container-xl {
    position: relative;
    z-index: 1;
}

.historico-table {
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: var(--table-shadow);
    background: var(--table-bg);
    border-collapse: separate !important;
    border-spacing: 0 !important;
    transition: all 0.3s ease;
}

.historico-table th, .historico-table td {
    border: none !important;
    vertical-align: middle !important;
}

.historico-table thead {
    position: relative;
}

.historico-table thead::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, var(--table-header-start) 80%, var(--table-header-end) 100%);
    z-index: 1;
}

.historico-table thead th {
    position: relative;
    z-index: 2;
    background: transparent !important;
    border: 0 !important;
    border-width: 0 !important;
    border-style: none !important;
    border-color: transparent !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.9rem;
    padding: 1rem 0.85rem;
    color: var(--table-header-text) !important;
}

.historico-table thead th,
.historico-table thead th:first-child,
.historico-table thead th:last-child,
.historico-table thead th + th {
    border: 0 !important;
    border-left: 0 !important;
    border-right: 0 !important;
    border-top: 0 !important;
    border-bottom: 0 !important;
    outline: none !important;
}

/* Remove bordas do tr do cabeçalho */
.historico-table thead tr {
    border: 0 !important;
    background: transparent !important;
}

.historico-table tbody td {
    background: transparent;
    font-size: 0.95rem;
    padding: 0.85rem;
    color: var(--table-text);
    border: none !important;
    border-bottom: 1px solid var(--table-border) !important;
    transition: all 0.2s ease;
}

.historico-table tbody tr {
    border-bottom: 1px solid var(--table-border) !important;
}

.historico-table tbody tr:last-child {
    border-bottom: none !important;
}

.historico-table tbody tr:last-child td {
    border-bottom: none !important;
}

.historico-table tbody tr.bg-light td {
    background: var(--table-row-alt-bg);
}

.historico-table tbody tr:hover td {
    background: var(--table-hover-bg) !important;
    transition: background 0.2s ease;
}

.historico-table .fw-medium {
    font-weight: 500 !important;
}

.historico-table .badge {
    font-size: 0.85rem;
    padding: 0.5em 1em;
    border-radius: 0.7em;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: all 0.2s ease;
    display: inline-block;
}

.historico-table .badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Badges - Light Mode */
.historico-table .bg-yellow {
    background: linear-gradient(90deg, #fef9c3 60%, #fef08a 100%) !important;
    color: #854d0e !important;
}

.historico-table .bg-emerald {
    background: linear-gradient(90deg, #d1fae5 60%, #a7f3d0 100%) !important;
    color: #047857 !important;
}

.historico-table .bg-azure {
    background: linear-gradient(90deg, #dbeafe 60%, #bfdbfe 100%) !important;
    color: #1d4ed8 !important;
}

.historico-table .bg-purple {
    background: linear-gradient(90deg, #f3e8ff 60%, #e9d5ff 100%) !important;
    color: #7e22ce !important;
}

.historico-table .bg-info {
    background: linear-gradient(90deg, #e0f2fe 60%, #bae6fd 100%) !important;
    color: #0369a1 !important;
}

.historico-table .bg-secondary {
    background: linear-gradient(90deg, #f1f5f9 60%, #e2e8f0 100%) !important;
    color: #475569 !important;
}

/* Dark Mode Badges */
[data-bs-theme="dark"] .historico-table .bg-yellow,
html.dark .historico-table .bg-yellow,
body.dark-mode .historico-table .bg-yellow {
    background: linear-gradient(90deg, #713f12 60%, #854d0e 100%) !important;
    color: #fef9c3 !important;
}

[data-bs-theme="dark"] .historico-table .bg-emerald,
html.dark .historico-table .bg-emerald,
body.dark-mode .historico-table .bg-emerald {
    background: linear-gradient(90deg, #064e3b 60%, #047857 100%) !important;
    color: #d1fae5 !important;
}

[data-bs-theme="dark"] .historico-table .bg-azure,
html.dark .historico-table .bg-azure,
body.dark-mode .historico-table .bg-azure {
    background: linear-gradient(90deg, #0c2d6b 60%, #1d4ed8 100%) !important;
    color: #dbeafe !important;
}

[data-bs-theme="dark"] .historico-table .bg-purple,
html.dark .historico-table .bg-purple,
body.dark-mode .historico-table .bg-purple {
    background: linear-gradient(90deg, #4c1d95 60%, #7e22ce 100%) !important;
    color: #f3e8ff !important;
}

[data-bs-theme="dark"] .historico-table .bg-info,
html.dark .historico-table .bg-info,
body.dark-mode .historico-table .bg-info {
    background: linear-gradient(90deg, #0c4a6e 60%, #0369a1 100%) !important;
    color: #e0f2fe !important;
}

[data-bs-theme="dark"] .historico-table .bg-secondary,
html.dark .historico-table .bg-secondary,
body.dark-mode .historico-table .bg-secondary {
    background: linear-gradient(90deg, #1e293b 60%, #334155 100%) !important;
    color: #cbd5e1 !important;
}

.historico-table .avatar {
    width: 2rem;
    height: 2rem;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.historico-table .avatar:hover {
    transform: scale(1.08);
}

.historico-table .btn-icon {
    width: 2rem;
    height: 2rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

.historico-table .btn-icon:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.historico-table .btn-icon:active {
    transform: translateY(0);
}

.historico-table .btn-emerald {
    background: #059669;
    border-color: #059669;
    color: #fff;
}

.historico-table .btn-emerald:hover {
    background: #047857;
    border-color: #047857;
}

/* Dark Mode Button */
[data-bs-theme="dark"] .historico-table .btn-emerald,
html.dark .historico-table .btn-emerald,
body.dark-mode .historico-table .btn-emerald {
    background: #10b981;
    border-color: #10b981;
}

[data-bs-theme="dark"] .historico-table .btn-emerald:hover,
html.dark .historico-table .btn-emerald:hover,
body.dark-mode .historico-table .btn-emerald:hover {
    background: #059669;
    border-color: #059669;
}

/* Responsividade */
@media (max-width: 903px) {
    .historico-table thead th {
        font-size: 0.8rem;
        padding: 0.75rem 0.5rem;
    }

    .historico-table tbody td {
        font-size: 0.9rem;
        padding: 0.75rem 0.5rem;
    }

    .historico-table .badge {
        font-size: 0.75rem;
        padding: 0.4em 0.8em;
    }

    .historico-table .avatar {
        width: 1.75rem;
        height: 1.75rem;
        font-size: 0.8rem;
    }

    .historico-table .btn-icon {
        width: 1.75rem;
        height: 1.75rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 650px) {
    .historico-table {
        border-radius: 0.75rem;
    }

    .historico-table thead th {
        font-size: 0.75rem;
        padding: 0.6rem 0.4rem;
        letter-spacing: 0.02em;
    }

    .historico-table tbody td {
        font-size: 0.85rem;
        padding: 0.6rem 0.4rem;
    }

    .historico-table .badge {
        font-size: 0.7rem;
        padding: 0.35em 0.7em;
        border-radius: 0.6em;
    }

    .historico-table .avatar {
        width: 1.5rem;
        height: 1.5rem;
        font-size: 0.7rem;
    }

    .historico-table .btn-icon {
        width: 1.5rem;
        height: 1.5rem;
        font-size: 0.85rem;
    }
}

/* Touch devices optimization */
@media (hover: none) and (pointer: coarse) {
    .historico-table .btn-icon {
        min-width: 2.5rem;
        min-height: 2.5rem;
    }

    .historico-table tbody tr:active td {
        background: var(--table-hover-bg) !important;
    }
}
