/* ===== Gestao Module - Unified Clara-driven v2 ===== */

.gestao-page {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.gestao-subtitle {
    color: var(--text-secondary);
    font-size: 0.88rem;
    margin-top: 0.25rem;
}

/* ===== KPI Row ===== */
.gestao-kpi-row {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.gestao-kpi {
    flex: 1;
    min-width: 130px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
}

.gestao-kpi-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
}

.gestao-kpi-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* ===== Presentation Area ===== */
.gestao-presentation {
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    min-height: 200px;
    overflow: hidden;
}

.gestao-presentation-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.gestao-presentation-header h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-primary);
}

.gestao-pdf-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: opacity 0.2s;
}

.gestao-pdf-btn:hover {
    opacity: 0.85;
}

.gestao-presentation-body {
    padding: 1rem;
}

.gestao-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.gestao-empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.gestao-empty-state p {
    font-size: 1.1rem;
    font-weight: 500;
    margin: 0;
}

.gestao-empty-state span {
    font-size: 0.82rem;
    margin-top: 0.25rem;
}

/* ===== Section Labels ===== */
.gestao-section-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.5rem;
}

/* ===== Quick Actions ===== */
.gestao-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.gestao-quick-btn {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: white;
    font-size: 0.82rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.gestao-quick-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #f0f0ff;
}

.gestao-quick-btn i {
    font-size: 0.85rem;
    opacity: 0.7;
}

.gestao-quick-btn--action {
    border-style: dashed;
    color: var(--primary);
}

.gestao-quick-btn--action:hover {
    background: var(--primary);
    color: white;
    border-style: solid;
}

/* ===== Upload Zone ===== */
.gestao-upload-compact {
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
}

.gestao-dropzone {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    text-align: center;
    color: var(--text-secondary);
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.gestao-dropzone.dragover {
    border-color: var(--primary);
    background: #f0f0ff;
    color: var(--primary);
}

.gestao-dropzone i {
    font-size: 1.5rem;
    opacity: 0.5;
}

.gestao-dropzone span {
    font-size: 0.85rem;
}

.gestao-upload-btn {
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 0.4rem 1rem;
    border-radius: 6px;
    font-size: 0.82rem;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.2s;
}

.gestao-upload-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.gestao-upload-queue {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 0.5rem;
}

.gestao-upload-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.75rem;
    background: var(--bg);
    border-radius: 6px;
    font-size: 0.82rem;
}

.gestao-upload-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    margin-right: 0.5rem;
}

.gestao-upload-status {
    font-size: 0.78rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.gestao-qr-section {
    margin-top: 0.75rem;
    display: flex;
    justify-content: center;
}

/* ===== Report Sections ===== */
.gestao-report-section {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.gestao-report-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.gestao-report-kpis {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.gestao-report-kpi-card {
    background: var(--bg);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    flex: 1;
    min-width: 100px;
    text-align: center;
}

.gestao-report-kpi-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
}

.gestao-report-kpi-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}

.gestao-report-kpi-trend {
    font-size: 0.75rem;
    margin-top: 0.25rem;
    font-weight: 600;
}

.gestao-report-kpi-trend.positive {
    color: #16a34a;
}

.gestao-report-kpi-trend.negative {
    color: #dc2626;
}

.gestao-report-text {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
}

/* ===== Table (shared) ===== */
.gestao-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.gestao-table th,
.gestao-table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.gestao-table th {
    background: var(--bg);
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.gestao-table tr:hover td {
    background: #fafbfd;
}

/* ===== Badges ===== */
.gestao-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 500;
}

.gestao-badge.active, .gestao-badge.paid, .gestao-badge.valid, .gestao-badge.sent {
    background: #dcfce7;
    color: #16a34a;
}

.gestao-badge.pending {
    background: #fef3c7;
    color: #d97706;
}

.gestao-badge.overdue, .gestao-badge.expired, .gestao-badge.failed {
    background: #fee2e2;
    color: #dc2626;
}

.gestao-badge.inactive, .gestao-badge.cancelled {
    background: #f1f5f9;
    color: #64748b;
}

.gestao-badge.maintenance, .gestao-badge.expiring, .gestao-badge.vacation {
    background: #fef3c7;
    color: #d97706;
}

/* ===== Modal ===== */
.gestao-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
}

.gestao-modal {
    background: white;
    border-radius: 12px;
    max-width: 520px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.gestao-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.gestao-modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.gestao-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    line-height: 1;
}

.gestao-modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}

.gestao-modal-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* ===== Form Fields ===== */
.gestao-field {
    margin-bottom: 0.75rem;
}

