/* InvoiceFlow - Terracotta Theme */
@import url('https://fonts.googleapis.com/css2?family=Merriweather:wght@400;700&family=Nunito+Sans:wght@400;600;700&display=swap');

:root {
  --primary: #C2410C;
  --secondary: #EA580C;
  --accent: #0D9488;
  --background: #FEF2F2;
  --surface: #FFFFFF;
  --text: #7C2D12;
  --text-secondary: #9A3412;
  --border-radius: 10px;
  --sidebar-width: 240px;
  --header-height: 70px;
  --transition: all 0.3s ease;
}

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

body {
  font-family: 'Nunito Sans', sans-serif;
  background-color: var(--background);
  color: var(--text);
  line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Merriweather', serif;
  font-weight: 700;
  color: var(--text);
}

/* Layout */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background-color: var(--surface);
  border-right: 1px solid rgba(194, 65, 12, 0.1);
  display: flex;
  flex-direction: column;
  z-index: 100;
  box-shadow: 2px 0 8px rgba(194, 65, 12, 0.05);
}

.sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(194, 65, 12, 0.1);
}

.sidebar-logo h1 {
  font-size: 24px;
  font-family: 'Merriweather', serif;
  color: var(--primary);
  font-weight: 700;
}

.sidebar-nav {
  flex: 1;
  padding: 20px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  color: var(--text);
  text-decoration: none;
  transition: var(--transition);
  font-weight: 600;
  margin: 4px 12px;
  border-radius: var(--border-radius);
}

.nav-item:hover {
  background-color: var(--secondary);
  color: var(--surface);
}

.nav-item.active {
  background-color: var(--primary);
  color: var(--surface);
}

.nav-item i {
  margin-right: 12px;
  font-size: 20px;
  width: 24px;
  text-align: center;
}

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

/* Header */
.header {
  background-color: var(--surface);
  padding: 20px 32px;
  border-bottom: 1px solid rgba(194, 65, 12, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-height);
  box-shadow: 0 2px 8px rgba(194, 65, 12, 0.05);
}

.header-left h1 {
  font-size: 28px;
  margin-bottom: 4px;
}

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

.date-selector {
  padding: 8px 16px;
  border: 1px solid rgba(194, 65, 12, 0.2);
  border-radius: var(--border-radius);
  background-color: var(--surface);
  color: var(--text);
  font-family: 'Nunito Sans', sans-serif;
  cursor: pointer;
  transition: var(--transition);
}

.date-selector:hover {
  border-color: var(--primary);
}

.notification-bell {
  position: relative;
  font-size: 20px;
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
}

.notification-bell:hover {
  color: var(--primary);
}

.notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background-color: var(--primary);
  color: var(--surface);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 10px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--surface);
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}

.user-avatar:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(194, 65, 12, 0.3);
}

/* Content Area */
.content-area {
  padding: 32px;
  flex: 1;
}

/* Cards */
.card {
  background-color: var(--surface);
  border-radius: var(--border-radius);
  padding: 24px;
  box-shadow: 0 2px 8px rgba(194, 65, 12, 0.08);
  transition: var(--transition);
  margin-bottom: 24px;
}

.card:hover {
  box-shadow: 0 4px 16px rgba(194, 65, 12, 0.12);
}

.card-title {
  font-size: 20px;
  margin-bottom: 16px;
  font-family: 'Merriweather', serif;
  font-weight: 700;
}

/* Metric Cards Grid */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.metric-card {
  background-color: var(--surface);
  border-radius: var(--border-radius);
  padding: 24px;
  box-shadow: 0 2px 8px rgba(194, 65, 12, 0.08);
  transition: var(--transition);
  cursor: pointer;
}

.metric-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 20px rgba(194, 65, 12, 0.15);
}

.metric-label {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 600;
}

