/* CMSF CDDS - Admin Panel Styles */
:root {
  --primary: #1a365d;
  --primary-light: #2c5282;
  --primary-dark: #0f2440;
  --secondary: #2b6cb0;
  --accent: #3182ce;
  --success: #38a169;
  --warning: #d69e2e;
  --danger: #e53e3e;
  --info: #3182ce;
  --bg-main: #f7fafc;
  --bg-sidebar: #1a365d;
  --bg-card: #ffffff;
  --text-primary: #2d3748;
  --text-secondary: #718096;
  --text-light: #a0aec0;
  --border: #e2e8f0;
  --sidebar-width: 260px;
  --header-height: 64px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  color: #fff;
  z-index: 1000;
  overflow-y: auto;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-header img {
  height: 40px;
  width: auto;
}

.sidebar-header .brand {
  flex: 1;
}

.sidebar-header .brand h2 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1.3;
}

.sidebar-header .brand p {
  font-size: 10px;
  opacity: 0.6;
  margin-top: 2px;
}

.sidebar-nav {
  padding: 8px 0;
}

.nav-section {
  margin-bottom: 4px;
}

.nav-section-title {
  padding: 12px 20px 6px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.4);
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  gap: 10px;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.nav-item.active {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-left-color: var(--accent);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  opacity: 0.8;
}

.nav-item .coming-soon {
  font-size: 9px;
  background: rgba(255,255,255,0.15);
  padding: 1px 6px;
  border-radius: 8px;
  margin-left: auto;
}

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

/* Header */
.header {
  height: var(--header-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-primary);
}

.header-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-badge {
  background: var(--primary);
  color: #fff;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
}

/* Page Content */
.page-content {
  padding: 24px;
}

.page-section {
  display: none;
}

.page-section.active {
  display: block;
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  transition: box-shadow 0.2s;
}

.kpi-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.kpi-card .kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.kpi-card .kpi-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-card .kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.kpi-card .kpi-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.kpi-card .kpi-sub {
  font-size: 12px;
  color: var(--text-secondary);
}

