/* CSS Variables for theming */
:root {
  --accent-blue: #4a90e2;
  --accent-dark: #3a78c2;
  --bg-primary: #f8f9fa;
  --bg-secondary: #ffffff;
  --text-primary: #2c3e50;
  --text-secondary: #6c757d;
  --text-light: #adb5bd;
  --border-light: #e9ecef;
  --border-medium: #dee2e6;
  --shadow-light: 0 2px 4px rgba(0,0,0,0.05);
  --shadow-medium: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-heavy: 0 8px 24px rgba(0,0,0,0.15);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --sidebar-width: 280px;
}

/* Dark mode variables */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #1a1d23;
    --bg-secondary: #2d3748;
    --text-primary: #f7fafc;
    --text-secondary: #cbd5e0;
    --text-light: #a0aec0;
    --border-light: #4a5568;
    --border-medium: #718096;
  }
}

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

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

/* Sidebar Styles */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-light);
  box-shadow: var(--shadow-light);
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-header {
  padding: 1.5rem 1rem;
  border-bottom: 1px solid var(--border-light);
}

.sidebar-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

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

.nav-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.75rem 1rem;
  border: none;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  font-size: 0.95rem;
  text-align: left;
}

.nav-item:hover {
  background: var(--bg-primary);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-blue);
  color: white;
}

.nav-icon {
  font-size: 1.2rem;
  margin-right: 0.75rem;
  width: 24px;
  display: inline-block;
  text-align: center;
}

.nav-text {
  font-weight: 500;
}

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

.theme-section {
  margin-bottom: 1rem;
}

.theme-selector-container {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 1rem;
  border: 1px solid var(--border-light);
}

.theme-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.theme-icon {
  font-size: 1rem;
}

.theme-selector {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.9rem;
  cursor: pointer;
  margin-bottom: 1rem;
}

.theme-previews {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.theme-preview {
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  transition: background-color 0.2s ease;
  text-align: center;
}

.theme-preview:hover {
  background: var(--border-light);
}

.preview-colors {
  display: flex;
  height: 20px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 0.25rem;
}

.preview-color {
  flex: 1;
}

.preview-name {
  font-size: 0.7rem;
  color: var(--text-secondary);
  display: block;
}

.upgrade-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.upgrade-card {
  padding: 1rem;
  border-radius: var(--radius-md);
  text-align: center;
}

.upgrade-card.monetization {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.upgrade-card.ai-features {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  color: white;
}

.upgrade-card h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.upgrade-card p {
  font-size: 0.8rem;
  opacity: 0.9;
  margin-bottom: 0.75rem;
}

.btn-upgrade, .btn-ai {
  background: rgba(255,255,255,0.25);
  border: 1px solid rgba(255,255,255,0.4);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.2s ease;
  font-weight: 600;
}

.btn-upgrade:hover, .btn-ai:hover {
  background: rgba(255,255,255,0.4);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.upgrade-card.preview-mode {
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
  color: white;
}

.upgrade-card.preview-mode .btn-preview {
  background: rgba(255,255,255,0.25);
  border: 1px solid rgba(255,255,255,0.4);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.upgrade-card.preview-mode .btn-preview:hover {
  background: rgba(255,255,255,0.4);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 2rem;
  background: var(--bg-primary);
  min-height: 100vh;
}

.module-container {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-medium);
  padding: 2rem;
  min-height: calc(100vh - 4rem);
}

/* AI Suggestions Panel */
.ai-suggestions {
  position: fixed;
  top: 2rem;
  right: 2rem;
  width: 300px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-heavy);
  border: 1px solid var(--border-light);
  z-index: 1000;
  display: none;
}

.ai-suggestions.show {
  display: block;
  animation: slideIn 0.3s ease-out;
}

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

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

.suggestion-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.close-suggestions {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.close-suggestions:hover {
  background: var(--bg-primary);
  color: var(--text-primary);
}

.suggestion-content {
  padding: 1rem;
}

.suggestion-item {
  margin-bottom: 1rem;
}

.suggestion-item h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.suggestion-item p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Utility Classes */
.card {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-light);
  padding: 1.5rem;
  border: 1px solid var(--border-light);
}

.btn {
  background: var(--accent-blue);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

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

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

/* Responsive Design */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
    padding: 1rem;
  }
  
  .ai-suggestions {
    right: 1rem;
    left: 1rem;
    width: auto;
  }
}

/* Loading states */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-primary);
  opacity: 0.3;
  animation: pulse 1.5s ease-in-out infinite;
}