/* Power BI Frontend Styles */
.powerbi-client-home,
.powerbi-dashboard-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    min-height: auto;
    overflow: visible;
}

/* Login Required */
.powerbi-login-required,
.powerbi-no-client,
.powerbi-no-companies {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    padding: 20px;
    margin: 20px 0;
    text-align: center;
}

/* Welcome Header */
.welcome-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.welcome-header h1 {
    margin: 0 0 10px 0;
    font-size: 2.5em;
}

.welcome-header p {
    font-size: 1.2em;
    opacity: 0.9;
}

/* Companies Grid */
.companies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin: 40px 0;
}

.company-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: transform 0.3s ease;
}

.company-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.company-card-header {
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.company-card-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.3em;
}

.company-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: bold;
    text-transform: uppercase;
}

.company-badge.main {
    background: #007cba;
    color: white;
}

.company-badge.branch {
    background: #6c757d;
    color: white;
}

.company-card-body {
    padding: 20px;
}

.company-card-body p {
    margin: 0 0 15px 0;
    color: #666;
}

.company-actions .button {
    width: 100%;
    text-align: center;
}

/* Dashboard Styles */
.powerbi-dashboard-wrapper {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.company-selector-panel {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.company-selector-header {
    padding: 15px 20px;
    background: #007cba;
    color: white;
}

.company-selector-header h3 {
    margin: 0;
    font-size: 1.2em;
}

.company-selector-content {
    padding: 20px;
}

.company-selector-dropdown {
    display: flex;
    align-items: center;
    gap: 10px;
}

.company-selector-dropdown label {
    font-weight: bold;
    white-space: nowrap;
}

.company-select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
}

.single-company-notice {
    margin: 0;
    padding: 10px;
    background: #e7f3ff;
    border-radius: 4px;
    border-left: 4px solid #007cba;
}

/* Dashboard Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.company-info h1 {
    margin: 0 0 10px 0;
    color: #333;
}

.company-meta {
    display: flex;
    gap: 15px;
    align-items: center;
}

.cnpj {
    color: #666;
    font-size: 0.9em;
}

.company-type {
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.8em;
    font-weight: bold;
}

.company-type.main {
    background: #d4edda;
    color: #155724;
}

.company-type.branch {
    background: #e2e3e5;
    color: #383d41;
}

/* Period Filter */
.period-filter-panel {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.filter-header {
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.filter-header h3 {
    margin: 0;
    color: #495057;
}

.filter-controls {
    padding: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

.date-input-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.date-input-group label {
    font-weight: bold;
    font-size: 0.9em;
}

.date-input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1em;
}

/* Dashboard Content */
.dashboard-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.dashboard-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

.chart-card {
    min-height: 400px;
}

.card-header {
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    margin: 0;
    color: #495057;
}

.card-body {
    padding: 20px;
    position: relative;
}

.chart-container {
    height: 300px;
    position: relative;
}

.chart-summary {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.summary-item {
    flex: 1;
}

.summary-label {
    display: block;
    color: #666;
    font-size: 0.9em;
    margin-bottom: 5px;
}

.summary-value {
    display: block;
    font-size: 1.2em;
    font-weight: bold;
    color: #007cba;
}

/* Dashboard Row */
.dashboard-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

/* ===== MODERNIZAÇÃO DOS BOTÕES  ===== */
/* Estilo base para todos os botões */
.powerbi-dashboard-wrapper .company-selector-dropdown .button,
.powerbi-dashboard-wrapper .filter-controls .button,
.powerbi-dashboard-wrapper .dashboard-actions .button {
    display: inline-block !important;
    padding: 10px 20px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    text-align: center !important;
    text-decoration: none !important;
    border-radius: 6px !important;
    border: none !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
    line-height: 1.5 !important;
    min-width: 100px !important;
    background-image: none !important;
    text-shadow: none !important;
}

/* Botão Primário (Aplicar Filtro, Ir) */
.powerbi-dashboard-wrapper .filter-controls .button.button-primary,
.powerbi-dashboard-wrapper .company-selector-dropdown .button.button-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border: none !important;
}

.powerbi-dashboard-wrapper .filter-controls .button.button-primary:hover,
.powerbi-dashboard-wrapper .company-selector-dropdown .button.button-primary:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.4) !important;
}

.powerbi-dashboard-wrapper .filter-controls .button.button-primary:active,
.powerbi-dashboard-wrapper .company-selector-dropdown .button.button-primary:active {
    transform: translateY(0) !important;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.4) !important;
}

/* Botão Secundário (Resetar) */
.powerbi-dashboard-wrapper .filter-controls .button.button-secondary {
    background: white !important;
    color: #667eea !important;
    border: 2px solid #667eea !important;
}

.powerbi-dashboard-wrapper .filter-controls .button.button-secondary:hover {
    background: #f8f9fa !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.2) !important;
    border-color: #764ba2 !important;
    color: #764ba2 !important;
}