.metric-value {
  font-size: 32px;
  font-family: 'Merriweather', serif;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.metric-trend {
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.metric-trend.positive {
  color: var(--accent);
}

.metric-trend.negative {
  color: var(--primary);
}

.metric-trend.warning {
  color: var(--secondary);
}

/* Two Column Layout */
.two-column {
  display: grid;
  grid-template-columns: 60% 40%;
  gap: 24px;
  margin-bottom: 24px;
}

.two-column-equal {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

/* Buttons */
.btn {
  padding: 10px 20px;
  border-radius: var(--border-radius);
  font-family: 'Nunito Sans', sans-serif;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--accent);
  color: var(--surface);
}

.btn-primary:hover {
  background-color: #0a7068;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
}

.btn-secondary {
  background-color: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-secondary:hover {
  background-color: var(--primary);
  color: var(--surface);
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  padding: 4px 8px;
  font-weight: 600;
  text-decoration: none;
}

.btn-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* Table */
.table-container {
  overflow-x: auto;
  border-radius: var(--border-radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--surface);
}

thead {
  background-color: rgba(194, 65, 12, 0.05);
}

th {
  padding: 16px;
  text-align: left;
  font-weight: 700;
  color: var(--text);
  border-bottom: 2px solid rgba(194, 65, 12, 0.1);
  font-size: 14px;
}

td {
  padding: 16px;
  border-bottom: 1px solid rgba(194, 65, 12, 0.05);
}

tr:hover {
  background-color: var(--background);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-paid {
  background-color: rgba(13, 148, 136, 0.1);
  color: var(--accent);
}

.badge-overdue {
  background-color: rgba(194, 65, 12, 0.1);
  color: var(--primary);
}

.badge-sent {
  background-color: rgba(234, 88, 12, 0.1);
  color: var(--secondary);
}

.badge-draft {
  background-color: rgba(124, 45, 18, 0.1);
  color: var(--text-secondary);
}

/* Search Bar */
.search-bar {
  display: flex;
  align-items: center;
  background-color: var(--surface);
  border: 1px solid rgba(194, 65, 12, 0.2);
  border-radius: var(--border-radius);
  padding: 8px 16px;
  gap: 8px;
  flex: 1;
  max-width: 400px;
}

.search-bar input {
  border: none;
  outline: none;
  background: none;
  font-family: 'Nunito Sans', sans-serif;
  color: var(--text);
  flex: 1;
}

.search-bar i {
  color: var(--text-secondary);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 32px;
  border-bottom: 2px solid rgba(194, 65, 12, 0.1);
  margin-bottom: 24px;
}

.tab {
  padding: 12px 4px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
  position: relative;
  cursor: pointer;
  transition: var(--transition);
}

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

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

.tab.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--primary);
}

.tab-badge {
  background-color: rgba(194, 65, 12, 0.1);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  margin-left: 8px;
}

/* Filter Dropdown */
.filter-dropdown {
  position: relative;
  display: inline-block;
}

.filter-btn {
  padding: 8px 16px;
  border: 1px solid rgba(194, 65, 12, 0.2);
  border-radius: var(--border-radius);
  background-color: var(--surface);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Nunito Sans', sans-serif;
  font-weight: 600;
}

.filter-btn:hover {
  border-color: var(--primary);
}

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

.timeline-item {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  padding: 16px;
  background-color: rgba(255, 255, 255, 0.5);
  border-radius: var(--border-radius);
  border-left: 4px solid var(--accent);
  transition: var(--transition);
}

.timeline-item:hover {
  background-color: var(--surface);
  box-shadow: 0 2px 8px rgba(194, 65, 12, 0.1);
}

.timeline-item.overdue {
  border-left-color: var(--primary);
}

.timeline-item.due-soon {
  border-left-color: var(--secondary);
}

/* AI Recommendation Item */
.recommendation-item {
  padding: 16px;
  border: 1px solid rgba(194, 65, 12, 0.1);
  border-radius: var(--border-radius);
  margin-bottom: 12px;
  transition: var(--transition);
}

.recommendation-item:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(13, 148, 136, 0.1);
}

.recommendation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.recommendation-title {
  font-weight: 700;
  color: var(--text);
}

.confidence-score {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.recommendation-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(124, 45, 18, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background-color: var(--surface);
  border-radius: var(--border-radius);
  padding: 32px;
  max-width: 800px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(194, 65, 12, 0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(194, 65, 12, 0.1);
}

.modal-title {
  font-size: 24px;
  font-family: 'Merriweather', serif;
  font-weight: 700;
}

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

.modal-close:hover {
  color: var(--primary);
}

/* Form Elements */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--text);
}

.form-input {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid rgba(194, 65, 12, 0.2);
  border-radius: var(--border-radius);
  font-family: 'Nunito Sans', sans-serif;
  color: var(--text);
  background-color: var(--surface);
  transition: var(--transition);
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(194, 65, 12, 0.1);
}

.form-select {
  width: 100%;
  padding: 10px 16px;
  border: 1px solid rgba(194, 65, 12, 0.2);
  border-radius: var(--border-radius);
  font-family: 'Nunito Sans', sans-serif;
  color: var(--text);
  background-color: var(--surface);
  cursor: pointer;
}

textarea.form-input {
  min-height: 100px;
  resize: vertical;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(194, 65, 12, 0.2);
  transition: var(--transition);
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: var(--surface);
  transition: var(--transition);
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: var(--accent);
}

input:checked + .toggle-slider:before {
  transform: translateX(26px);
}

/* Accordion */
.accordion-item {
  border: 1px solid rgba(194, 65, 12, 0.1);
  border-radius: var(--border-radius);
  margin-bottom: 12px;
  overflow: hidden;
}

.accordion-header {
  padding: 16px;
  background-color: rgba(194, 65, 12, 0.02);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  transition: var(--transition);
}

.accordion-header:hover {
  background-color: rgba(194, 65, 12, 0.05);
}

.accordion-content {
  padding: 16px;
  border-top: 1px solid rgba(194, 65, 12, 0.1);
}

/* Progress Steps */
.progress-steps {
  display: flex;
  justify-content: space-between;
  margin-bottom: 32px;
  position: relative;
}

.progress-steps::before {
  content: '';
  position: absolute;
  top: 20px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: rgba(194, 65, 12, 0.2);
  z-index: 0;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 1;
}

.step-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--surface);
  border: 2px solid rgba(194, 65, 12, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--text-secondary);
}

