/* ==========================================================
   Estuda2Totvs Custom Stylesheet
   Bootstrap 5.3 based modern clean design
   (Adapted from Folha+ template)
   ========================================================== */

:root {
    --e2t-primary: #21b573;
    --e2t-primary-hover: #1a9c62;
    --e2t-primary-light: #ecfdf5;
    --e2t-sidebar-bg: #1e293b;
    --e2t-sidebar-hover: #334155;
    --e2t-sidebar-active: #21b573;
    --e2t-sidebar-text: #94a3b8;
    --e2t-sidebar-text-active: #ffffff;
    --e2t-sidebar-width: 260px;
    --e2t-header-height: 64px;
    --e2t-body-bg: #f1f5f9;
    --e2t-card-bg: #ffffff;
    --e2t-text-primary: #1e293b;
    --e2t-text-secondary: #64748b;
    --e2t-border-color: #e2e8f0;
    --e2t-success: #10b981;
    --e2t-danger: #ef4444;
    --e2t-warning: #f59e0b;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--e2t-body-bg);
    color: var(--e2t-text-primary);
    overflow-x: hidden;
}

/* ========== Layout ========== */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: var(--e2t-sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
    transition: margin-left 0.3s ease;
}

.content-area {
    flex: 1 1 auto;
    padding: 1.5rem;
    min-height: 0;
}

/* ========== Sidebar ========== */
.sidebar {
    width: var(--e2t-sidebar-width);
    background: var(--e2t-sidebar-bg);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1040;
    overflow-y: auto;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    height: var(--e2t-header-height);
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.sidebar-brand a {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.sidebar-logo {
    height: 38px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
}

.sidebar-brand-text {
    color: #fff;
    font-weight: 700;
    font-size: 1.15rem;
    margin: 0;
    white-space: nowrap;
    transition: opacity 0.2s ease;
}

.sidebar-brand-text span {
    color: #6ee7b7;
}

.sidebar-nav {
    padding: 0.75rem 0;
    list-style: none;
    flex: 1;
    margin: 0;
}

.sidebar-nav .nav-label {
    padding: 0.75rem 1.25rem 0.35rem;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--e2t-sidebar-text);
    margin-top: 0.5rem;
}

.sidebar-nav .nav-item {
    margin: 2px 8px;
    list-style: none;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 0.55rem 1rem;
    color: var(--e2t-sidebar-text);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    gap: 0.75rem;
}

.sidebar-nav .nav-link:hover {
    background: var(--e2t-sidebar-hover);
    color: var(--e2t-sidebar-text-active);
}

.sidebar-nav .nav-link.active {
    background: var(--e2t-sidebar-active);
    color: var(--e2t-sidebar-text-active);
}

.sidebar-nav .nav-link i {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

/* ========== Header ========== */
.top-header {
    height: var(--e2t-header-height);
    background: var(--e2t-card-bg);
    border-bottom: 1px solid var(--e2t-border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1030;
    flex-shrink: 0;
    width: 100%;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--e2t-text-primary);
    cursor: pointer;
    padding: 0.25rem;
}

.filial-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.75rem;
    background: var(--e2t-primary-light);
    color: var(--e2t-primary);
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
}

.user-profile-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--e2t-border-color);
    border-radius: 50px;
    background: transparent;
    cursor: pointer;
    text-decoration: none;
    color: var(--e2t-text-primary);
    transition: all 0.2s;
}

.user-profile-btn:hover {
    background: var(--e2t-body-bg);
    color: var(--e2t-text-primary);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--e2t-primary-light);
    color: var(--e2t-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
}

.user-info {
    text-align: left;
    line-height: 1.3;
}

.user-info .user-name {
    font-size: 0.8rem;
    font-weight: 600;
    margin: 0;
}

.user-info .user-role {
    font-size: 0.7rem;
    color: var(--e2t-text-secondary);
    margin: 0;
}

/* ========== Cards ========== */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
    background: var(--e2t-card-bg);
    overflow: hidden;
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--e2t-border-color);
    font-weight: 600;
    padding: 1rem 1.25rem;
}

