/* =============================================
   SICREDI APP - CSS
   ============================================= */

/* Layout */
.sicredi-container {
    padding: 24px;
}

.sicredi-header {
    margin-bottom: 20px;
}

.sicredi-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 4px 0;
}

.sicredi-header p {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
}

/* Barra de ações */
.sicredi-actions {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.action-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-divider {
    width: 1px;
    height: 28px;
    background: #e5e7eb;
    margin: 0 4px;
}

/* Botões */
.btn-sm {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    font-size: 0.8rem;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}

.btn-sm svg {
    width: 14px;
    height: 14px;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-success {
    background: #10b981;
    color: white;
}

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

.btn-danger {
    background: #ef4444;
    color: white;
    padding: 8px;
}

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

/* Inputs */
.input-sm {
    padding: 8px 10px;
    font-size: 0.8rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
}

.input-sm:focus {
    outline: none;
    border-color: #3b82f6;
}

.select-sm {
    padding: 8px 10px;
    font-size: 0.8rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    min-width: 100px;
}

/* Stats */
.sicredi-stats {
    display: flex;
    gap: 16px;
    font-size: 0.8rem;
    color: #6b7280;
    margin-left: auto;
}

.sicredi-stats span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.sicredi-stats strong {
    color: #1f2937;
}

.stat-green strong {
    color: #10b981;
}

.stat-red strong {
    color: #ef4444;
}

.stat-blue strong {
    color: #3b82f6;
}

/* Tabela */
.sicredi-table-container {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.sicredi-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.sicredi-table th {
    background: #f8fafc;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: #64748b;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

.sicredi-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    color: #374151;
    vertical-align: middle;
}

.sicredi-table tbody tr:hover {
    background: #fafbfc;
}

/* Colunas */
.col-data {
    width: 100px;
    white-space: nowrap;
    font-size: 0.75rem;
    color: #6b7280;
}

.col-descricao {
    max-width: 350px;
    font-size: 0.78rem;
    line-height: 1.3;
    word-break: break-word;
}

.col-cidade {
    width: 120px;
    font-size: 0.75rem;
    color: #6b7280;
}

.col-cartao {
    width: 120px;
    font-size: 0.75rem;
    color: #6b7280;
}

.col-parcela {
    width: 60px;
    font-size: 0.75rem;
    color: #6b7280;
    text-align: center;
}

.col-valor {
    width: 100px;
    text-align: right;
    font-weight: 600;
    white-space: nowrap;
}

.col-tipo {
    width: 80px;
    text-align: center;
}

.valor-credito {
    color: #10b981;
}

.valor-debito {
    color: #ef4444;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
}

.badge-credito {
    background: #ecfdf5;
    color: #065f46;
}

.badge-debito {
    background: #fef2f2;
    color: #991b1b;
}

.badge-presencial {
    background: #eff6ff;
    color: #1e40af;
}

.badge-online {
    background: #f5f3ff;
    color: #5b21b6;
}

.badge-success {
    background: #ecfdf5;
    color: #065f46;
}

.badge-error {
    background: #fef2f2;
    color: #991b1b;
}

.badge-warning {
    background: #fffbeb;
    color: #92400e;
}

/* Upload */
.upload-area {
    background: white;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.upload-area:hover {
    border-color: #3b82f6;
}

.upload-area label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #374151;
}

.upload-area input[type="file"] {
    font-size: 0.8rem;
}

/* Paginação */
.sicredi-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-top: 1px solid #e5e7eb;
    font-size: 0.8rem;
    color: #6b7280;
}

.pagination-links {
    display: flex;
    gap: 8px;
}

.pagination-link {
    padding: 6px 12px;
    background: #f3f4f6;
    color: #374151;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.8rem;
}

.pagination-link:hover {
    background: #e5e7eb;
}

/* Empty */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #9ca3af;
}

/* Logs table card */
.card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.card-header {
    padding: 16px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.card-body {
    padding: 0;
}

/* Messages */
.messages-container {
    margin-bottom: 16px;
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 8px;
}

.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

/* Responsivo */
@media (max-width: 1024px) {
    .sicredi-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .action-divider {
        display: none;
    }

    .action-group {
        flex-wrap: wrap;
    }

    .sicredi-stats {
        margin-left: 0;
        margin-top: 12px;
    }

    .sicredi-table-container {
        overflow-x: auto;
    }
}

@media (max-width: 640px) {
    .sicredi-container {
        padding: 12px;
    }

    .upload-area {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Stat orange */
.stat-orange strong {
    color: #f59e0b;
}

/* Coluna Ação */
.col-acao {
    width: 110px;
    text-align: center;
    white-space: nowrap;
}

/* Dropdown Lançar */
.dropdown-lancar {
    position: relative;
    display: inline-block;
}

.btn-lancar {
    padding: 4px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
}

.btn-lancar:hover {
    background: #2563eb;
}

.dropdown-menu-lancar {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
    min-width: 140px;
    z-index: 100;
    padding: 4px 0;
}

.dropdown-menu-lancar button {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 14px;
    font-size: 0.78rem;
    border: none;
    background: none;
    cursor: pointer;
    color: #374151;
}

.dropdown-menu-lancar button:hover {
    background: #f3f4f6;
}

.dropdown-menu-lancar .btn-ignorar {
    color: #ef4444;
}

/* Badges de vinculação */
.badge-vinculado {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-despesa {
    background: #fef2f2;
    color: #b91c1c;
}

.badge-receita {
    background: #ecfdf5;
    color: #065f46;
}

.badge-transferencia {
    background: #eff6ff;
    color: #1e40af;
}

.badge-carteira {
    background: #f5f3ff;
    color: #5b21b6;
}

/* Modais */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0,0,0,0.45);
    justify-content: center;
    align-items: center;
    padding: 16px;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 40px rgba(0,0,0,.15);
    animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 16px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.modal-header .close {
    font-size: 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: #6b7280;
    padding: 0 4px;
}

.modal-header .close:hover {
    color: #111827;
}

.modal form {
    padding: 20px 24px;
}

.field {
    margin-bottom: 14px;
}

.field label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 0.85rem;
    color: #374151;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.875rem;
}

.field input:disabled {
    background: #f9fafb;
    color: #6b7280;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}

.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
}

.btn.secondary {
    background: #6b7280;
    color: white;
}

.btn.success {
    background: #10b981;
    color: white;
}

.btn.blue {
    background: #3b82f6;
    color: white;
}

.btn.purple {
    background: #8b5cf6;
    color: white;
}