.kpi-icon.blue { background: #ebf8ff; color: var(--accent); }
.kpi-icon.green { background: #f0fff4; color: var(--success); }
.kpi-icon.yellow { background: #fffff0; color: var(--warning); }
.kpi-icon.red { background: #fff5f5; color: var(--danger); }
.kpi-icon.purple { background: #faf5ff; color: #805ad5; }

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 20px;
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header h3 {
  font-size: 15px;
  font-weight: 600;
}

.card-body {
  padding: 20px;
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

table th {
  background: #f7fafc;
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

table td {
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

table tbody tr:hover {
  background: #f7fafc;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-draft { background: #edf2f7; color: #4a5568; }
.badge-received { background: #ebf8ff; color: #2b6cb0; }
.badge-validating { background: #fffff0; color: #b7791f; }
.badge-validated { background: #f0fff4; color: #276749; }
.badge-success, .badge-balanced { background: #f0fff4; color: #276749; }
.badge-warning { background: #fffff0; color: #b7791f; }
.badge-danger, .badge-failed { background: #fff5f5; color: #c53030; }
.badge-pending { background: #fffff0; color: #b7791f; }
.badge-approved, .badge-ready, .badge-completed { background: #ebf8ff; color: #2b6cb0; }
.badge-submitted, .badge-processing { background: #faf5ff; color: #6b46c1; }
.badge-paid, .badge-settled { background: #f0fff4; color: #276749; }
.badge-returned { background: #fff5f5; color: #c53030; }
.badge-undistributed { background: #fffff0; color: #b7791f; }
.badge-resolved { background: #f0fff4; color: #276749; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-light);
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover {
  background: #2f855a;
}

.btn-warning {
  background: var(--warning);
  color: #fff;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
}

.btn-outline:hover {
  background: #f7fafc;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}

/* Pipeline Stepper */
.pipeline {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 20px;
  overflow-x: auto;
}

.pipeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 100px;
  position: relative;
}

.pipeline-step .step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #a0aec0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

.pipeline-step.completed .step-circle {
  background: var(--success);
  color: #fff;
}

.pipeline-step.active .step-circle {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(49, 130, 206, 0.2);
}

.pipeline-step .step-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: center;
}

.pipeline-step.completed .step-label,
.pipeline-step.active .step-label {
  color: var(--text-primary);
  font-weight: 600;
}

.pipeline-arrow {
  font-size: 16px;
  color: #cbd5e0;
  margin-bottom: 20px;
}

.pipeline-step.completed + .pipeline-arrow {
  color: var(--success);
}

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.tab {
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* File Upload Zone */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.upload-zone:hover {
  border-color: var(--accent);
  background: #ebf8ff;
}

.upload-zone svg {
  width: 48px;
  height: 48px;
  color: var(--text-light);
  margin-bottom: 12px;
}

.upload-zone h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}

.upload-zone p {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-card);
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

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

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-secondary);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Toast */
.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: slideIn 0.3s ease;
  min-width: 300px;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--info); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Reconciliation Matrix */
.recon-matrix {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.recon-box {
  background: #f7fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
}

.recon-box h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.recon-box .value {
  font-size: 28px;
  font-weight: 700;
}

.recon-matched { border-color: var(--success); }
.recon-matched .value { color: var(--success); }
.recon-exception { border-color: var(--danger); }
.recon-exception .value { color: var(--danger); }

/* Certificate */
.certificate {
  background: #fff;
  border: 3px double var(--primary);
  border-radius: 8px;
  padding: 40px;
  text-align: center;
  position: relative;
}

.certificate::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  bottom: 8px;
  border: 1px solid var(--primary);
  border-radius: 4px;
  pointer-events: none;
}

.certificate .cert-logo {
  height: 60px;
  margin-bottom: 16px;
}

.certificate h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
}

.certificate h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.certificate .cert-details {
  text-align: left;
  margin: 20px 0;
}

.certificate .cert-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px dotted var(--border);
  font-size: 13px;
}

.certificate .cert-row .label {
  color: var(--text-secondary);
}

.certificate .cert-row .value {
  font-weight: 600;
}

/* Timeline */
.timeline {
  padding: 0 20px;
}

.timeline-item {
  display: flex;
  gap: 16px;
  padding-bottom: 20px;
  position: relative;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 24px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item:last-child::before {
  display: none;
}

.timeline-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  flex-shrink: 0;
}

.timeline-content {
  flex: 1;
}

.timeline-content .time {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.timeline-content .action {
  font-size: 13px;
  font-weight: 500;
}

.timeline-content .detail {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* Search */
.search-box {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.search-box input {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
}

.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

/* Grid layouts */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

/* Progress Bar */
.progress-bar {
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar .fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.5s ease;
}

/* Data Source Toggle */
.data-source-toggle {
  display: flex;
  gap: 16px;
  padding: 16px;
  background: #f7fafc;
  border-radius: 8px;
  margin-bottom: 20px;
}

.data-source-toggle label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}

.data-source-toggle input[type="radio"] {
  accent-color: var(--accent);
}

/* Fund Summary */
.fund-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.fund-item {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.fund-item .label {
  font-size: 13px;
  color: var(--text-secondary);
}

.fund-item .value {
  font-size: 13px;
  font-weight: 600;
}

/* Status Summary */
.status-summary {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #f7fafc;
  border-radius: 8px;
}

.status-item .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.status-item .count {
  font-size: 14px;
  font-weight: 700;
}

.status-item .label {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Demo Banner */
.demo-banner {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: #fff;
  padding: 12px 24px;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
}

.demo-banner strong {
  font-weight: 700;
}

/* Responsive */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .menu-toggle {
    display: block;
  }
  
  .grid-2, .grid-3, .recon-matrix, .fund-summary {
    grid-template-columns: 1fr;
  }
  
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  
  .pipeline {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .pipeline-arrow {
    display: none;
  }
}

/* Scrolling */
.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 2px;
}

/* Print styles */
@media print {
  .sidebar, .header, .demo-banner {
    display: none !important;
  }
  
  .main-content {
    margin-left: 0 !important;
  }
  
  .certificate {
    border: 3px double #1a365d;
  }
}
