@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  /* Color Palette */
  --bg-primary: #0b0f19;
  --bg-secondary: #131b2e;
  --bg-tertiary: #1e293b;
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent: #6366f1;
  --accent-light: #818cf8;
  --accent-dark: #4f46e5;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  --accent-gradient-hover: linear-gradient(135deg, #4f46e5 0%, #9333ea 100%);
  
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.1);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);
  --error: #ef4444;
  --error-bg: rgba(239, 68, 68, 0.1);
  
  --border: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.4);
  
  /* Glassmorphism */
  --glass-bg: rgba(19, 27, 46, 0.7);
  --glass-border: rgba(255, 255, 255, 0.05);
  --glass-backdrop: blur(16px);
  
  /* Shadows & Radius */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.25);
  
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-title: 'Outfit', sans-serif;
  
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base resets & scrollbar */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-title);
  font-weight: 700;
  letter-spacing: -0.02em;
}

a {
  color: var(--accent-light);
  text-decoration: none;
  transition: var(--transition);
}

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

/* Utility Components */
.glass-panel {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--glass-backdrop);
  -webkit-backdrop-filter: var(--glass-backdrop);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.gradient-text {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  outline: none;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  background: var(--accent-gradient-hover);
  transform: translateY(-2px);
  box-shadow: 0 0 25px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--text-secondary);
}

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

.btn-success:hover {
  opacity: 0.9;
  transform: translateY(-2px);
}

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

.btn-danger:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-draft { background: var(--bg-tertiary); color: var(--text-secondary); }
.badge-published { background: var(--warning-bg); color: var(--warning); }
.badge-viewed { background: rgba(99, 102, 241, 0.15); color: var(--accent-light); }
.badge-signed { background: rgba(168, 85, 247, 0.15); color: #c084fc; }
.badge-paid { background: var(--success-bg); color: var(--success); }

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

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--border-focus);
  outline: none;
  background: rgba(15, 23, 42, 0.8);
}

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

/* Layout - Navigation & Container */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  margin-bottom: 30px;
  border-bottom: 1px solid var(--border);
}

.logo {
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo span {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 30px;
}

@media (max-width: 1024px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

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

/* Creator Panel */
.creator-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 768px) {
  .creator-panel {
    grid-template-columns: 1fr;
  }
}

/* List Items (Proposals) */
.proposal-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.proposal-item {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.01);
  cursor: pointer;
  transition: var(--transition);
}

.proposal-item:hover, .proposal-item.active {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.proposal-item-title {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 4px;
}

.proposal-item-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* AI Generator Section */
.ai-generator {
  padding: 20px;
  margin-bottom: 24px;
}

.ai-generator-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 1.2rem;
}

.ai-generator-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .ai-generator-grid {
    grid-template-columns: 1fr;
  }
}

/* Editor Interface */
.editor-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 1200px) {
  .editor-layout {
    grid-template-columns: 1fr;
  }
}

.editor-left, .editor-right {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.editor-card {
  padding: 24px;
}

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

.editor-blocks-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 200px;
}

/* Block Styles in Editor */
.editor-block {
  position: relative;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(15, 23, 42, 0.4);
  transition: var(--transition);
}

.editor-block:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.editor-block-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: var(--transition);
}

.editor-block:hover .editor-block-controls {
  opacity: 1;
}

.block-ctrl-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.8rem;
  transition: var(--transition);
}

.block-ctrl-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.editor-block-type {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--accent-light);
  font-weight: 700;
  margin-bottom: 8px;
}

/* Add Block Toolbar */
.add-block-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  justify-content: center;
  background: rgba(255, 255, 255, 0.005);
}

/* Block Preview */
.preview-container {
  max-height: 80vh;
  overflow-y: auto;
  padding: 24px;
}

/* Client Proposal Page Container */
.proposal-wrapper {
  max-width: 900px;
  margin: 40px auto;
  padding: 0 20px;
}

.proposal-header {
  padding: 40px;
  border-bottom: 1px solid var(--border);
  text-align: center;
  margin-bottom: 30px;
}

.proposal-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-top: 30px;
  text-align: left;
  background: rgba(255, 255, 255, 0.02);
  padding: 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.proposal-meta-item label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  font-weight: 600;
}

