/**
 * VeraCita Financial Audit - Engagement Manager Styles
 */

/* ============================================
   Base Styles
   ============================================ */

.engagement-manager {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--audit-bg, #f8fafc);
    min-height: 100vh;
    color: var(--audit-text, #1e293b);
}

/* ============================================
   Header
   ============================================ */

.em-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 32px;
    background: white;
    border-bottom: 1px solid var(--audit-border, #e2e8f0);
    box-shadow: var(--audit-shadow-sm, 0 1px 2px rgba(0,0,0,0.05));
}

.em-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.em-header-left h1 {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    font-size: 22px;
    font-weight: 600;
}

.em-header-left h1 svg {
    width: 28px;
    height: 28px;
    color: var(--audit-primary, #1a56db);
}

.em-header-right {
    display: flex;
    gap: 12px;
}

.em-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

/* ============================================
   Toolbar
   ============================================ */

.em-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 32px;
    background: white;
    border-bottom: 1px solid var(--audit-border-light, #f1f5f9);
}

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--audit-bg, #f8fafc);
    border: 1px solid var(--audit-border, #e2e8f0);
    border-radius: 8px;
    min-width: 300px;
}

.search-box svg {
    width: 18px;
    height: 18px;
    color: var(--audit-text-muted, #64748b);
}

.search-box input {
    border: none;
    background: none;
    outline: none;
    font-size: 14px;
    width: 100%;
}

.filter-group {
    display: flex;
    gap: 8px;
}

.filter-btn {
    padding: 8px 16px;
    background: none;
    border: 1px solid var(--audit-border, #e2e8f0);
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover {
    background: var(--audit-bg-hover, #f1f5f9);
}

.filter-btn.active {
    background: var(--audit-primary, #1a56db);
    color: white;
    border-color: var(--audit-primary, #1a56db);
}

/* ============================================
   List
   ============================================ */

.em-list {
    padding: 24px 32px;
}

.em-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--audit-text-muted, #64748b);
}

.em-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: white;
    border: 1px solid var(--audit-border, #e2e8f0);
    border-radius: 10px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.em-item:hover {
    box-shadow: var(--audit-shadow, 0 4px 6px -1px rgba(0,0,0,0.1));
    border-color: var(--audit-primary-light, #3b82f6);
}

.em-item-main {
    flex: 1;
}

.em-item-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.em-item-name {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.em-item-status {
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

.em-item-meta {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--audit-text-muted, #64748b);
    margin-bottom: 10px;
}

.em-item-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 200px;
}

.em-item-progress .progress-bar {
    flex: 1;
    height: 6px;
    background: var(--audit-border, #e2e8f0);
    border-radius: 3px;
    overflow: hidden;
}

.em-item-progress .progress-fill {
    height: 100%;
    background: var(--audit-primary, #1a56db);
    border-radius: 3px;
}

.em-item-progress .progress-text {
    font-size: 12px;
    color: var(--audit-text-muted, #64748b);
    min-width: 35px;
}

.em-item-actions {
    display: flex;
    gap: 8px;
}

/* ============================================
   Status Colors
   ============================================ */

.status-planning {
    background: #e0f2fe;
    color: #0369a1;
}

.status-fieldwork {
    background: #fef3c7;
    color: #b45309;
}

.status-completion {
    background: #d1fae5;
    color: #047857;
}

.status-reporting {
    background: #ede9fe;
    color: #7c3aed;
}

.status-archived {
    background: #f1f5f9;
    color: #64748b;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn-primary {
    background: var(--audit-primary, #1a56db);
    color: white;
}

.btn-primary:hover {
    background: var(--audit-primary-dark, #1e40af);
}

.btn-secondary {
    background: white;
    color: var(--audit-text, #1e293b);
    border: 1px solid var(--audit-border, #e2e8f0);
}

.btn-secondary:hover {
    background: var(--audit-bg-hover, #f1f5f9);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 8px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    color: var(--audit-text-muted, #64748b);
    transition: all 0.2s;
}

.btn-icon:hover {
    background: var(--audit-bg-hover, #f1f5f9);
    color: var(--audit-primary, #1a56db);
}

.btn-icon svg {
    width: 100%;
    height: 100%;
}

.btn-back {
    margin-right: 8px;
}

/* ============================================
   Wizard
   ============================================ */

.em-wizard {
    padding: 24px 32px;
}

.wizard-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 32px;
    padding: 0 20px;
}

.wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.2s;
}

.wizard-step.active,
.wizard-step.completed {
    opacity: 1;
}

.step-indicator {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--audit-border, #e2e8f0);
    border-radius: 50%;
    font-size: 14px;
    font-weight: 600;
    color: var(--audit-text-muted, #64748b);
}

.wizard-step.active .step-indicator {
    background: var(--audit-primary, #1a56db);
    color: white;
}

.wizard-step.completed .step-indicator {
    background: var(--audit-success, #059669);
    color: white;
}

.wizard-step.completed .step-indicator svg {
    width: 20px;
    height: 20px;
}

.step-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--audit-text-muted, #64748b);
    text-align: center;
}

.wizard-step.active .step-label {
    color: var(--audit-primary, #1a56db);
}

.wizard-content {
    background: white;
    border: 1px solid var(--audit-border, #e2e8f0);
    border-radius: 12px;
    padding: 32px;
    min-height: 400px;
}

.wizard-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--audit-border-light, #f1f5f9);
}

/* ============================================
   Forms
   ============================================ */

.form-section h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 24px 0;
    font-size: 18px;
    font-weight: 600;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--audit-border-light, #f1f5f9);
}

.form-section h3 svg {
    width: 22px;
    height: 22px;
    color: var(--audit-primary, #1a56db);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--audit-text, #1e293b);
}

.form-group label.required::after {
    content: ' *';
    color: var(--audit-danger, #dc2626);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--audit-border, #e2e8f0);
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--audit-primary, #1a56db);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
}

.form-hint {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: var(--audit-text-muted, #64748b);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-label input {
    width: auto;
}

/* ============================================
   Tables
   ============================================ */

.team-table,
.timeline-table,
.view-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
}

.team-table th,
.team-table td,
.timeline-table th,
.timeline-table td,
.view-table th,
.view-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--audit-border-light, #f1f5f9);
}

.team-table th,
.timeline-table th,
.view-table th {
    font-size: 12px;
    font-weight: 600;
    color: var(--audit-text-muted, #64748b);
    text-transform: uppercase;
}

.team-table input,
.team-table select,
.timeline-table input,
.timeline-table select {
    padding: 8px 10px;
    border: 1px solid var(--audit-border, #e2e8f0);
    border-radius: 4px;
    font-size: 13px;
    width: 100%;
}

.team-table tfoot td {
    font-weight: 600;
}

.text-right {
    text-align: right;
}

.empty-row {
    text-align: center;
    color: var(--audit-text-muted, #64748b);
    padding: 24px !important;
}

/* ============================================
   Materiality Results
   ============================================ */

.materiality-results {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--audit-border-light, #f1f5f9);
}

.result-card {
    background: var(--audit-bg, #f8fafc);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
}

.result-label {
    display: block;
    font-size: 12px;
    color: var(--audit-text-muted, #64748b);
    margin-bottom: 8px;
}

.result-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--audit-primary, #1a56db);
}

.result-hint {
    display: block;
    font-size: 11px;
    color: var(--audit-text-light, #94a3b8);
    margin-top: 4px;
}

/* ============================================
   Risk Assessment
   ============================================ */

.risk-matrix {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.risk-item {
    background: var(--audit-bg, #f8fafc);
    border-radius: 10px;
    padding: 20px;
}

.risk-item label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 10px;
}

.risk-item select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--audit-border, #e2e8f0);
    border-radius: 6px;
    margin-bottom: 10px;
}

.risk-indicator {
    height: 6px;
    border-radius: 3px;
}

.risk-indicator.risk-low,
.risk-low {
    background: var(--audit-success, #059669);
    color: var(--audit-success, #059669);
}

.risk-indicator.risk-medium,
.risk-medium {
    background: var(--audit-warning, #d97706);
    color: var(--audit-warning, #d97706);
}

.risk-indicator.risk-high,
.risk-high {
    background: var(--audit-danger, #dc2626);
    color: var(--audit-danger, #dc2626);
}

.risk-item.overall {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.risk-value {
    font-size: 24px;
    font-weight: 700;
    text-transform: uppercase;
}

/* ============================================
   View Mode
   ============================================ */

.em-view {
    padding: 24px 32px;
}

.view-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-bottom: 24px;
}

.view-section {
    background: white;
    border: 1px solid var(--audit-border, #e2e8f0);
    border-radius: 10px;
    padding: 24px;
}

.view-section h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--audit-border-light, #f1f5f9);
}

.view-list {
    margin: 0;
}

.view-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--audit-border-light, #f1f5f9);
}

.view-item:last-child {
    border-bottom: none;
}

.view-item dt {
    font-size: 13px;
    color: var(--audit-text-muted, #64748b);
}

.view-item dd {
    font-size: 13px;
    font-weight: 500;
    margin: 0;
}

.empty-text {
    color: var(--audit-text-muted, #64748b);
    font-style: italic;
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 1024px) {
    .view-grid {
        grid-template-columns: 1fr;
    }

    .materiality-results {
        grid-template-columns: 1fr;
    }

    .risk-matrix {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .em-header,
    .em-toolbar,
    .em-list,
    .em-wizard,
    .em-view {
        padding-left: 16px;
        padding-right: 16px;
    }

    .em-toolbar {
        flex-direction: column;
        gap: 12px;
    }

    .search-box {
        min-width: 100%;
    }

    .wizard-steps {
        flex-wrap: wrap;
        gap: 16px;
    }

    .step-label {
        display: none;
    }
}