/* ========== Tabs ========== */
.card .nav-tabs {
    border-bottom: 2px solid var(--e2t-border-color);
    gap: 0.25rem;
    margin: 0;
}

.card .nav-tabs .nav-link {
    border: none;
    border-radius: 8px 8px 0 0;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--e2t-text-secondary);
    padding: 0.6rem 1.15rem;
    transition: all 0.2s;
    position: relative;
}

.card .nav-tabs .nav-link:hover {
    color: var(--e2t-primary);
    background: var(--e2t-primary-light);
}

.card .nav-tabs .nav-link.active {
    color: var(--e2t-primary);
    background: transparent;
    border: none;
}

.card .nav-tabs .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--e2t-primary);
    border-radius: 2px 2px 0 0;
}

.card .nav-tabs .nav-link i {
    font-size: 0.9rem;
}

.card-header .nav-tabs {
    border-bottom: none;
    margin-bottom: -1rem;
}

/* ========== Tables ========== */
.table {
    font-size: 0.85rem;
    margin-bottom: 0;
}

.table thead th {
    background: #f8fafc;
    color: var(--e2t-text-secondary);
    border: none;
    border-bottom: 2px solid var(--e2t-border-color);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.7rem 1rem;
    white-space: nowrap;
}

.table td {
    padding: 0.65rem 1rem;
    vertical-align: middle;
    border-color: var(--e2t-border-color);
}

.table-hover tbody tr:hover {
    background-color: #f8fafc;
}

/* ========== Buttons ========== */
.btn {
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.45rem 1rem;
    transition: all 0.2s;
}

.btn-sm {
    padding: 0.3rem 0.75rem;
    font-size: 0.8rem;
}

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

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

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

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

.btn-warning {
    background: var(--e2t-warning);
    border-color: var(--e2t-warning);
    color: #1e293b;
}

.btn-outline-primary {
    color: var(--e2t-primary);
    border-color: var(--e2t-primary);
}

.btn-outline-primary:hover {
    background: var(--e2t-primary);
    color: #fff;
}

.btn-outline-light {
    color: var(--e2t-sidebar-text);
    border-color: rgba(255,255,255,0.15);
}

.btn-outline-light:hover {
    background: var(--e2t-sidebar-hover);
    color: #fff;
    border-color: rgba(255,255,255,0.25);
}

/* ========== Forms ========== */
.form-control,
.form-select {
    border-radius: 8px;
    border-color: var(--e2t-border-color);
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
    background-color: #fff;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--e2t-primary);
    box-shadow: 0 0 0 3px rgba(33, 181, 115, 0.1);
    background-color: #fff;
}

.form-label {
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--e2t-text-secondary);
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.form-control-sm,
.form-select-sm {
    font-size: 0.8rem;
    padding: 0.35rem 0.65rem;
}

/* Form section */
.form-section {
    background: #f8fafc;
    border: 1px solid var(--e2t-border-color);
    border-radius: 10px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.form-section-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--e2t-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-section-title i {
    font-size: 0.9rem;
    color: var(--e2t-primary);
}

/* Form actions row */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding-top: 1rem;
    margin-top: 1rem;
    border-top: 1px solid var(--e2t-border-color);
}

/* Filter bar */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
    padding: 0.85rem 1rem;
    background: #f8fafc;
    border: 1px solid var(--e2t-border-color);
    border-radius: 10px;
    margin-bottom: 1rem;
}

.filter-bar .filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    min-width: 180px;
}

.filter-bar .filter-group label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--e2t-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Form divider */
.form-divider {
    border: none;
    border-top: 1px solid var(--e2t-border-color);
    margin: 1.25rem 0;
}

/* ========== Alerts ========== */
.alert {
    border-radius: 10px;
    border: none;
    font-size: 0.875rem;
}

/* ========== Page Header ========== */
.page-header {
    margin-bottom: 1.5rem;
}

.page-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--e2t-text-primary);
    margin: 0;
}

.page-header p {
    color: var(--e2t-text-secondary);
    margin: 0.25rem 0 0;
    font-size: 0.875rem;
}