.proposal-meta-item span {
  font-weight: 500;
  font-size: 1.1rem;
}

/* Proposal Content Blocks */
.proposal-block {
  margin-bottom: 40px;
  padding: 30px;
  transition: var(--transition);
  border-radius: var(--radius-md);
}

.proposal-block.active-block {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.1);
  background: rgba(255, 255, 255, 0.01);
}

.proposal-block-title {
  font-size: 1.5rem;
  margin-bottom: 16px;
  position: relative;
  padding-bottom: 8px;
}

.proposal-block-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 40px;
  height: 3px;
  background: var(--accent-gradient);
  border-radius: 2px;
}

/* Block specific styling */
.text-block-content {
  font-size: 1.1rem;
  color: #e2e8f0;
  white-space: pre-line;
}

.image-block-img {
  max-width: 100%;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

/* Interactive Pricing Table */
.pricing-table-container {
  overflow-x: auto;
}

.pricing-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.pricing-table th, .pricing-table td {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.pricing-table th {
  font-family: var(--font-title);
  color: var(--text-secondary);
  font-weight: 600;
}

.pricing-table tr.selected {
  background: rgba(99, 102, 241, 0.05);
}

.pricing-table tr.optional-row {
  cursor: pointer;
  transition: var(--transition);
}

.pricing-table tr.optional-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.pricing-checkbox {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 2px solid var(--border);
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pricing-checkbox:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.pricing-checkbox:checked::after {
  content: '✓';
  color: #fff;
  font-size: 12px;
  font-weight: bold;
}

.pricing-total-container {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 20px;
  padding: 24px 16px;
  font-size: 1.25rem;
  font-weight: 700;
}

.pricing-total-val {
  font-family: var(--font-title);
  font-size: 2rem;
  color: var(--success);
}

/* Signature & Approval Block */
.signature-card {
  text-align: center;
}

.signature-pad-container {
  background: #090d16;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  margin: 20px auto;
  max-width: 500px;
  position: relative;
}

.signature-canvas {
  width: 100%;
  height: 200px;
  cursor: crosshair;
  display: block;
}

.signature-pad-controls {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 10px;
  border-top: 1px solid var(--border);
}

.signature-preview-img {
  max-width: 300px;
  border: 1px solid var(--border);
  background: #090d16;
  border-radius: var(--radius-md);
  margin-top: 12px;
}

/* Analytics Panel */
.analytics-card {
  padding: 20px;
  margin-top: 24px;
}

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

.stat-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.stat-val {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--accent-light);
  font-family: var(--font-title);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.analytics-timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 8px;
}

.timeline-event {
  display: flex;
  gap: 12px;
  padding: 10px;
  border-left: 2px solid var(--border);
  margin-left: 8px;
  position: relative;
}

.timeline-event::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 15px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
}

.timeline-event.event-active::before {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

.timeline-event.event-success::before {
  background: var(--success);
}

.timeline-event-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  min-width: 60px;
}

.timeline-event-content {
  font-size: 0.85rem;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
}

.toast {
  background: var(--glass-bg);
  border: 1px solid var(--accent);
  backdrop-filter: var(--glass-backdrop);
  padding: 16px 20px;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-lg);
  animation: toastSlideIn 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28) forwards;
  min-width: 280px;
}

.toast-success {
  border-color: var(--success);
}

@keyframes toastSlideIn {
  from {
    transform: translateY(100px) scale(0.9);
    opacity: 0;
  }
  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

/* Floating Sidebar for Client view */
.client-sidebar {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 99;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (max-width: 768px) {
  .client-sidebar {
    left: 20px;
    right: 20px;
    bottom: 20px;
    flex-direction: row;
    justify-content: space-between;
  }
  
  .client-sidebar .btn {
    flex: 1;
  }
}

/* Setup Overlay modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 30px;
}

/* Animations */
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(99, 102, 241, 0); }
  100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0); }
}

.pulse-primary {
  animation: pulse 2s infinite;
}

/* Fallback message for empty state */
.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* Spinning icon for loading states */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.spin-icon {
  animation: spin 1s linear infinite;
}