.progress-step.active .step-circle {
  background-color: var(--primary);
  border-color: var(--primary);
  color: var(--surface);
}

.progress-step.completed .step-circle {
  background-color: var(--accent);
  border-color: var(--accent);
  color: var(--surface);
}

.step-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Chart Containers */
.chart-container {
  position: relative;
  height: 300px;
  margin-top: 16px;
}

.chart-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.1), rgba(234, 88, 12, 0.1));
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-style: italic;
}

/* Client Header */
.client-header {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: var(--surface);
  padding: 32px;
  border-radius: var(--border-radius);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.client-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background-color: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  color: var(--primary);
}

.client-info h1 {
  color: var(--surface);
  margin-bottom: 8px;
}

.client-stats {
  display: flex;
  gap: 32px;
  margin-top: 16px;
}

.client-stat-item {
  display: flex;
  flex-direction: column;
}

.client-stat-label {
  font-size: 12px;
  opacity: 0.9;
}

.client-stat-value {
  font-size: 20px;
  font-weight: 700;
  font-family: 'Merriweather', serif;
}

/* Risk Score Indicator */
.risk-score-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  position: relative;
  background: conic-gradient(var(--accent) 0deg, var(--accent) 270deg, rgba(194, 65, 12, 0.1) 270deg);
}

.risk-score-inner {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background-color: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.risk-score-value {
  font-size: 32px;
  font-weight: 700;
  font-family: 'Merriweather', serif;
  color: var(--accent);
}

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

/* Action Menu */
.action-menu {
  position: relative;
  display: inline-block;
}

.action-menu-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 18px;
  transition: var(--transition);
}

.action-menu-btn:hover {
  color: var(--primary);
}

/* Floating Card */
.floating-card {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 320px;
  background-color: var(--surface);
  border-radius: var(--border-radius);
  padding: 20px;
  box-shadow: 0 8px 24px rgba(194, 65, 12, 0.2);
  z-index: 50;
}

/* Inspector Panel */
.inspector-panel {
  position: fixed;
  right: 0;
  top: 0;
  width: 300px;
  height: 100vh;
  background-color: var(--surface);
  border-left: 1px solid rgba(194, 65, 12, 0.1);
  padding: 24px;
  overflow-y: auto;
  box-shadow: -2px 0 8px rgba(194, 65, 12, 0.05);
}

/* Template Card */
.template-card {
  border: 1px solid rgba(194, 65, 12, 0.1);
  border-radius: var(--border-radius);
  padding: 20px;
  margin-bottom: 16px;
  transition: var(--transition);
  cursor: pointer;
}

.template-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.1);
  transform: translateY(-2px);
}

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

.template-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.template-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.template-stat {
  display: flex;
  flex-direction: column;
}

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

.template-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

/* Success Rate Bar */
.success-rate-bar {
  width: 100%;
  height: 8px;
  background-color: rgba(194, 65, 12, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 8px;
}

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

/* Back Button */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  margin-bottom: 16px;
  transition: var(--transition);
}

.back-btn:hover {
  color: var(--primary);
}

/* Utility Classes */
.text-primary { color: var(--primary); }
.text-secondary { color: var(--text-secondary); }
.text-accent { color: var(--accent); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-gap { gap: 16px; }
.ai-icon {
  color: var(--accent);
  margin-right: 4px;
}

/* Responsive */
@media (max-width: 1024px) {
  .two-column {
    grid-template-columns: 1fr;
  }
  
  .two-column-equal {
    grid-template-columns: 1fr;
  }
  
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .metrics-grid {
    grid-template-columns: 1fr;
  }
  
  .content-area {
    padding: 16px;
  }
}
