/**
 * Desi Pet Shower - Finance Add-on Styles
 *
 * @package    Desi_Pet_Shower
 * @subpackage Finance_Addon
 * @since      1.1.0
 */

/* ========================================
   1. LAYOUT E ESTRUTURA
   ======================================== */

#dps-section-financeiro {
    padding: 20px 0;
}

/* ========================================
   2. FIELDSETS E FORMULÁRIOS
   ======================================== */

.dps-finance-fieldset {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    background: #fff;
}

.dps-finance-fieldset legend {
    font-size: 16px;
    font-weight: 600;
    color: #374151;
    padding: 0 10px;
}

.dps-finance-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.dps-finance-form-grid label {
    display: block;
    font-weight: 500;
    color: #374151;
    margin-bottom: 4px;
}

.dps-finance-form-grid input,
.dps-finance-form-grid select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
}

.dps-finance-form-grid input:focus,
.dps-finance-form-grid select:focus {
    outline: none;
    border-color: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

/* Campo de valor com prefixo R$ */
.dps-input-money-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.dps-input-prefix {
    position: absolute;
    left: 12px;
    color: #6b7280;
    font-weight: 500;
    pointer-events: none;
}

.dps-input-money {
    padding-left: 36px !important;
}

/* Campo que ocupa linha inteira */
.dps-field-full {
    grid-column: 1 / -1;
}

/* Campo individual */
.dps-field {
    display: flex;
    flex-direction: column;
}

.dps-field label {
    font-weight: 500;
    color: #374151;
    margin-bottom: 4px;
    font-size: 14px;
}

.dps-field input,
.dps-field select {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
}

.dps-field input:focus,
.dps-field select:focus {
    outline: none;
    border-color: #0ea5e9;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

/* Ações do formulário */
.dps-form-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

/* Formulário de nova transação */
.dps-finance-new-form {
    margin-bottom: 30px;
}

/* Estado de erro nos campos */
.dps-input-error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

.dps-input-error:focus {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2) !important;
}

/* ========================================
   11. GRÁFICOS FINANCEIROS
   ======================================== */

.dps-finance-chart-container {
    margin: 24px 0;
    padding: 20px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

.dps-finance-chart-container h4 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: #374151;
}

.dps-finance-chart-wrapper {
    position: relative;
    height: 250px;
    width: 100%;
}

@media (max-width: 768px) {
    .dps-finance-chart-wrapper {
        height: 200px;
    }
}

/* ========================================
   12. RELATÓRIO DRE
   ======================================== */

.dps-finance-dre {
    margin: 24px 0;
    padding: 20px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

.dps-finance-dre h4 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: #374151;
}

.dps-dre-table {
    width: 100%;
    border-collapse: collapse;
}

.dps-dre-table th,
.dps-dre-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.dps-dre-header {
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px !important;
}

.dps-dre-header.dps-dre-receitas {
    background: #d1fae5;
    color: #065f46;
}

.dps-dre-header.dps-dre-despesas {
    background: #fee2e2;
    color: #991b1b;
}

.dps-dre-value {
    text-align: right;
    font-family: 'Roboto Mono', monospace;
}

.dps-dre-subtotal {
    background: #f9fafb;
}

.dps-dre-subtotal td {
    border-top: 2px solid #e5e7eb;
}

.dps-dre-resultado {
    font-size: 15px;
}

.dps-dre-resultado td {
    padding: 14px 12px !important;
    border-top: 2px solid #374151;
}

.dps-dre-positivo {
    background: #ecfdf5;
    color: #065f46;
}

.dps-dre-negativo {
    background: #fef2f2;
    color: #991b1b;
}

/* ========================================
   3. BADGES DE STATUS
   ======================================== */

.dps-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.dps-badge-pending,
.dps-badge-em_aberto {
    background-color: #fef3c7;
    color: #92400e;
}

.dps-badge-paid,
.dps-badge-pago {
    background-color: #d1fae5;
    color: #065f46;
}

.dps-badge-cancelled,
.dps-badge-cancelado {
    background-color: #fee2e2;
    color: #991b1b;
}

/* ========================================
   4. CARDS DE RESUMO (Dashboard)
   ======================================== */

.dps-finance-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.dps-finance-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.dps-finance-card h4 {
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    margin: 0 0 8px 0;
}

.dps-finance-card-value {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
}

.dps-finance-card-revenue {
    border-left: 4px solid #10b981;
}

.dps-finance-card-expense {
    border-left: 4px solid #ef4444;
}

.dps-finance-card-pending {
    border-left: 4px solid #f59e0b;
}

.dps-finance-card-balance {
    border-left: 4px solid #0ea5e9;
}

/* ========================================
   5. TABELA DE TRANSAÇÕES
   ======================================== */

.dps-finance-table-wrapper {
    overflow-x: auto;
    margin: 20px 0;
}

#dps-section-financeiro table.dps-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

#dps-section-financeiro table.dps-table th {
    background: #f9fafb;
    padding: 12px 10px;
    text-align: left;
    font-weight: 600;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
    white-space: nowrap;
}

