/* MPDC AIP Management System - Custom Styles */
:root {
  --mpdc-primary: #1a5276;
  --mpdc-secondary: #2e86c1;
  --mpdc-accent: #27ae60;
  --mpdc-warning: #f39c12;
  --mpdc-danger: #e74c3c;
  --mpdc-dark: #2c3e50;
  --mpdc-light: #ecf0f1;
  --mpdc-sidebar-width: 260px;
}

body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: #f4f6f9; }

/* Sidebar */
.mpdc-sidebar {
  position: fixed; top: 0; left: 0; width: var(--mpdc-sidebar-width);
  height: 100vh; background: linear-gradient(180deg, var(--mpdc-primary) 0%, var(--mpdc-dark) 100%);
  color: #fff; overflow-y: auto; z-index: 1000; transition: all .3s;
}
.mpdc-sidebar .brand { padding: 20px 15px; text-align: center; border-bottom: 1px solid rgba(255,255,255,.1); }
.mpdc-sidebar .brand img { width: 50px; height: 50px; border-radius: 50%; margin-bottom: 8px; }
.mpdc-sidebar .brand h5 { font-size: 14px; font-weight: 700; margin: 0; letter-spacing: .5px; }
.mpdc-sidebar .brand small { font-size: 11px; opacity: .7; }
.mpdc-sidebar .nav-section { padding: 10px 0; }
.mpdc-sidebar .nav-section-title { padding: 8px 20px; font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; opacity: .5; font-weight: 700; }
.mpdc-sidebar .nav-link {
  display: flex; align-items: center; padding: 10px 20px; color: rgba(255,255,255,.8);
  text-decoration: none; font-size: 13px; transition: all .2s; border-left: 3px solid transparent;
}
.mpdc-sidebar .nav-link:hover { background: rgba(255,255,255,.1); color: #fff; }
.mpdc-sidebar .nav-link.active { background: rgba(255,255,255,.15); color: #fff; border-left-color: var(--mpdc-accent); font-weight: 600; }
.mpdc-sidebar .nav-link i { width: 20px; margin-right: 10px; font-size: 15px; text-align: center; }

/* Main content */
.mpdc-main { margin-left: var(--mpdc-sidebar-width); padding: 0; min-height: 100vh; }
.mpdc-topbar {
  background: #fff; padding: 12px 25px; display: flex; align-items: center;
  justify-content: space-between; box-shadow: 0 1px 3px rgba(0,0,0,.08); position: sticky; top: 0; z-index: 100;
}
.mpdc-topbar h4 { margin: 0; font-size: 18px; font-weight: 700; color: var(--mpdc-dark); }
.mpdc-content { padding: 25px; }

/* Cards */
.stat-card { border: none; border-radius: 12px; overflow: hidden; transition: transform .2s, box-shadow .2s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(0,0,0,.1); }
.stat-card .card-body { padding: 20px; }
.stat-card .stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; }
.stat-card .stat-value { font-size: 24px; font-weight: 800; color: var(--mpdc-dark); }
.stat-card .stat-label { font-size: 12px; color: #7f8c8d; text-transform: uppercase; letter-spacing: .5px; }

/* Table styles */
.mpdc-table { font-size: 13px; }
.mpdc-table thead th {
  background: var(--mpdc-primary); color: #fff; font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: .5px; padding: 10px 12px; border: none;
  position: sticky; top: 0; z-index: 10;
}
.mpdc-table tbody td { padding: 8px 12px; vertical-align: middle; border-color: #eee; }
.mpdc-table tbody tr:hover { background: #f0f7ff; }
.mpdc-table .amount { text-align: right; font-family: 'Consolas', monospace; font-size: 12px; }
.mpdc-table .total-row { background: #e8f4fd !important; font-weight: 700; }
.mpdc-table .total-row td { border-top: 2px solid var(--mpdc-primary); }

/* Status badges */
.badge-draft { background: #95a5a6; }
.badge-active { background: var(--mpdc-accent); }
.badge-submitted { background: var(--mpdc-secondary); }
.badge-under_review, .badge-reviewed { background: var(--mpdc-warning); color: #333; }
.badge-endorsed { background: #8e44ad; }
.badge-approved { background: var(--mpdc-accent); }
.badge-published { background: var(--mpdc-primary); }
.badge-on_hold { background: var(--mpdc-warning); color: #333; }
.badge-completed { background: var(--mpdc-accent); }
.badge-cancelled { background: var(--mpdc-danger); }

/* Charts */
.chart-card { border: none; border-radius: 12px; }
.chart-card .card-header { background: transparent; border-bottom: 1px solid #eee; font-weight: 600; font-size: 14px; }

/* Sector colors */
.sector-gs { border-left: 4px solid #3498db; }
.sector-ss { border-left: 4px solid #e74c3c; }
.sector-es { border-left: 4px solid #f39c12; }
.sector-enr { border-left: 4px solid #27ae60; }
.sector-is { border-left: 4px solid #9b59b6; }
.sector-ius { border-left: 4px solid #1abc9c; }

/* Workflow steps */
.workflow-step { text-align: center; position: relative; }
.workflow-step .step-circle {
  width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; margin: 0 auto 8px; font-size: 18px; font-weight: 700;
  border: 3px solid #ddd; background: #fff; color: #999; transition: all .3s;
}
.workflow-step.active .step-circle { border-color: var(--mpdc-secondary); background: var(--mpdc-secondary); color: #fff; }
.workflow-step.completed .step-circle { border-color: var(--mpdc-accent); background: var(--mpdc-accent); color: #fff; }
.workflow-step .step-label { font-size: 11px; font-weight: 600; }
.workflow-connector { flex: 1; height: 3px; background: #ddd; margin-top: 24px; }
.workflow-connector.active { background: var(--mpdc-accent); }

/* Filter bar */
.filter-bar { background: #fff; border-radius: 8px; padding: 15px; margin-bottom: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.filter-bar .form-select, .filter-bar .form-control { font-size: 13px; }

/* Modal */
.modal-header { background: var(--mpdc-primary); color: #fff; }
.modal-header .btn-close { filter: invert(1); }

/* Progress bars */
.progress-on-track .progress-bar { background: var(--mpdc-accent); }
.progress-delayed .progress-bar { background: var(--mpdc-warning); }
.progress-critical .progress-bar { background: var(--mpdc-danger); }

/* Amount formatting */
.text-amount { font-family: 'Consolas', 'Courier New', monospace; }
.text-peso::before { content: '₱'; }

/* Responsive */
@media (max-width: 992px) {
  .mpdc-sidebar { transform: translateX(-100%); }
  .mpdc-sidebar.show { transform: translateX(0); }
  .mpdc-main { margin-left: 0; }
}

/* Print */
@media print {
  .mpdc-sidebar, .mpdc-topbar, .no-print { display: none !important; }
  .mpdc-main { margin-left: 0; }
  .mpdc-content { padding: 0; }
}

/* Loading spinner */
.mpdc-loading { display: flex; align-items: center; justify-content: center; padding: 40px; }
.mpdc-loading .spinner-border { width: 3rem; height: 3rem; }

/* CCET indicator */
.ccet-badge { font-size: 10px; padding: 2px 6px; border-radius: 3px; }
.ccet-adaptation { background: #d4efdf; color: #1e8449; }
.ccet-mitigation { background: #d6eaf8; color: #2471a3; }

/* AIP Book */
.aip-book-header { text-align: center; margin-bottom: 30px; }
.aip-book-header h2 { font-size: 16px; font-weight: 700; }
.aip-book-header h3 { font-size: 14px; }
.aip-book-sector { page-break-before: always; margin-top: 20px; }

/* ============================================
   AIP Platform - Submission & Workflow Styles
   ============================================ */

/* Wizard / Multi-step form */
.wizard-progress { display: flex; align-items: center; padding: 20px 0; margin-bottom: 25px; }
.wizard-step {
  flex: 1; text-align: center; position: relative; cursor: pointer;
}
.wizard-step .step-number {
  width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; margin: 0 auto 6px; font-size: 14px; font-weight: 700;
  border: 3px solid #ddd; background: #fff; color: #999; transition: all .3s;
}
.wizard-step.active .step-number { border-color: var(--mpdc-secondary); background: var(--mpdc-secondary); color: #fff; box-shadow: 0 0 0 4px rgba(46,134,193,.2); }
.wizard-step.completed .step-number { border-color: var(--mpdc-accent); background: var(--mpdc-accent); color: #fff; }
.wizard-step .step-title { font-size: 11px; font-weight: 600; color: #999; }
.wizard-step.active .step-title { color: var(--mpdc-secondary); }
.wizard-step.completed .step-title { color: var(--mpdc-accent); }
.wizard-step::after {
  content: ''; position: absolute; top: 20px; left: 50%; width: 100%;
  height: 3px; background: #ddd; z-index: -1;
}
.wizard-step:last-child::after { display: none; }
.wizard-step.completed::after { background: var(--mpdc-accent); }

.wizard-panel { display: none; animation: fadeIn .3s ease; }
.wizard-panel.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.wizard-actions { display: flex; justify-content: space-between; padding: 20px 0; border-top: 1px solid #eee; margin-top: 20px; }

/* Submission status badges (extended) */
.badge-returned { background: #e67e22; color: #fff; }
.badge-completeness_check, .badge-under_review { background: #9b59b6; }
.badge-tech_review { background: #2980b9; }
.badge-budget_review { background: #16a085; }
.badge-validated { background: #27ae60; }
.badge-prioritized { background: #8e44ad; }
.badge-consolidated { background: #2c3e50; }
.badge-included_in_aip { background: #1a5276; }
.badge-deferred { background: #c0392b; }
.badge-for_procurement { background: #d35400; }
.badge-implementing { background: #2ecc71; }
.badge-closed { background: #7f8c8d; }

/* Return remarks alert */
.return-alert {
  background: #fef9e7; border: 1px solid #f9e79f; border-left: 4px solid #f39c12;
  border-radius: 8px; padding: 15px 20px; margin-bottom: 20px;
}
.return-alert .return-icon { font-size: 24px; color: #f39c12; }
.return-alert h6 { color: #d35400; font-weight: 700; margin-bottom: 4px; }

/* Checklist */
.checklist-item { display: flex; align-items: center; padding: 8px 0; border-bottom: 1px solid #f0f0f0; }
.checklist-item:last-child { border-bottom: none; }
.checklist-icon { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin-right: 12px; font-size: 12px; }
.checklist-pass { background: #d5f5e3; color: #27ae60; }
.checklist-fail { background: #fadbd8; color: #e74c3c; }
.checklist-na { background: #eee; color: #999; }

/* Pipeline funnel */
.pipeline-funnel { display: flex; gap: 3px; margin-bottom: 20px; }
.pipeline-stage {
  flex: 1; text-align: center; padding: 12px 8px; border-radius: 6px;
  font-size: 12px; font-weight: 600; position: relative; overflow: hidden;
}
.pipeline-stage .stage-count { font-size: 24px; font-weight: 800; display: block; }
.pipeline-stage .stage-label { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; opacity: .9; }

/* Office health grid */
.office-health-card {
  border-radius: 8px; padding: 12px; margin-bottom: 8px; display: flex;
  align-items: center; justify-content: space-between; border: 1px solid #eee;
  transition: all .2s;
}
.office-health-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.office-health-card.status-active { border-left: 4px solid var(--mpdc-accent); }
.office-health-card.status-submitted { border-left: 4px solid var(--mpdc-secondary); }
.office-health-card.status-needs_revision { border-left: 4px solid var(--mpdc-warning); }
.office-health-card.status-not_submitted { border-left: 4px solid var(--mpdc-danger); background: #fdf2f2; }
.office-health-card.status-drafts_only { border-left: 4px solid #95a5a6; }

/* Scoring matrix */
.score-input { width: 60px; text-align: center; font-weight: 700; font-size: 16px; }
.score-bar { height: 8px; border-radius: 4px; background: #eee; overflow: hidden; }
.score-bar-fill { height: 100%; border-radius: 4px; transition: width .3s; }
.score-high .score-bar-fill { background: var(--mpdc-accent); }
.score-medium .score-bar-fill { background: var(--mpdc-warning); }
.score-low .score-bar-fill { background: var(--mpdc-danger); }

/* Ranking drag handle */
.drag-handle { cursor: grab; color: #bbb; font-size: 18px; padding: 0 8px; }
.drag-handle:hover { color: #666; }
.dragging { opacity: .5; background: #e8f4fd !important; }

/* Milestone timeline */
.milestone-timeline { position: relative; padding-left: 30px; }
.milestone-timeline::before { content: ''; position: absolute; left: 12px; top: 0; bottom: 0; width: 2px; background: #ddd; }
.milestone-item { position: relative; margin-bottom: 20px; }
.milestone-item .milestone-dot {
  position: absolute; left: -24px; top: 4px; width: 14px; height: 14px;
  border-radius: 50%; border: 3px solid #ddd; background: #fff;
}
.milestone-item.completed .milestone-dot { border-color: var(--mpdc-accent); background: var(--mpdc-accent); }
.milestone-item.in_progress .milestone-dot { border-color: var(--mpdc-secondary); background: var(--mpdc-secondary); }
.milestone-item.delayed .milestone-dot { border-color: var(--mpdc-danger); background: var(--mpdc-danger); }

/* Import preview */
.import-preview-row { transition: background .2s; }
.import-preview-row.valid { background: #f0fff0; }
.import-preview-row.warning { background: #fffbe6; }
.import-preview-row.error { background: #fff0f0; }
.import-error-badge { font-size: 10px; }

/* Form required field indicator */
.form-label.required::after { content: ' *'; color: var(--mpdc-danger); font-weight: 700; }

/* Inline validation */
.field-valid { border-color: var(--mpdc-accent) !important; }
.field-invalid { border-color: var(--mpdc-danger) !important; }
.field-warning { border-color: var(--mpdc-warning) !important; }
.validation-msg { font-size: 11px; margin-top: 4px; }
.validation-msg.valid { color: var(--mpdc-accent); }
.validation-msg.invalid { color: var(--mpdc-danger); }

/* Consolidation summary cards */
.summary-metric { text-align: center; padding: 15px; }
.summary-metric .metric-value { font-size: 28px; font-weight: 800; color: var(--mpdc-primary); }
.summary-metric .metric-label { font-size: 11px; color: #7f8c8d; text-transform: uppercase; }

/* Responsive sidebar toggle */
.sidebar-toggle {
  display: none; position: fixed; bottom: 20px; right: 20px; z-index: 1100;
  width: 48px; height: 48px; border-radius: 50%; border: none;
  background: var(--mpdc-primary); color: #fff; font-size: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,.3); cursor: pointer;
}
@media (max-width: 992px) { .sidebar-toggle { display: flex; align-items: center; justify-content: center; } }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; color: #999; }
.empty-state i { font-size: 48px; margin-bottom: 15px; display: block; opacity: .3; }
.empty-state h5 { color: #666; font-weight: 600; }
