/**
 * ExecClone Finance Module Styles
 */

/* ============================================
   MODULE CONTAINER
   ============================================ */

.finance-module {
  padding: 20px;
}

/* ============================================
   SUB-NAVIGATION
   ============================================ */

.finance-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
  padding: 12px;
  background: var(--card, #11151b);
  border-radius: 12px;
  border: 1px solid var(--border, #202734);
}

.finance-nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted, #a6b0bf);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.finance-nav-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text, #e9eef5);
}

.finance-nav-btn.active {
  background: var(--accent, #b7f7d2);
  color: #000;
  border-color: var(--accent, #b7f7d2);
}

.finance-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: #ef4444;
  color: white;
  font-size: 11px;
  font-weight: 600;
  border-radius: 10px;
}

.finance-nav-btn.active .finance-badge {
  background: rgba(0, 0, 0, 0.3);
  color: #000;
}

/* ============================================
   CONTENT VIEWS
   ============================================ */

.finance-content {
  position: relative;
}

.finance-subview {
  display: none;
}

.finance-subview.active {
  display: block;
}

/* ============================================
   LOADING STATE
   ============================================ */

.finance-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--muted, #a6b0bf);
}

.finance-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border, #202734);
  border-top-color: var(--accent, #b7f7d2);
  border-radius: 50%;
  animation: finance-spin 1s linear infinite;
  margin-bottom: 16px;
}

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

/* ============================================
   GRID LAYOUT
   ============================================ */