/* ========== Footer ========== */
.app-footer {
    padding: 1rem 1.5rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--e2t-text-secondary);
    border-top: 1px solid var(--e2t-border-color);
    background: var(--e2t-card-bg);
    flex-shrink: 0;
    width: 100%;
    margin-top: auto;
}

/* ========== Login Page ========== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #21b573 0%, #14b8a6 100%);
    padding: 1rem;
}

.login-card {
    width: 100%;
    max-width: 440px;
    border-radius: 16px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.15);
    padding: 2.5rem;
    background: #fff;
}

.login-card .brand-title {
    text-align: center;
    margin-bottom: 2rem;
}

.login-card .brand-title img {
    max-height: 100px;
    margin-bottom: 1rem;
}

.login-card .brand-title h2 {
    font-weight: 700;
    color: var(--e2t-primary);
    margin-bottom: 0.25rem;
}

.login-card .brand-title p {
    color: var(--e2t-text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

.login-card .form-group {
    margin-bottom: 1.25rem;
}

.login-card .form-group label {
    font-weight: 500;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
    display: block;
}

.login-card .btn-login {
    width: 100%;
    padding: 0.65rem;
    font-weight: 600;
    font-size: 0.95rem;
    background: var(--e2t-primary);
    border-color: var(--e2t-primary);
    border-radius: 8px;
    color: #fff;
}

.login-card .btn-login:hover {
    background: var(--e2t-primary-hover);
    border-color: var(--e2t-primary-hover);
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
}

.login-footer a {
    color: var(--e2t-primary);
    font-size: 0.85rem;
    text-decoration: none;
}

.login-footer a:hover {
    text-decoration: underline;
}

.login-info {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--e2t-border-color);
}

.login-info h6 {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.login-info p {
    font-size: 0.8rem;
    color: var(--e2t-text-secondary);
    margin: 0;
}

/* ========== Prova item list ========== */
.prova-item {
    cursor: pointer;
    border-radius: 0.5rem;
    margin-bottom: 0.25rem;
    border: 1px solid var(--e2t-border-color);
}

.prova-item:hover {
    background: var(--e2t-primary-light);
}

/* ========== Sidebar collapsed (desktop default) ========== */
@media (min-width: 992px) {
    .sidebar {
        width: 70px;
    }

    .sidebar .sidebar-brand {
        justify-content: center;
        padding: 0 0.5rem;
    }

    .sidebar .sidebar-logo {
        height: 28px;
    }

    .sidebar .sidebar-brand-text {
        display: none;
    }

    .sidebar .sidebar-nav .nav-label {
        display: none;
    }

    .sidebar .sidebar-nav .nav-link {
        justify-content: center;
        padding: 0.7rem 0.5rem;
        font-size: 0;
        gap: 0;
    }

    .sidebar .sidebar-nav .nav-link i {
        margin-right: 0;
        font-size: 1.15rem;
    }

    .sidebar .sidebar-footer {
        padding: 0.75rem 0.5rem;
    }

    .sidebar .sidebar-footer .btn {
        font-size: 0;
        padding: 0.4rem;
    }

    .sidebar .sidebar-footer .btn i {
        font-size: 1rem;
        margin: 0;
    }

    .main-content {
        margin-left: 70px;
    }

    /* Expanded state on hover or toggle */
    .sidebar.expanded {
        width: var(--e2t-sidebar-width);
    }

    .sidebar.expanded .sidebar-brand {
        justify-content: flex-start;
        padding: 0 1.25rem;
    }

    .sidebar.expanded .sidebar-logo {
        height: 38px;
    }

    .sidebar.expanded .sidebar-brand-text {
        display: block;
    }

    .sidebar.expanded .sidebar-nav .nav-label {
        display: block;
    }

    .sidebar.expanded .sidebar-nav .nav-link {
        justify-content: flex-start;
        padding: 0.55rem 1rem;
        font-size: 0.85rem;
        gap: 0.75rem;
    }

    .sidebar.expanded .sidebar-footer {
        padding: 1rem;
    }

    .sidebar.expanded .sidebar-footer .btn {
        font-size: 0.85rem;
        padding: 0.45rem 1rem;
    }

    .main-content.sidebar-expanded {
        margin-left: var(--e2t-sidebar-width);
    }
}

