/* ====================================
   CENTRO DE CUSTOS - ESTILOS
   ==================================== */

/* Views/Tabs */
.cc-tab-view {
    display: none;
}

.cc-tab-view-active {
    display: block !important;
}

/* Topbar sempre visível */
.cc-topbar {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.cc-logo-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.cc-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 20px;
}

.cc-obra-selector {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.cc-obra-selector select {
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    min-width: 250px;
    cursor: pointer;
}

/* Navegação de tabs secundária */
.cc-nav-tabs {
    background: white;
    border-bottom: 1px solid #e5e7eb;
    padding: 0 1.5rem;
    display: flex;
    gap: 2rem;
}

.cc-nav-tab {
    padding: 1rem;
    border: none;
    background: none;
    border-bottom: 2px solid transparent;
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.cc-nav-tab:hover {
    color: #1f2937;
}

.cc-nav-tab-active {
    color: #2563eb !important;
    border-bottom-color: #2563eb !important;
}

/* Container de conteúdo */
.cc-container {
    padding: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Grid de estatísticas */
.cc-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.cc-stat-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.cc-stat-label {
    font-size: 0.75rem;
    color: #6b7280;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.cc-stat-value {
    font-size: 1.875rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.cc-stat-value.blue { color: #2563eb; }
.cc-stat-value.green { color: #059669; }
.cc-stat-value.orange { color: #ea580c; }
.cc-stat-value.purple { color: #7c3aed; }
.cc-stat-value.red { color: #dc2626; }

.cc-stat-subtitle {
    font-size: 0.75rem;
    color: #9ca3af;
}

/* Grid de centros de custo */
.cc-centros-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.cc-centro-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.2s;
}

.cc-centro-card:hover {
    border-color: #93c5fd;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.cc-centro-icon {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
    font-size: 24px;
}

.cc-centro-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.25rem;
}

.cc-centro-desc {
    font-size: 0.75rem;
    color: #6b7280;
}

/* Filtros */
.cc-filtro-container {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
}

.cc-filtro-group {
    display: flex;
    flex-direction: column;
    min-width: 200px;
}

.cc-filtro-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.cc-search-input {
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.875rem;
    min-width: 250px;
}

/* Cards de obra */
.cc-obra-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    position: relative;
    transition: all 0.2s;
}

.cc-obra-card:hover {
    border-color: #93c5fd;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.cc-obra-card h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.125rem;
    color: #1f2937;
}

.cc-obra-card p {
    margin: 0.25rem 0;
    font-size: 0.875rem;
    color: #6b7280;
}

.cc-obra-card-actions {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.cc-obra-card:hover .cc-obra-card-actions {
    opacity: 1;
}

/* Input monetário */
.cc-money-input {
    text-align: right !important;
    font-family: monospace !important;
}

/* Grid de projeção */
.cc-projecao-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.cc-projecao-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.cc-projecao-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.cc-projecao-titulo {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
}

.cc-projecao-valor {
    font-size: 1.25rem;
    font-weight: 600;
}

.cc-projecao-detalhes {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.5rem;
}

/* Badges de tipo de pagamento */
.cc-tipo-pagamento-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    background: #dbeafe;
    color: #1e40af;
    margin-right: 0.25rem;
    margin-bottom: 0.25rem;
}

.cc-recorrente-badge {
    background: #d1fae5 !important;
    color: #065f46 !important;
}

.cc-unico-badge {
    background: #fee2e2 !important;
    color: #991b1b !important;
}

/* Estado vazio */
.cc-empty-state {
    text-align: center;
    padding: 3rem;
    color: #6b7280;
}

.cc-empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Seções */
.cc-section-header {
    margin-bottom: 1.5rem;
}

.cc-section-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 0.5rem 0;
}

.cc-section-subtitle {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
}

/* Charts */
.cc-charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.cc-chart-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.cc-chart-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 1rem;
}

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

/* Info de obra */
.cc-obra-info {
    background: white;
    border-left: 4px solid #2563eb;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    border-radius: 4px;
}

.cc-obra-info h2 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
}

.cc-obra-info p {
    margin: 0;
    color: #6b7280;
    font-size: 0.875rem;
}

/* ============================================ */
/* RESPONSIVO - MOBILE FIRST */
/* ============================================ */

/* Tablets e Mobile Grande (768px ou menos) */
@media (max-width: 768px) {
    /* Topbar */
    .cc-topbar {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
        padding: 1rem;
    }
    
    .cc-logo-section {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    .cc-logo-section h2 {
        font-size: 1rem !important;
    }
    
    .cc-obra-selector {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .cc-obra-selector select {
        width: 100%;
    }
    
    .cc-obra-selector button {
        width: 100%;
        margin-left: 0 !important;
    }
    
    /* Navegação de abas */
    .cc-nav-tabs {
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.75rem;
    }
    
    .cc-nav-tab {
        flex: 1 1 calc(50% - 0.25rem);
        min-width: 120px;
        padding: 0.75rem 0.5rem;
        font-size: 0.875rem;
    }
    
    /* Container */
    .cc-container {
        padding: 1rem;
    }
    
    /* Grids - 1 coluna */
    .cc-charts-grid,
    .cc-stats-grid,
    .cc-projecao-grid,
    .cc-centros-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Cards */
    .cc-stat-card,
    .cc-chart-card,
    .cc-projecao-card,
    .cc-centro-card {
        margin-bottom: 0;
    }
    
    /* Títulos */
    .cc-section-title {
        font-size: 1.25rem;
    }
    
    .cc-section-subtitle {
        font-size: 0.875rem;
    }
    
    /* Tabelas */
    .cc-lancamentos-table {
        font-size: 0.75rem;
    }
    
    .cc-lancamentos-table th,
    .cc-lancamentos-table td {
        padding: 0.5rem !important;
    }
    
    /* Ações de obras */
    .cc-obra-card-actions {
        position: static;
        opacity: 1;
        margin-top: 1rem;
        justify-content: flex-end;
    }
    
    /* Filtros */
    .cc-filtro-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .cc-filtro-group,
    .cc-search-input {
        width: 100%;
    }
    
    /* Modal */
    .modal-content {
        width: 95vw !important;
        max-width: 95vw !important;
        margin: 1rem;
    }
    
    /* Form rows - empilhar */
    .form-row {
        flex-direction: column;
    }
    
    .form-group {
        width: 100% !important;
    }
}

/* Mobile Pequeno (480px ou menos) */
@media (max-width: 480px) {
    /* Topbar */
    .cc-topbar {
        padding: 0.75rem;
    }
    
    .cc-logo {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    .cc-logo-section h2 {
        font-size: 0.875rem !important;
    }
    
    /* Navegação */
    .cc-nav-tab {
        flex: 1 1 100%;
        font-size: 0.8125rem;
    }
    
    /* Stats */
    .cc-stat-value {
        font-size: 1.5rem;
    }
    
    .cc-stat-label {
        font-size: 0.75rem;
    }
    
    /* Projeção cards */
    .cc-projecao-titulo {
        font-size: 0.875rem;
    }
    
    .cc-projecao-valor {
        font-size: 1rem;
    }
    
    /* Centros grid */
    .cc-centro-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .cc-centro-name {
        font-size: 0.875rem;
    }
    
    /* Botões */
    .btn {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }
    
    /* Gráficos - altura menor */
    .cc-chart-container,
    .cc-chart-card > div {
        height: 250px !important;
    }
}

/* Landscape Mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .cc-topbar {
        padding: 0.5rem 1rem;
    }
    
    .cc-nav-tabs {
        padding: 0.5rem;
    }
    
    .cc-nav-tab {
        padding: 0.5rem;
        font-size: 0.8125rem;
    }
}

/* Forçar scroll horizontal em tabelas muito largas */
@media (max-width: 768px) {
    .cc-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        min-width: 600px;
    }
}