#dps-section-financeiro table.dps-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: middle;
}

#dps-section-financeiro table.dps-table tr:hover {
    background-color: #f9fafb;
}

/* Status row colors - melhorados */
#dps-section-financeiro table.dps-table tr.fin-status-em_aberto {
    background-color: #fffbeb;
}

#dps-section-financeiro table.dps-table tr.fin-status-em_aberto:hover {
    background-color: #fef3c7;
}

#dps-section-financeiro table.dps-table tr.fin-status-pago {
    background-color: #f0fdf4;
}

#dps-section-financeiro table.dps-table tr.fin-status-pago:hover {
    background-color: #dcfce7;
}

#dps-section-financeiro table.dps-table tr.fin-status-cancelado {
    background-color: #fef2f2;
}

#dps-section-financeiro table.dps-table tr.fin-status-cancelado:hover {
    background-color: #fee2e2;
}

/* ========================================
   6. FILTROS
   ======================================== */

.dps-finance-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 20px;
}

.dps-finance-filters label {
    display: flex;
    flex-direction: column;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
}

.dps-finance-filters input,
.dps-finance-filters select {
    margin-top: 4px;
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
}

.dps-finance-filter-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.dps-finance-filter-buttons .button {
    white-space: nowrap;
}

/* ========================================
   7. AÇÕES E LINKS
   ======================================== */

.dps-action-link {
    color: #0ea5e9;
    text-decoration: none;
    font-weight: 500;
}

.dps-action-link:hover {
    color: #0284c7;
    text-decoration: underline;
}

.dps-action-link-danger {
    color: #dc2626;
}

.dps-action-link-danger:hover {
    color: #b91c1c;
}

/* ========================================
   8. MENSAGENS DE FEEDBACK
   ======================================== */

.dps-finance-messages {
    margin-bottom: 20px;
}

/* ========================================
   9. PAGINAÇÃO
   ======================================== */

.dps-finance-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    padding: 16px 0;
}

.dps-finance-pagination a,
.dps-finance-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    color: #374151;
    text-decoration: none;
    background: #fff;
}

.dps-finance-pagination a:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.dps-finance-pagination .current {
    background: #0ea5e9;
    border-color: #0ea5e9;
    color: #fff;
}

/* ========================================
   10. RESPONSIVIDADE
   ======================================== */

@media (max-width: 768px) {
    .dps-finance-form-grid {
        grid-template-columns: 1fr;
    }
    
    .dps-finance-filters {
        flex-direction: column;
        align-items: stretch;
    }
    
    .dps-finance-filter-buttons {
        flex-direction: column;
    }
    
    .dps-finance-summary {
        grid-template-columns: 1fr 1fr;
    }
    
    /* Tabela responsiva - card layout */
    #dps-section-financeiro table.dps-table thead {
        display: none;
    }
    
    #dps-section-financeiro table.dps-table tbody tr {
        display: block;
        margin-bottom: 16px;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        padding: 12px;
    }
    
    #dps-section-financeiro table.dps-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border-bottom: 1px solid #f3f4f6;
    }
    
    #dps-section-financeiro table.dps-table td:last-child {
        border-bottom: none;
    }
    
    #dps-section-financeiro table.dps-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6b7280;
        margin-right: 10px;
    }
}

@media (max-width: 480px) {
    .dps-finance-summary {
        grid-template-columns: 1fr;
    }
    
    .dps-finance-card-value {
        font-size: 20px;
    }
}