/* ========== Sidebar tooltip (collapsed) ========== */
.e2t-sidebar-tooltip {
    position: fixed;
    background: #1e293b;
    color: #fff;
    font-size: 0.78rem;
    padding: 0.3rem 0.65rem;
    border-radius: 6px;
    white-space: nowrap;
    z-index: 9999;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    pointer-events: none;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.15s ease;
}

.e2t-sidebar-tooltip.show {
    opacity: 1;
}

/* ========== Segmented Control — Informações da Turma ========== */
/* ========== Responsive ========== */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .main-content {
        margin-left: 0;
    }

    .sidebar-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 1035;
        display: none;
    }

    .sidebar-backdrop.show {
        display: block;
    }

    .content-area {
        padding: 1rem;
    }

    .top-header {
        padding: 0 1rem;
    }

    .card-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .card-header .btn {
        width: 100%;
        justify-content: center;
    }

    /* Table inside card scrolling */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 575.98px) {
    .content-area {
        padding: 0.75rem;
    }

    .top-header {
        padding: 0 0.75rem;
        gap: 0.5rem;
    }

    .card-header {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }

    .table {
        font-size: 0.8rem;
    }

    .table thead th {
        padding: 0.5rem 0.65rem;
        font-size: 0.7rem;
    }

    .table td {
        padding: 0.5rem 0.65rem;
    }

    .modal-content {
        border: none;
        border-radius: 12px;
    }

    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-lg {
        max-width: 100%;
    }

    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }

    .alert {
        font-size: 0.82rem;
        padding: 0.65rem 1rem;
    }

    .user-profile-btn {
        padding: 0.25rem 0.5rem;
    }

    .user-avatar {
        width: 30px;
        height: 30px;
        font-size: 0.75rem;
    }

    .form-control,
    .form-select {
        font-size: 0.82rem;
    }

    .form-label {
        font-size: 0.72rem;
    }

    .app-footer {
        font-size: 0.72rem;
        padding: 0.75rem 1rem;
    }

    .badge {
        font-size: 0.68rem;
    }

    .login-card {
        padding: 1.5rem;
    }

    .login-card .brand-title img {
        max-height: 70px;
    }

    .login-card .brand-title h2 {
        font-size: 1.3rem;
    }
}

/* ========== Misc ========== */
.loading-animation {
    display: inline-flex;
    gap: 4px;
}

.loading-animation div {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--e2t-primary);
    animation: loading-bounce 0.6s infinite alternate;
}

.loading-animation div:nth-child(2) { animation-delay: 0.2s; }
.loading-animation div:nth-child(3) { animation-delay: 0.4s; }

@keyframes loading-bounce {
    to { transform: translateY(-10px); opacity: 0.3; }
}

/* Badge styles */
.badge-status {
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Modal improvements */
.modal-content {
    border: none;
    border-radius: 12px;
}

.modal-header {
    border-bottom: 1px solid var(--e2t-border-color);
    padding: 1rem 1.25rem;
}

.modal-footer {
    border-top: 1px solid var(--e2t-border-color);
    padding: 0.75rem 1.25rem;
}

/* Empty state */
.empty-state-inline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--e2t-text-secondary);
    font-size: 0.85rem;
}

.empty-state-inline i {
    font-size: 1.2rem;
}

/* ========== Fade-in Animation ========== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeInUp 0.4s ease forwards;
}

.content-area .card,
.content-area .page-header {
    animation: fadeInUp 0.4s ease forwards;
    opacity: 0;
}

.content-area .card:nth-child(1) { animation-delay: 0.05s; }
.content-area .card:nth-child(2) { animation-delay: 0.1s; }
.content-area .card:nth-child(3) { animation-delay: 0.15s; }
.content-area .card:nth-child(4) { animation-delay: 0.2s; }

.content-area .page-header { animation-delay: 0s; }

/* ========== Action Button Hover Effects ========== */
.btn-sm {
    transition: all 0.2s ease;
}

.btn-sm:hover {
    transform: scale(1.08);
}

.btn-sm:active {
    transform: scale(0.95);
}

