/* Google Fonts */
@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');

/* Design System & Variables */
:root {
  --font-title: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  /* Color Palette - Premium Violet & Deep Blue Dark Mode */
  --bg-main: #06070B;
  --bg-card: rgba(15, 17, 28, 0.7);
  --bg-card-hover: rgba(22, 25, 41, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(138, 79, 255, 0.5);
  
  --primary: #8A4FFF;
  --primary-glow: rgba(138, 79, 255, 0.35);
  --primary-hover: #9D6BFF;
  --secondary: #1F2035;
  
  --text-main: #F1F5F9;
  --text-muted: #94A3B8;
  --text-inverse: #0F172A;
  
  --success: #10B981;
  --success-glow: rgba(16, 185, 129, 0.2);
  --warning: #F59E0B;
  --warning-glow: rgba(245, 158, 11, 0.2);
  --danger: #EF4444;
  --danger-glow: rgba(239, 68, 68, 0.2);
  --info: #3B82F6;
  --info-glow: rgba(59, 130, 246, 0.2);
  
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-body);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(138, 79, 255, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(59, 130, 246, 0.06) 0%, transparent 45%);
  background-attachment: fixed;
}

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

/* Sidebar Navigation */
.sidebar {
  width: 280px;
  background: rgba(10, 12, 22, 0.95);
  border-right: 1px solid var(--border-color);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 100;
  backdrop-filter: blur(20px);
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 48px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary) 0%, #3B82F6 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px var(--primary-glow);
}

.logo-icon svg {
  width: 22px;
  height: 22px;
  fill: #fff;
}

.logo-text {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff 30%, var(--text-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  width: 100%;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
  cursor: pointer;
  border: 1px solid transparent;
}

.nav-link svg {
  width: 20px;
  height: 20px;
  transition: var(--transition-fast);
}

.nav-link:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
}

.nav-item.active .nav-link {
  color: #fff;
  background: rgba(138, 79, 255, 0.15);
  border-color: rgba(138, 79, 255, 0.25);
  box-shadow: inset 0 0 12px rgba(138, 79, 255, 0.05);
}

.nav-item.active .nav-link svg {
  color: var(--primary);
  filter: drop-shadow(0 0 5px var(--primary-glow));
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--danger);
  box-shadow: 0 0 8px var(--danger-glow);
}

.status-dot.connected {
  background-color: var(--success);
  box-shadow: 0 0 8px var(--success-glow);
}

/* Main Content Area */
.main-content {
  margin-left: 280px;
  flex: 1;
  padding: 48px 56px;
  max-width: 1200px;
}

.tab-pane {
  display: none;
  animation: fadeIn 0.4s ease;
}

.tab-pane.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Typography & Headers */
h1 {
  font-family: var(--font-title);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.page-description {
  color: var(--text-muted);
  font-size: 16px;
  margin-bottom: 32px;
}

/* Cards & Glassmorphism */
.glass-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  margin-bottom: 24px;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.glass-card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.12);
}

/* Form Styles */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.form-grid-full {
  grid-column: span 2;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.form-group label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

.form-group label span {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 12px;
}

.form-control {
  background: rgba(10, 12, 22, 0.5);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  color: #fff;
  font-family: var(--font-body);
  font-size: 15px;
  transition: var(--transition-fast);
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background: rgba(10, 12, 22, 0.8);
}

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

.form-row {
  display: flex;
  gap: 16px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 28px;
  font-family: var(--font-title);
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition-normal);
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 6px 20px var(--primary-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--secondary);
  border-color: var(--border-color);
  color: var(--text-main);
}

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

.btn-success {
  background: var(--success);
  color: #fff;
  box-shadow: 0 4px 15px var(--success-glow);
}

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

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

/* Dashboard / Planner Cards */
.planner-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
}

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

.planner-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: var(--transition-normal);
  position: relative;
}

.planner-card:hover {
  transform: translateY(-4px);
  border-color: rgba(138, 79, 255, 0.25);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.01);
}

.card-day {
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 700;
}

.card-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: uppercase;
}

