/**
 * CSS Customizado - Sistema eGED
 */

/* Menu lateral - cor personalizada (#0a4092) */
.main-sidebar,
.main-sidebar.sidebar-dark-primary,
.main-sidebar .brand-link,
.main-sidebar .sidebar {
    background-color: #0a4092 !important;
}

[class*="sidebar-dark"] .nav-sidebar > .nav-item .nav-link.active {
    background-color: rgba(255,255,255,0.2) !important;
    color: #fff !important;
}

[class*="sidebar-dark"] .nav-sidebar > .nav-item:hover > .nav-link {
    background-color: rgba(255,255,255,0.1) !important;
    color: #fff !important;
}

/* Cores do Tema */
:root {
    --primary-color: #007bff;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
}

/* Estilos Gerais */
body {
    font-family: 'Source Sans Pro', sans-serif;
}

/* Cards */
.card {
    box-shadow: 0 0 1px rgba(0,0,0,.125), 0 1px 3px rgba(0,0,0,.2);
    margin-bottom: 1rem;
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid rgba(0,0,0,.125);
    font-weight: 600;
}

/* Botões */
.btn {
    border-radius: .25rem;
    font-weight: 400;
}

.btn-sm {
    padding: .25rem .5rem;
    font-size: .875rem;
}

/* Tabelas */
.table {
    width: 100%;
    margin-bottom: 1rem;
    color: #212529;
}

.table thead th {
    vertical-align: bottom;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
}

.table-bordered {
    border: 1px solid #dee2e6;
}

.table-bordered th,
.table-bordered td {
    border: 1px solid #dee2e6;
}

/* Badges */
.badge {
    display: inline-block;
    padding: .25em .4em;
    font-size: 75%;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: .25rem;
}

/* Formulários */
.form-control:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 .2rem rgba(0,123,255,.25);
}

.form-control.is-invalid {
    border-color: #dc3545;
    padding-right: calc(1.5em + .75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.8 3.6.4.4.4-.4m0 4.8-.4-.4-.4.4'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(.375em + .1875rem) center;
    background-size: calc(.75em + .375rem) calc(.75em + .375rem);
}

.form-control.is-invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 .2rem rgba(220,53,69,.25);
}

.form-group label {
    font-weight: 600;
    margin-bottom: .5rem;
}

.required::after {
    content: " *";
    color: var(--danger-color);
}

/* Alertas */
.alert {
    border-radius: .25rem;
    margin-bottom: 1rem;
}

.alert ul {
    margin: 10px 0;
    padding-left: 20px;
}

.alert ul li {
    margin: 5px 0;
}

.alert strong {
    display: block;
    margin-bottom: 5px;
}

/* Loading Spinner */
.spinner-border {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    vertical-align: text-bottom;
    border: .25em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border .75s linear infinite;
}

@keyframes spinner-border {
    to { transform: rotate(360deg); }
}

/* Paginação */
.pagination {
    display: flex;
    padding-left: 0;
    list-style: none;
    border-radius: .25rem;
}

.page-link {
    position: relative;
    display: block;
    padding: .5rem .75rem;
    margin-left: -1px;
    line-height: 1.25;
    color: #007bff;
    background-color: #fff;
    border: 1px solid #dee2e6;
    text-decoration: none;
}

.page-link:hover {
    z-index: 2;
    color: #0056b3;
    background-color: #e9ecef;
    border-color: #dee2e6;
}

.page-item.active .page-link {
    z-index: 3;
    color: #fff;
    background-color: #007bff;
    border-color: #007bff;
}

/* Modal */
.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
    border-top-left-radius: .3rem;
    border-top-right-radius: .3rem;
}

.modal-body {
    position: relative;
    flex: 1 1 auto;
    padding: 1rem;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 1rem;
    border-top: 1px solid #dee2e6;
}

/* DataTables Customização */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter {
    margin-bottom: 1rem;
}

/* Reduzir altura da caixa de pesquisa do DataTables */
.dataTables_wrapper .dataTables_filter input[type="search"],
.dataTables_wrapper .dataTables_filter input.form-control,
.dataTables_wrapper .dataTables_filter input {
    height: 28px !important;
    min-height: 28px !important;
    max-height: 28px !important;
    padding: 0.2rem 0.4rem !important;
    font-size: 0.8rem !important;
    line-height: 1.2 !important;
    margin: 0 !important;
}

.dataTables_wrapper .dataTables_filter label {
    margin-bottom: 0;
    font-size: 0.875rem;
    line-height: 1.2;
}

.dataTables_wrapper .dataTables_filter {
    padding-top: 0;
    padding-bottom: 0;
}

.dataTables_wrapper .dataTables_paginate {
    margin-top: 1rem;
}

/* Status Badges */
.badge-status-pendente {
    background-color: #ffc107;
    color: #212529;
}

.badge-status-aprovada {
    background-color: #28a745;
    color: #fff;
}

.badge-status-negada {
    background-color: #dc3545;
    color: #fff;
}

.badge-status-enviada {
    background-color: #17a2b8;
    color: #fff;
}