.powerbi-dashboard-wrapper .filter-controls .button.button-secondary:active {
    transform: translateY(0) !important;
}

/* Botão Voltar */
.powerbi-dashboard-wrapper .dashboard-actions .button {
    background: #f8f9fa !important;
    color: #495057 !important;
    border: 1px solid #dee2e6 !important;
}

.powerbi-dashboard-wrapper .dashboard-actions .button:hover {
    background: #e9ecef !important;
    transform: translateX(-3px) !important;
}

/* Botão desabilitado */
.powerbi-dashboard-wrapper .filter-controls .button:disabled,
.powerbi-dashboard-wrapper .filter-controls .button[disabled] {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

/* ===== SELETOR DE EMPRESAS MELHORADO ===== */
.company-selector-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    overflow: hidden;
    margin-bottom: 20px;
}

.company-selector-header {
    padding: 15px 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.company-selector-header h3 {
    margin: 0;
    font-size: 1.2em;
    font-weight: 500;
}

.company-selector-content {
    padding: 25px;
    background: #f8fafc;
}

.company-selector-dropdown {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.company-selector-dropdown label {
    font-weight: 600;
    color: #2d3748;
    min-width: 140px;
    font-size: 0.95em;
}

.company-select {
    flex: 1;
    min-width: 250px;
    padding: 10px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1em;
    color: #2d3748;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.company-select:hover {
    border-color: #667eea;
}

.company-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Ajuste para mobile */
@media (max-width: 768px) {
    .company-selector-dropdown {
        flex-direction: column;
        align-items: stretch;
    }
    
    .company-selector-dropdown label {
        min-width: auto;
    }
    
    .company-select {
        min-width: auto;
    }
}

/* ===== PAINEL DE FILTRO MELHORADO ===== */
.period-filter-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    overflow: hidden;
    margin: 20px 0;
}

.filter-header {
    padding: 15px 25px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.filter-header h3 {
    margin: 0;
    color: #2d3748;
    font-size: 1.1em;
    font-weight: 600;
}

.filter-controls {
    padding: 25px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-end;
    background: white;
}

.date-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-width: 180px;
}

.date-input-group label {
    font-weight: 600;
    color: #4a5568;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.date-input {
    padding: 10px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s ease;
}

.date-input:hover {
    border-color: #667eea;
}

.date-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Ajustes responsivos para os filtros */
@media (max-width: 768px) {
    .filter-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .date-input-group {
        width: 100%;
    }
    
    .filter-controls .button {
        width: 100%;
        margin: 5px 0;
    }
}

/*========FIM MODERNIZAÇÃO DOS BOTÕES=========*/

@media (max-width: 1024px) {
    .dashboard-row {
        grid-template-columns: 1fr;
    }
}

/* Cash Flow */
.cashflow-container {
    display: flex;
    align-items: center;
    gap: 30px;
}

.cashflow-details {
    flex: 1;
}

.cashflow-item {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e9ecef;
}

.cashflow-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.cashflow-label {
    display: block;
    color: #666;
    font-size: 0.9em;
    margin-bottom: 5px;
}

.cashflow-value {
    font-size: 1.2em;
    font-weight: bold;
}

.cashflow-item.inflow .cashflow-value {
    color: #28a745;
}

.cashflow-item.outflow .cashflow-value {
    color: #dc3545;
}

.cashflow-item.net .cashflow-value {
    color: #007cba;
}

.cashflow-percent {
    margin-left: 10px;
    font-size: 0.9em;
    color: #666;
}

/* Balance Card */
.balance-card .card-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.balance-display {
    text-align: center;
    margin-bottom: 20px;
}

.balance-amount {
    font-size: 2.5em;
    font-weight: bold;
    color: #28a745;
    margin: 10px 0;
}

.balance-date {
    color: #666;
    font-size: 0.9em;
}

.balance-trend {
    width: 100%;
}

.trend-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
}

.trend-item:last-child {
    border-bottom: none;
}

.trend-label {
    color: #666;
}

.trend-value {
    font-weight: bold;
}

.trend-value.positive {
    color: #28a745;
}

.trend-value.negative {
    color: #dc3545;
}

.trend-value.neutral {
    color: #6c757d;
}

/* Loading State */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* No Data Message */
.no-data-message {
    text-align: center;
    padding: 40px;
    color: #666;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}

/* Help Section */
.powerbi-help {
    margin-top: 40px;
    padding: 20px;
    background: #e7f3ff;
    border-radius: 8px;
    border-left: 4px solid #007cba;
}

/* Responsive */
@media (max-width: 768px) {
    .welcome-header {
        padding: 20px;
    }
    
    .welcome-header h1 {
        font-size: 1.8em;
    }
    
    .companies-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .company-selector-dropdown,
    .filter-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .date-input-group {
        width: 100%;
    }
    
    .cashflow-container {
        flex-direction: column;
        align-items: stretch;
    }
}