.badge-reel {
  background: rgba(138, 79, 255, 0.15);
  color: #c096ff;
  border: 1px solid rgba(138, 79, 255, 0.3);
}

.badge-carousel {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.card-body {
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card-title {
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
}

.card-hook {
  font-size: 14px;
  color: var(--text-muted);
  border-left: 2px solid var(--primary);
  padding-left: 12px;
  font-style: italic;
}

.card-tabs-nav {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  gap: 16px;
}

.card-tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  padding-bottom: 8px;
  cursor: pointer;
  transition: var(--transition-fast);
  border-bottom: 2px solid transparent;
}

.card-tab-btn:hover {
  color: var(--text-main);
}

.card-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.card-tab-content {
  font-size: 14px;
  min-height: 80px;
  max-height: 150px;
  overflow-y: auto;
}

.caption-variation {
  display: none;
}

.caption-variation.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

.card-hashtags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.hashtag {
  font-size: 12px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.hashtag:hover {
  background: var(--primary-glow);
  color: #fff;
}

.card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.01);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}

.status-indicator::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-draft { color: var(--warning); }
.status-draft::before { background-color: var(--warning); box-shadow: 0 0 6px var(--warning-glow); }

.status-approved { color: var(--success); }
.status-approved::before { background-color: var(--success); box-shadow: 0 0 6px var(--success-glow); }

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

.btn-icon {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

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

.btn-icon.approve-btn:hover {
  color: var(--success);
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.1);
}

.btn-icon svg {
  width: 16px;
  height: 16px;
}

/* Loading Overlay & State */
.loading-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(6, 7, 11, 0.85);
  backdrop-filter: blur(10px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 24px;
}

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(138, 79, 255, 0.1);
  border-left-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  box-shadow: 0 0 20px var(--primary-glow);
}

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

.loading-status-text {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 600;
  text-align: center;
}

.loading-subtext {
  color: var(--text-muted);
  font-size: 14px;
  max-width: 300px;
  text-align: center;
}

/* Output Display for Markdown (Analysis / Strategy) */
.markdown-output {
  font-size: 15px;
  color: #E2E8F0;
}

.markdown-output h2 {
  font-family: var(--font-title);
  font-size: 22px;
  font-weight: 700;
  margin-top: 24px;
  margin-bottom: 12px;
  color: #fff;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 6px;
}

.markdown-output h3 {
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 600;
  margin-top: 18px;
  margin-bottom: 8px;
  color: var(--text-main);
}

.markdown-output p {
  margin-bottom: 14px;
}

.markdown-output ul, .markdown-output ol {
  margin-bottom: 16px;
  padding-left: 20px;
}

.markdown-output li {
  margin-bottom: 6px;
}

.markdown-output blockquote {
  border-left: 4px solid var(--primary);
  background: rgba(138, 79, 255, 0.05);
  padding: 12px 18px;
  margin-bottom: 16px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
}

/* Dialog / Modals */
dialog {
  background: #0B0D18;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 32px;
  color: var(--text-main);
  max-width: 500px;
  width: 90%;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.8);
  margin: auto;
  outline: none;
}

dialog::backdrop {
  background-color: rgba(6, 7, 11, 0.8);
  backdrop-filter: blur(8px);
}

dialog h3 {
  font-family: var(--font-title);
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 12px;
}

dialog p {
  color: var(--text-muted);
  margin-bottom: 20px;
  font-size: 14px;
}

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

.toast {
  background: #111322;
  border-left: 4px solid var(--primary);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  min-width: 300px;
  transform: translateY(100px);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

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

.toast-message {
  font-size: 14px;
  font-weight: 500;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Responsive */
@media (max-width: 1024px) {
  .app-container {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    padding: 20px 24px;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  
  .logo-container {
    margin-bottom: 24px;
  }
  
  .nav-menu {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 8px;
  }
  
  .main-content {
    margin-left: 0;
    padding: 32px 24px;
  }
  
  .calendar-grid {
    grid-template-columns: 1fr;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }
  
  .form-grid-full {
    grid-column: span 1;
  }
  
  .sidebar-footer {
    display: none;
  }
}