.finance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.reports-grid {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

/* ============================================
   CARDS
   ============================================ */

.finance-card {
  background: var(--card, #11151b);
  border: 1px solid var(--border, #202734);
  border-radius: 12px;
  padding: 24px;
}

.finance-card h3 {
  margin: 0 0 16px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text, #e9eef5);
}

.finance-card.warning {
  border-color: #f59e0b;
}

.finance-card.alert {
  border-color: #ef4444;
}

.finance-card.clickable {
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s;
}

.finance-card.clickable:hover {
  transform: translateY(-2px);
  border-color: var(--accent, #b7f7d2);
}

/* ============================================
   BIG NUMBERS
   ============================================ */

.finance-big-number {
  font-size: 32px;
  font-weight: 700;
  color: var(--accent, #b7f7d2);
  margin-bottom: 12px;
}

/* ============================================
   METRICS
   ============================================ */

.finance-metrics {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.finance-metric {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
}

.finance-metric .label {
  color: var(--muted, #a6b0bf);
  font-size: 14px;
}

.finance-metric .value {
  font-weight: 600;
  font-size: 16px;
}

.finance-metric .value.positive {
  color: #22c55e;
}

.finance-metric .value.negative {
  color: #ef4444;
}

.finance-metric.highlight {
  background: rgba(183, 247, 210, 0.1);
  border: 1px solid rgba(183, 247, 210, 0.3);
}

.finance-metric.alert {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.finance-count {
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted, #a6b0bf);
}

/* ============================================
   ALERT SUMMARY
   ============================================ */

.finance-alert-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.finance-alert-summary span {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
}

.finance-alert-summary .critical {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.finance-alert-summary .high {
  background: rgba(249, 115, 22, 0.2);
  color: #f97316;
}

.finance-alert-summary .medium {
  background: rgba(250, 204, 21, 0.2);
  color: #facc15;
}

.finance-alert-summary .low {
  background: rgba(156, 163, 175, 0.2);
  color: #9ca3af;
}

/* ============================================
   SUCCESS & ERROR STATES
   ============================================ */

.finance-success {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: #22c55e;
  font-size: 18px;
  font-weight: 500;
}

.finance-error {
  padding: 20px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  color: #ef4444;
  text-align: center;
}

/* ============================================
   EMPTY STATES
   ============================================ */

.finance-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted, #a6b0bf);
}

.finance-empty .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.finance-empty h3 {
  margin: 0 0 8px 0;
  color: var(--text, #e9eef5);
}

/* ============================================
   BUTTONS
   ============================================ */

.finance-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  background: var(--accent, #b7f7d2);
  color: #000;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.finance-btn:hover {
  opacity: 0.9;
}

.finance-btn.secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text, #e9eef5);
}

.finance-btn.small {
  padding: 6px 12px;
  font-size: 12px;
}

/* ============================================
   TABLES
   ============================================ */

.finance-table-wrap {
  overflow-x: auto;
  margin: -4px;
  padding: 4px;
}

.finance-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.finance-table th,
.finance-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border, #202734);
}

.finance-table th {
  color: var(--muted, #a6b0bf);
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.finance-table td {
  color: var(--text, #e9eef5);
}

.finance-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* ============================================
   STATUS BADGES
   ============================================ */

.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============================================
   LISTS
   ============================================ */

.finance-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.finance-list-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
  background: var(--card, #11151b);
  border: 1px solid var(--border, #202734);
  border-radius: 10px;
}

.finance-list-item.critical {
  border-left: 4px solid #ef4444;
}

.finance-list-item.high {
  border-left: 4px solid #f97316;
}

.finance-list-item.medium {
  border-left: 4px solid #facc15;
}

.finance-list-item.low {
  border-left: 4px solid #9ca3af;
}

.item-severity,
.item-priority {
  font-size: 20px;
}

.item-content {
  flex: 1;
  min-width: 0;
}

.item-title {
  font-weight: 600;
  color: var(--text, #e9eef5);
  margin-bottom: 4px;
}

.item-type {
  font-size: 12px;
  color: var(--accent, #b7f7d2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.item-desc,
.item-reason {
  font-size: 14px;
  color: var(--muted, #a6b0bf);
  margin-bottom: 8px;
}

.item-meta,
.item-date {
  font-size: 12px;
  color: var(--muted, #a6b0bf);
}

.item-meta {
  display: flex;
  gap: 16px;
}

.item-actions {
  display: flex;
  gap: 8px;
}

/* ============================================
   UPLOAD ZONE
   ============================================ */

.finance-upload-zone {
  border: 2px dashed var(--border, #202734);
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.finance-upload-zone:hover {
  border-color: var(--accent, #b7f7d2);
  background: rgba(183, 247, 210, 0.05);
}

.upload-content {
  color: var(--muted, #a6b0bf);
}

.upload-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.upload-hint {
  font-size: 13px;
  margin-top: 12px;
}

.finance-upload-preview {
  margin-top: 24px;
  padding: 24px;
  background: var(--card, #11151b);
  border: 1px solid var(--border, #202734);
  border-radius: 12px;
}

.finance-upload-preview.hidden,
.finance-upload-result.hidden {
  display: none;
}

.preview-note {
  font-size: 12px;
  color: var(--muted, #a6b0bf);
  margin: 12px 0;
}

.finance-upload-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

/* ============================================
   SECTIONS
   ============================================ */

.finance-section {
  margin-bottom: 32px;
}

.finance-section h2 {
  margin: 0 0 20px 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--text, #e9eef5);
}

.finance-section h3 {
  margin: 0 0 16px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text, #e9eef5);
}

.finance-desc {
  color: var(--muted, #a6b0bf);
  margin-bottom: 20px;
}

/* ============================================
   CATEGORY LIST
   ============================================ */

.finance-category-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.finance-category-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--card, #11151b);
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

.finance-category-row .name {
  flex: 1;
  font-weight: 500;
}

.finance-category-row .amount {
  font-weight: 600;
  color: var(--accent, #b7f7d2);
}

.finance-category-row .bar {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  background: var(--accent, #b7f7d2);
  opacity: 0.5;
}

/* ============================================
   SUMMARY BAR
   ============================================ */

.finance-summary-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  padding: 20px 24px;
  background: var(--card, #11151b);
  border: 1px solid var(--border, #202734);
  border-radius: 12px;
  margin-bottom: 24px;
}

.summary-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.summary-stat .label {
  font-size: 12px;
  color: var(--muted, #a6b0bf);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.summary-stat .value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text, #e9eef5);
}

/* ============================================
   REPORTS
   ============================================ */

.finance-report-output {
  margin-top: 32px;
  padding: 24px;
  background: var(--card, #11151b);
  border: 1px solid var(--border, #202734);
  border-radius: 12px;
}

.finance-report-output.hidden {
  display: none;
}

.finance-report .report-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border, #202734);
}

.finance-report .report-header h2 {
  margin: 0 0 4px 0;
}

.finance-report .report-header p {
  margin: 0;
  color: var(--muted, #a6b0bf);
}

.finance-report .report-section {
  margin-bottom: 24px;
}

.finance-report .report-section h3 {
  margin: 0 0 12px 0;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.finance-report ul {
  margin: 0;
  padding-left: 20px;
}

.finance-report li {
  margin: 8px 0;
  color: var(--text, #e9eef5);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  .finance-nav {
    flex-direction: column;
  }
  
  .finance-nav-btn {
    justify-content: flex-start;
  }
  
  .finance-grid {
    grid-template-columns: 1fr;
  }
  
  .finance-summary-bar {
    flex-direction: column;
    gap: 16px;
  }
  
  .item-actions {
    flex-direction: column;
  }
}

/* Document Upload Styles */
.document-upload-area {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 40px;
  text-align: center;
  transition: all 0.2s ease;
  background: rgba(255,255,255,0.02);
}

.document-upload-area:hover,
.document-upload-area.dragover {
  border-color: var(--accent);
  background: rgba(183, 247, 210, 0.05);
}

.document-upload-area .upload-icon {
  font-size: 48px;
  margin-bottom: 10px;
}

.document-entity-selector {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 15px;
  padding: 15px;
  background: var(--card);
  border-radius: 8px;
  flex-wrap: wrap;
}

.document-entity-selector select,
.document-entity-selector input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
}

.entity-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  text-transform: capitalize;
}

.entity-badge.general { background: #6b7280; }
.entity-badge.transaction { background: #3b82f6; }
.entity-badge.invoice { background: #8b5cf6; }
.entity-badge.subscription { background: #22c55e; }

.finance-btn.small {
  padding: 4px 8px;
  font-size: 12px;
}

.finance-btn.danger {
  background: #ef4444;
}

.finance-btn.danger:hover {
  background: #dc2626;
}

.finance-btn.secondary {
  background: #6b7280;
}

/* PDF Extraction Modal */
.extraction-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.extraction-modal-content {
  background: var(--card, #11151b);
  border: 1px solid var(--border, #202734);
  border-radius: 12px;
  width: 90%;
  max-width: 700px;
  max-height: 85vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

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

.extraction-header h3 {
  margin: 0;
  font-size: 18px;
}

.extraction-header .close-btn {
  background: none;
  border: none;
  color: var(--muted, #a6b0bf);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.extraction-header .close-btn:hover {
  color: var(--text, #e9eef5);
}

.extraction-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.extraction-results {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.extraction-section {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  padding: 16px;
}

.extraction-section h4 {
  margin: 0 0 12px 0;
  font-size: 14px;
  color: var(--accent, #b7f7d2);
}

.extraction-section p {
  margin: 8px 0;
  font-size: 14px;
}

.extracted-text {
  width: 100%;
  min-height: 150px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border, #202734);
  border-radius: 6px;
  color: var(--muted, #a6b0bf);
  font-family: monospace;
  font-size: 12px;
  padding: 12px;
  resize: vertical;
}

.extraction-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding-top: 10px;
  border-top: 1px solid var(--border, #202734);
}