.gestao-field label {
    display: block;
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
    font-weight: 500;
}

.gestao-field input,
.gestao-field select,
.gestao-field textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
}

.gestao-field textarea {
    resize: vertical;
}

.gestao-field-row {
    display: flex;
    gap: 0.75rem;
}

.gestao-field-row .gestao-field {
    flex: 1;
}

/* ===== Rich Report Cards ===== */
.gestao-rich-cards {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.gestao-rich-card {
    flex: 1;
    min-width: 140px;
    padding: 1rem;
    border-radius: 10px;
    text-align: center;
    border: 1px solid transparent;
}

.gestao-rich-card.green { background: #f0fdf4; border-color: #bbf7d0; }
.gestao-rich-card.red { background: #fef2f2; border-color: #fecaca; }
.gestao-rich-card.orange { background: #fffbeb; border-color: #fed7aa; }
.gestao-rich-card.blue { background: #eff6ff; border-color: #bfdbfe; }
.gestao-rich-card.purple { background: #faf5ff; border-color: #e9d5ff; }

.gestao-rich-card-icon {
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
    opacity: 0.7;
}

.gestao-rich-card.green .gestao-rich-card-icon { color: #16a34a; }
.gestao-rich-card.red .gestao-rich-card-icon { color: #dc2626; }
.gestao-rich-card.orange .gestao-rich-card-icon { color: #d97706; }
.gestao-rich-card.blue .gestao-rich-card-icon { color: #2563eb; }
.gestao-rich-card.purple .gestao-rich-card-icon { color: #7c3aed; }

.gestao-rich-card-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.gestao-rich-card-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}

/* ===== Rich Section ===== */
.gestao-rich-section {
    margin-bottom: 1rem;
}

.gestao-rich-section h4 {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

/* ===== Rich Items ===== */
.gestao-rich-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.gestao-rich-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.75rem;
    border-radius: 8px;
    background: var(--bg);
    transition: all 0.15s;
}

.gestao-rich-item.clickable {
    cursor: pointer;
}

.gestao-rich-item.clickable:hover {
    background: #eef2ff;
    transform: translateX(2px);
}

.gestao-rich-item-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1;
    min-width: 0;
}

.gestao-rich-item-icon {
    font-size: 0.95rem;
    width: 28px;
    text-align: center;
    flex-shrink: 0;
}

.gestao-rich-item-title {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gestao-rich-item-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gestao-rich-item-meta .text-danger { color: #dc2626; font-weight: 600; }
.gestao-rich-item-meta .text-warning { color: #d97706; font-weight: 500; }

.gestao-rich-item-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
    margin-left: 0.5rem;
}

.gestao-rich-item-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.gestao-rich-empty {
    padding: 1rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-style: italic;
}

/* ===== Rich Detail Modal ===== */
.gestao-rich-detail {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.gestao-rich-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.gestao-rich-detail-row:last-child {
    border-bottom: none;
}

.gestao-rich-detail-row .label {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.gestao-rich-detail-notes {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}

.gestao-rich-detail-notes .label {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.gestao-rich-detail-notes p {
    margin: 0.25rem 0 0;
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.5;
    background: var(--bg);
    padding: 0.5rem;
    border-radius: 6px;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .gestao-kpi-row {
        flex-wrap: wrap;
    }
    .gestao-kpi {
        min-width: calc(50% - 0.5rem);
    }
    .gestao-report-kpis {
        flex-wrap: wrap;
    }
}

@media (max-width: 600px) {
    .gestao-kpi {
        min-width: 100%;
    }
    .gestao-quick-actions {
        flex-direction: column;
    }
    .gestao-quick-btn {
        width: 100%;
        justify-content: center;
    }
    .gestao-field-row {
        flex-direction: column;
        gap: 0;
    }
    .gestao-modal {
        max-width: 100%;
        margin: 0.5rem;
    }
}

/* ===== Universal Report View ===== */
.report-view {
    padding: 1.25rem;
    max-width: 1200px;
    margin: 0 auto;
}

.report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--primary);
    flex-wrap: wrap;
    gap: 0.75rem;
}

.report-header-info h2 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.report-date {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.report-header-actions {
    display: flex;
    gap: 0.5rem;
}

.report-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.report-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.report-btn-pdf:hover { background: #ef4444; border-color: #ef4444; }
.report-btn-csv:hover { background: #22c55e; border-color: #22c55e; }
.report-btn-print:hover { background: #667eea; border-color: #667eea; }

.report-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (max-width: 600px) {
    .report-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .report-header-actions {
        width: 100%;
        justify-content: flex-end;
    }
    .report-btn span { display: none; }
}