/* Upload Area */
.upload-area {
    border: 2px dashed #dee2e6;
    border-radius: .25rem;
    padding: 2rem;
    text-align: center;
    transition: border-color .15s ease-in-out;
    cursor: pointer;
}

.upload-area:hover {
    border-color: #007bff;
}

.upload-area.dragover {
    border-color: #007bff;
    background-color: #f8f9fa;
}

/* Autocomplete Bootstrap Customizado */
#credor_dropdown, #liquidante_dropdown {
    position: absolute;
    z-index: 1050;
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    margin-top: 2px;
    max-height: 200px;
    overflow-y: auto;
}

#credor_dropdown .dropdown-item,
#liquidante_dropdown .dropdown-item {
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #f8f9fa;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#credor_dropdown .dropdown-item:hover,
#liquidante_dropdown .dropdown-item:hover {
    background-color: #f8f9fa;
}

#credor_dropdown .dropdown-item:last-child,
#liquidante_dropdown .dropdown-item:last-child {
    border-bottom: none;
}

#credor_dropdown .dropdown-item.active,
#liquidante_dropdown .dropdown-item.active {
    background-color: #007bff;
    color: #fff;
}

/* Progress Bar */
.progress {
    height: 20px;
    margin-bottom: 0;
}

/* Badges de Status */
.badge-status-pendente {
    background-color: #ffc107;
    color: #000;
}

.badge-status-aprovada {
    background-color: #28a745;
    color: #fff;
}

.badge-status-negada {
    background-color: #dc3545;
    color: #fff;
}

.badge-status-enviada {
    background-color: #17a2b8;
    color: #fff;
}

/* Info Box (AdminLTE) */
.info-box {
    display: block;
    min-height: 90px;
    background: #fff;
    width: 100%;
    box-shadow: 0 1px 1px rgba(0,0,0,0.1);
    border-radius: 2px;
    margin-bottom: 15px;
}

.info-box-icon {
    border-top-left-radius: 2px;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom-left-radius: 2px;
    display: block;
    float: left;
    height: 90px;
    width: 90px;
    text-align: center;
    font-size: 45px;
    line-height: 90px;
    background: rgba(0,0,0,0.2);
}

.info-box-content {
    padding: 5px 10px;
    margin-left: 90px;
}

.info-box-text {
    text-transform: uppercase;
    font-weight: 600;
    font-size: 13px;
}

.info-box-number {
    display: block;
    font-weight: bold;
    font-size: 18px;
}

/* Preview PDF */
.pdf-preview {
    border: 1px solid #dee2e6;
    border-radius: .25rem;
    padding: 1rem;
    background-color: #f8f9fa;
    max-height: 500px;
    overflow-y: auto;
}

/* Wizard Steps */
.wizard-steps {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem 0;
    border-bottom: 2px solid #dee2e6;
}

.wizard-steps .step-item {
    flex: 1;
    text-align: center;
    position: relative;
    cursor: pointer;
}

.wizard-steps .step-item:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 20px;
    left: 60%;
    width: 80%;
    height: 2px;
    background-color: #dee2e6;
    z-index: 1;
}

.wizard-steps .step-item.active:not(:last-child)::after,
.wizard-steps .step-item.completed:not(:last-child)::after {
    background-color: #007bff;
}

.wizard-steps .step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #e9ecef;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
    font-weight: bold;
    position: relative;
    z-index: 2;
    transition: all 0.3s;
}

.wizard-steps .step-item.active .step-number {
    background-color: #007bff;
    color: #fff;
}

.wizard-steps .step-item.completed .step-number {
    background-color: #28a745;
    color: #fff;
}

.wizard-steps .step-item.completed .step-number::before {
    content: '\f00c';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
}

.wizard-steps .step-label {
    font-size: 0.875rem;
    color: #6c757d;
    font-weight: 500;
}

.wizard-steps .step-item.active .step-label {
    color: #007bff;
    font-weight: 600;
}

.wizard-steps .step-item.completed .step-label {
    color: #28a745;
}

.wizard-step {
    min-height: 300px;
    padding: 1rem 0;
}

/* Campos extraídos do PDF */
.campo-extraido {
    border-left: 4px solid #28a745 !important;
    background-color: #f0fff4 !important;
}

.campo-extraido[data-confianca="alta"] {
    border-left-color: #28a745 !important;
    background-color: #f0fff4 !important;
}

.campo-extraido[data-confianca="media"] {
    border-left-color: #ffc107 !important;
    background-color: #fffef0 !important;
}

.campo-extraido[data-confianca="baixa"] {
    border-left-color: #ff9800 !important;
    background-color: #fff8f0 !important;
}

.campo-extraido:focus {
    border-left-width: 4px !important;
}

/* Indicador de confiança (tooltip no título do campo) */
.campo-extraido[title]:hover::after {
    content: attr(title);
    position: absolute;
    background-color: #333;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    z-index: 1000;
    margin-top: -25px;
    margin-left: 5px;
}

/* Responsive */
@media (max-width: 768px) {
    .table-responsive {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .card-body {
        padding: .75rem;
    }
    
    .wizard-steps .step-label {
        font-size: 0.75rem;
    }
    
    .wizard-steps .step-number {
        width: 35px;
        height: 35px;
        font-size: 0.875rem;
    }
}