/* ========== Sidebar Link Hover Icon Shift ========== */
.sidebar-nav .nav-link i {
    transition: transform 0.2s ease;
}

.sidebar-nav .nav-link:hover i {
    transform: translateX(3px);
}

/* ========== Zebra Striping ========== */
.table-striped > tbody > tr:nth-of-type(odd) > td {
    background-color: #fafbfc;
}

.table > tbody > tr {
    transition: background-color 0.15s ease;
}

/* ========== Sticky Table Header ========== */
.table-sticky thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.table-sticky thead th {
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

/* ========== Table Responsive Scroll Indicator ========== */
.table-scroll-wrapper {
    position: relative;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-scroll-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 30px;
    background: linear-gradient(to left, rgba(255,255,255,0.9), transparent);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.table-scroll-wrapper.has-scroll::after {
    opacity: 1;
}

/* ========== Empty State ========== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--e2t-primary-light);
    color: var(--e2t-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.empty-state h6 {
    font-weight: 600;
    color: var(--e2t-text-primary);
    margin-bottom: 0.25rem;
}

.empty-state p {
    font-size: 0.85rem;
    color: var(--e2t-text-secondary);
    margin: 0;
    max-width: 300px;
}

/* ========== Loading Button State ========== */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.75;
}

.btn-loading .btn-text {
    visibility: hidden;
}

.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin-top: -9px;
    margin-left: -9px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: btn-spin 0.6s linear infinite;
}

@keyframes btn-spin {
    to { transform: rotate(360deg); }
}

/* ========== DataTables Overrides ========== */

/* Top row (length + filter) and bottom row (info + paginate) as flex */
.dataTables_wrapper .row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin: 0;
}

.dataTables_wrapper .row > div {
    float: none !important;
}

.dataTables_wrapper .dataTables_filter input {
    border: 1px solid var(--e2t-border-color);
    border-radius: 8px;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
}

.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--e2t-primary);
    box-shadow: 0 0 0 3px rgba(33, 181, 115, 0.1);
    outline: none;
}

.dataTables_wrapper .dataTables_length select {
    border: 1px solid var(--e2t-border-color);
    border-radius: 8px;
    padding: 0.35rem 2rem 0.35rem 0.6rem;
    font-size: 0.85rem;
    font-family: 'Inter', sans-serif;
}

.dataTables_wrapper .dataTables_length select:focus {
    border-color: var(--e2t-primary);
    box-shadow: 0 0 0 3px rgba(33, 181, 115, 0.1);
    outline: none;
}

.dataTables_wrapper .dataTables_info {
    font-size: 0.8rem;
    color: var(--e2t-text-secondary);
    padding-top: 0.75rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    font-size: 0.8rem;
    border-radius: 6px !important;
    margin: 0 2px;
    font-family: 'Inter', sans-serif;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--e2t-primary) !important;
    border-color: var(--e2t-primary) !important;
    color: #fff !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--e2t-primary-light) !important;
    border-color: var(--e2t-primary-light) !important;
    color: var(--e2t-primary) !important;
}

.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_length {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
}

.dataTables_wrapper .dataTables_paginate {
    padding: 0.75rem 1rem;
}

/* Responsive: stack controls on small screens */
@media (max-width: 767.98px) {
    .dataTables_wrapper .row > div[class*="col-sm"],
    .dataTables_wrapper .row > div[class*="col-md"] {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        text-align: left !important;
    }

    .dataTables_wrapper .dataTables_filter {
        padding: 0 1rem 0.5rem;
    }

    .dataTables_wrapper .dataTables_filter label {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
        width: 100%;
    }

    .dataTables_wrapper .dataTables_filter input {
        width: 100% !important;
        margin-left: 0 !important;
    }

    .dataTables_wrapper .dataTables_length {
        padding: 0.75rem 1rem 0.25rem;
    }

    .dataTables_wrapper .dataTables_info {
        text-align: center !important;
        padding: 0.5rem 1rem 0.25rem;
    }

    .dataTables_wrapper .dataTables_paginate {
        text-align: center !important;
        padding: 0.25rem 1rem 0.75rem;
    }

    .dataTables_wrapper .dataTables_paginate .pagination {
        justify-content: center;
        flex-wrap: wrap;
        gap: 2px;
    }
}

