/* =====================================================
   SISTEMA DE RELATÓRIOS - REUTILIZÁVEL
   Componente profissional para geração de relatórios
   ===================================================== */

/* ===== MODAL DE RELATÓRIO ===== */
.relatorio-modal .modal-dialog {
    max-width: 900px;
}

.relatorio-modal .modal-header {
    background: var(--primary-color, #3B82F6);
    color: white;
    border-bottom: none;
    padding: 1.5rem;
}

.relatorio-modal .modal-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    font-size: 1.25rem;
    color: white !important;
}

.relatorio-modal .modal-title i {
    font-size: 1.5rem;
}

.relatorio-modal .btn-close {
    filter: brightness(0) invert(1);
}

/* ===== SEÇÕES DO RELATÓRIO ===== */
.relatorio-section {
    margin-bottom: 1.5rem;
}

.relatorio-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
}

.relatorio-section-title i {
    color: var(--primary-color, #3B82F6);
    font-size: 1.1rem;
}

/* ===== FILTROS DE PERÍODO ===== */
.periodo-selector {
    background: #f7fafc;
    border-radius: 12px;
    padding: 1.25rem;
    border: 1px solid #e2e8f0;
}

.periodo-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    background: white;
    padding: 0.375rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.periodo-tab {
    flex: 1;
    padding: 0.625rem 1rem;
    border: none;
    background: transparent;
    color: #4a5568;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.periodo-tab:hover {
    background: #f7fafc;
    color: var(--primary-color, #3B82F6);
}

.periodo-tab.active {
    background: var(--primary-color, #3B82F6);
    color: white;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.periodo-tab i {
    margin-right: 0.5rem;
}

/* ===== INPUTS DE DATA ===== */
.periodo-inputs {
    display: none;
}

.periodo-inputs.active {
    display: block;
}

.data-unica-input,
.data-range-inputs {
    display: none;
}

.data-unica-input.active,
.data-range-inputs.active {
    display: block;
}

.date-input-group {
    position: relative;
}

.date-input-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #4a5568;
    margin-bottom: 0.5rem;
}

.date-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.date-input-wrapper i {
    position: absolute;
    left: 1rem;
    color: var(--primary-color, #3B82F6);
    pointer-events: none;
    z-index: 1;
}

.date-input-wrapper input[type="date"] {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #2d3748;
    transition: all 0.2s ease;
    background: white;
}

.date-input-wrapper input[type="date"]:focus {
    outline: none;
    border-color: var(--primary-color, #3B82F6);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.date-range-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* ===== OPÇÕES DE EXPORTAÇÃO ===== */
.export-options {
    background: white;
    border-radius: 12px;
    padding: 1.25rem;
    border: 1px solid #e2e8f0;
}

.export-format-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.export-format-card {
    position: relative;
    padding: 1.25rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
    text-align: center;
}

.export-format-card:hover {
    border-color: var(--primary-color, #3B82F6);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.export-format-card.selected {
    border-color: var(--primary-color, #3B82F6);
    background: rgba(59, 130, 246, 0.08);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Suporte dinâmico para qualquer cor do tema usando opacity */
.export-format-card.selected::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--primary-color);
    opacity: 0.05;
    border-radius: 12px;
    pointer-events: none;
}

.export-format-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 1.75rem;
    transition: all 0.2s ease;
}

.export-format-card.csv .export-format-icon {
    background: #48bb78;
    color: white;
}

.export-format-card.pdf .export-format-icon {
    background: #f56565;
    color: white;
}

.export-format-card.selected .export-format-icon {
    transform: scale(1.1);
}

.export-format-title {
    font-weight: 600;
    font-size: 1rem;
    color: #2d3748;
    margin-bottom: 0.375rem;
}

.export-format-desc {
    font-size: 0.8rem;
    color: #718096;
    line-height: 1.4;
}

.export-format-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.export-format-check {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    transition: all 0.2s ease;
}

.export-format-card.selected .export-format-check {
    background: var(--primary-color, #3B82F6);
    border-color: var(--primary-color, #3B82F6);
}

.export-format-check i {
    color: white;
    font-size: 0.75rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.export-format-card.selected .export-format-check i {
    opacity: 1;
}

/* ===== PREVIEW DO RELATÓRIO ===== */
.relatorio-preview {
    background: white;
    border-radius: 12px;
    padding: 1.25rem;
    border: 1px solid #e2e8f0;
    margin-top: 1.5rem;
    display: none;
}

.relatorio-preview.show {
    display: block;
    animation: fadeInUp 0.3s ease;
}

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

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 1rem;
}

.preview-title {
    font-weight: 600;
    font-size: 1rem;
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.preview-title i {
    color: var(--primary-color, #3B82F6);
}

.preview-badge {
    padding: 0.375rem 0.875rem;
    background: var(--primary-color, #3B82F6);
    color: white;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.preview-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.preview-stat {
    padding: 1rem;
    background: #f7fafc;
    border-radius: 8px;
    border-left: 3px solid var(--primary-color, #3B82F6);
}

.preview-stat-label {
    font-size: 0.8rem;
    color: #718096;
    margin-bottom: 0.25rem;
}

.preview-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #2d3748;
}

.preview-empty {
    text-align: center;
    padding: 2rem;
    color: #718096;
}

.preview-empty i {
    font-size: 3rem;
    color: #cbd5e0;
    margin-bottom: 1rem;
}

/* ===== BOTÕES DE AÇÃO ===== */
.relatorio-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e2e8f0;
}

.btn-relatorio {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-relatorio i {
    font-size: 1rem;
}

.btn-relatorio-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-relatorio-secondary:hover {
    background: #cbd5e0;
}

.btn-relatorio-primary {
    background: var(--primary-color, #3B82F6);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-relatorio-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
    filter: brightness(1.1);
}

.btn-relatorio-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-relatorio-success {
    background: #48bb78;
    color: white;
}

.btn-relatorio-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.3);
    filter: brightness(1.1);
}

.btn-relatorio-danger {
    background: #f56565;
    color: white;
}

.btn-relatorio-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 101, 101, 0.3);
    filter: brightness(1.1);
}

/* ===== LOADING STATE ===== */
.relatorio-loading {
    display: none;
    text-align: center;
    padding: 2rem;
}

.relatorio-loading.show {
    display: block;
}

.relatorio-spinner {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    border: 4px solid #e2e8f0;
    border-top-color: var(--primary-color, #3B82F6);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.relatorio-loading-text {
    color: #718096;
    font-size: 0.95rem;
}

/* ===== TEMA ESCURO ===== */
[data-theme="dark"] .periodo-selector,
[data-theme="dark"] .export-options,
[data-theme="dark"] .relatorio-preview {
    background: #1a202c;
    border-color: #2d3748;
}

[data-theme="dark"] .relatorio-section-title,
[data-theme="dark"] .preview-title,
[data-theme="dark"] .export-format-title,
[data-theme="dark"] .preview-stat-value {
    color: #e2e8f0;
}

/* Garantir que o título do relatório seja sempre branco */
[data-theme="dark"] .relatorio-modal .modal-title {
    color: white !important;
}

[data-theme="dark"] .periodo-tabs,
[data-theme="dark"] .export-format-card,
[data-theme="dark"] .date-input-wrapper input {
    background: #2d3748;
    border-color: #4a5568;
}

[data-theme="dark"] .periodo-tab {
    color: #a0aec0;
}

[data-theme="dark"] .periodo-tab:hover {
    background: #374151;
    color: var(--primary-color, #3B82F6);
}

[data-theme="dark"] .export-format-card:hover {
    border-color: var(--primary-color, #3B82F6);
}

[data-theme="dark"] .preview-stat {
    background: #2d3748;
    border-left-color: var(--primary-color, #3B82F6);
}

[data-theme="dark"] .date-input-wrapper input {
    color: #e2e8f0;
}

[data-theme="dark"] .btn-relatorio-secondary {
    background: #4a5568;
    color: #e2e8f0;
}

[data-theme="dark"] .btn-relatorio-secondary:hover {
    background: #2d3748;
}

/* ===== RESPONSIVIDADE ===== */
@media (max-width: 768px) {
    .relatorio-modal .modal-dialog {
        max-width: 95%;
        margin: 1rem auto;
    }

    .periodo-tabs {
        flex-direction: column;
    }

    .periodo-tab {
        padding: 0.875rem;
    }

    .export-format-selector {
        grid-template-columns: 1fr;
    }

    .date-range-grid {
        grid-template-columns: 1fr;
    }

    .preview-stats {
        grid-template-columns: 1fr;
    }

    .relatorio-actions {
        flex-direction: column;
    }

    .btn-relatorio {
        width: 100%;
        justify-content: center;
    }
}

/* ===== ANIMAÇÕES ===== */
.slide-in {
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}