@media (max-width: 575.98px) {
    .dataTables_wrapper .dataTables_filter,
    .dataTables_wrapper .dataTables_length {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }

    .dataTables_wrapper .dataTables_info {
        font-size: 0.72rem;
    }

    .dataTables_wrapper .dataTables_paginate .paginate_button {
        font-size: 0.72rem;
        padding: 0.25rem 0.5rem !important;
        margin: 0 1px;
    }
}

table.dataTable {
    width: 100% !important;
}

table.dataTable thead th {
    border-bottom-color: var(--e2t-border-color) !important;
}

table.dataTable.table-hover tbody tr:hover {
    background-color: var(--e2t-primary-light) !important;
}

/* Fix DataTables inside card with p-0 */
.card-body.p-0 .dataTables_wrapper .dataTables_filter,
.card-body.p-0 .dataTables_wrapper .dataTables_length {
    padding: 0.75rem 1rem;
}

.card-body.p-0 .dataTables_wrapper .dataTables_info,
.card-body.p-0 .dataTables_wrapper .dataTables_paginate {
    padding: 0.5rem 1rem 0.75rem;
}

/* DataTables scrollX - single scroll for thead+tbody */
.dataTables_scrollBody {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
}

.dataTables_scrollHead {
    overflow: hidden !important;
}

/* ========== Sync Button: icon-only on mobile ========== */
@media (max-width: 575.98px) {
    .btn-sync-totvs .btn-sync-text {
        display: none;
    }
}

/* ========== Página de Provas (Exportação de Notas) ========== */
/* Utilitários pontuais */
.text-sm { font-size: 0.85rem; }
.icon-xs { font-size: 0.7rem; }
.icon-2x { font-size: 2rem; }
.badge-qtd { font-size: 0.75rem; }
.col-check { width: 40px; }
.btn-trocar-filial { max-width: 100%; }

.accordion-btn-flush {
    background: transparent;
    box-shadow: none;
    padding: 0.5rem 1rem;
}

/* Preview do arquivo */
.preview-header { font-size: 0.8rem; }
.preview-text {
    font-size: 0.78rem;
    max-height: 60vh;
    overflow: auto;
    background: #1e293b;
    color: #e2e8f0;
    white-space: pre;
    tab-size: 4;
}

/* Modal de seleção de filial */
.filial-modal-content {
    border: none;
    border-radius: 16px;
    overflow: hidden;
}
.filial-modal-header {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    padding: 1.25rem 1.5rem;
    border: none;
}
.filial-modal-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
}
.filial-modal-icon i {
    color: #60a5fa;
    font-size: 1rem;
}
.filial-modal-title {
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
}
.filial-modal-body { padding: 1.5rem; }
.filial-modal-desc {
    color: #475569;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}
.filial-search-icon {
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.85rem;
}
.filial-search-input {
    padding-left: 2.2rem;
    font-size: 0.88rem;
    border-radius: 10px;
}
.filial-list {
    max-height: 320px;
    overflow-y: auto;
}
.filial-item {
    cursor: pointer;
    border-radius: 10px;
    margin-bottom: 0.35rem;
}
.filial-item.is-active {
    border-color: var(--e2t-primary);
    background: rgba(33, 181, 115, 0.05);
}
.filial-item-nome { font-size: 0.9rem; }
.filial-item-id {
    font-size: 0.78rem;
    color: #94a3b8;
}
.filial-badge-atual {
    background: var(--e2t-primary);
    color: #fff;
    font-size: 0.7rem;
}
.filial-modal-footer {
    border-top: 1px solid #e2e8f0;
    padding: 1rem 1.5rem;
}

/* Acessibilidade: foco visível nas linhas da tabela de provas */
.prova-row {
    outline: none;
}
.prova-row:focus-visible {
    outline: 2px solid var(--e2t-primary);
    outline-offset: -2px;
}

/* ========== Página de Importação ========== */
/* Modal de confirmação */
.e2t-modal-content {
    border: none;
    border-radius: 16px;
    overflow: hidden;
}
.e2t-modal-header {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    padding: 1.25rem 1.5rem;
    border: none;
}
.e2t-modal-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
}
.e2t-modal-icon i { font-size: 1rem; }
.icon-amber { color: #fbbf24; }
.e2t-modal-title {
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
}
.e2t-modal-body { padding: 1.5rem; }
.e2t-modal-desc {
    color: #475569;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}
.e2t-modal-footer {
    border-top: 1px solid #e2e8f0;
    padding: 1rem 1.5rem;
}
.e2t-alert-note {
    font-size: 0.82rem;
    border-radius: 8px;
}

/* Overlay de progresso */
.import-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
}
.import-overlay.show { display: flex; }
.import-overlay-box {
    width: 420px;
    max-width: 90vw;
}
.import-overlay-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: rgba(33, 181, 115, 0.15);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
}
.import-overlay-icon i {
    color: #21b573;
    font-size: 1.5rem;
}
.import-overlay-title {
    color: #fff;
    font-weight: 600;
    font-size: 1.1rem;
}
.import-overlay-subtitle {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
    margin-top: 0.25rem;
}
.import-progress-box {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 1.25rem;
}
.import-progress-msg {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.82rem;
}
.import-progress-pct {
    color: #21b573;
    font-weight: 600;
    font-size: 0.85rem;
}
.import-progress-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    height: 10px;
    overflow: hidden;
}
.import-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #21b573, #34d399);
    border-radius: 6px;
    transition: width 0.4s ease;
}

/* ========== Página de Usuários ========== */
.e2t-modal-subtitle {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
}
.icon-white { color: #fff; }
.badge-xs { font-size: 0.7rem; }
.text-xs { font-size: 0.8rem; }

/* Cartão-resumo do usuário */
.user-summary-box {
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}
.user-detail-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--e2t-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    flex-shrink: 0;
}
.user-summary-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #1e293b;
}
.user-summary-email {
    font-size: 0.78rem;
    color: #64748b;
}

/* Seções de informação */
.user-section-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    margin-bottom: 0.5rem;
}
.user-info-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    color: #334155;
}

/* Grupo de checkboxes de filiais */
.filial-checkbox-group {
    max-height: 180px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
}
.filial-check-label { font-size: 0.85rem; }

/* Botões dos rodapés dos modais */
.btn-modal-cancel {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.4rem 1rem;
    font-weight: 500;
}
.btn-modal-save {
    border-radius: 8px;
    padding: 0.4rem 1rem;
    font-weight: 500;
}

/* Cartões de detalhe (usados em Usuários, Logs, Importação) */
.log-detail-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    text-align: center;
    height: 100%;
}
.log-detail-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    margin-bottom: 0.35rem;
}
.log-detail-value {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1e293b;
}

/* Página de Logs */
.log-row { cursor: pointer; }
.log-row:focus-visible {
    outline: 2px solid var(--e2t-primary);
    outline-offset: -2px;
}
.log-desc-cell { max-width: 400px; }
.log-ip-mono {
    font-family: 'Courier New', monospace;
    font-size: 0.82rem;
}
.log-descricao-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 0.85rem;
    color: #334155;
    line-height: 1.6;
}

/* Página de Logs SOAP */
.log-soap-row { cursor: pointer; }
.log-soap-row:focus-visible {
    outline: 2px solid var(--e2t-primary);
    outline-offset: -2px;
}
.soap-action-cell { max-width: 250px; }
.soap-info-box {
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}
.soap-detail-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    margin-bottom: 0.5rem;
}
.soap-detail-text {
    font-size: 0.85rem;
    font-weight: 500;
    color: #1e293b;
    word-break: break-all;
    font-family: 'Courier New', monospace;
}
.soap-erro-box {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: 1rem;
    font-size: 0.85rem;
    color: #991b1b;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 150px;
    overflow-y: auto;
}
.soap-xml-box {
    background: #1e293b;
    color: #e2e8f0;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    font-size: 0.78rem;
    max-height: 300px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
    border: 1px solid #334155;
}

/* Spinner de rotação (usado em botões de sincronizar/salvar) */
.spinner-rotate {
    display: inline-block;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}


