:root {
  --primary: #3B82F6;
  --primary-dark: #2563EB;
  --primary-light: #60A5FA;
  --secondary: #8B5CF6;
  --secondary-dark: #7C3AED;
  --success: #10B981;
  --success-dark: #059669;
  --danger: #EF4444;
  --danger-dark: #DC2626;
  --warning: #F59E0B;
  --background: #F8FAFC;
  --background-alt: #FFFFFF;
  --text: #0F172A;
  --text-light: #64748B;
  --text-lighter: #94A3B8;
  --border: #E2E8F0;
  --border-light: #F1F5F9;
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --gradient-primary: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);
  --gradient-success: linear-gradient(135deg, #10B981 0%, #059669 100%);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Inter', sans-serif;
  background: linear-gradient(135deg, #F8FAFC 0%, #F1F5F9 100%);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  width: 280px;
  background: var(--background-alt);
  border-right: 1px solid var(--border-light);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);
}

.sidebar-brand {
  font-size: 1.25rem;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: #6b7280;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.sidebar-close:hover {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
  transform: rotate(90deg) scale(1.1);
}

.sidebar-close svg {
  transition: all 0.25s;
}

.sidebar-menu {
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.5rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-left: 3px solid transparent;
  position: relative;
  margin: 0 0.5rem;
  border-radius: var(--radius-sm);
}

.sidebar-link svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
  transition: all 0.25s;
  color: inherit;
}

.sidebar-link:hover {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.08) 0%, rgba(59, 130, 246, 0.03) 100%);
  color: #3b82f6;
  border-left-color: #3b82f6;
  transform: translateX(4px);
}

.sidebar-link:hover svg {
  color: #3b82f6;
  transform: scale(1.1);
}

.sidebar-link.active {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.15) 0%, rgba(59, 130, 246, 0.05) 100%);
  color: #2563eb;
  font-weight: 600;
  border-left-color: #2563eb;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

.sidebar-link.active svg {
  color: #2563eb;
  stroke-width: 2.5;
}

.sidebar-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
}

.sidebar-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-light);
  background: var(--background-alt);
}

.sidebar-logout {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  background: rgba(239, 68, 68, 0.05);
  border: 2px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius-sm);
  color: #dc2626;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.95rem;
}

.sidebar-logout svg {
  transition: all 0.25s;
  color: inherit;
}

.sidebar-logout:hover {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  border-color: #dc2626;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

.sidebar-logout:hover svg {
  transform: translateX(2px);
}

/* Top bar with menu toggle */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-md);
  border-bottom: 1px solid var(--border-light);
  z-index: 999;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 1rem;
}

.sidebar-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: #374151;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
}

.sidebar-toggle:hover {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
  transform: scale(1.1);
}

.sidebar-toggle:active {
  transform: scale(0.95);
}

.sidebar-toggle svg {
  transition: all 0.25s;
}

.topbar-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

/* Overlay for sidebar */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.sidebar-overlay.open {
  opacity: 1;
  visibility: visible;
}

.nav-link {
  text-decoration: none;
  color: var(--text);
  font-weight: 500;
  transition: color 0.2s;
}

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

.btn-logout {
  background: none;
  border: none;
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
  padding: 0;
}

/* Main content */
.main-content {
  margin-left: 0;
  margin-top: 64px;
  padding: 2rem;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: calc(100vh - 64px);
}

.main-content.with-sidebar {
  margin-left: 280px;
}

@media (max-width: 1024px) {
  .main-content.with-sidebar {
    margin-left: 0;
  }
}

/* Login Page */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);
  padding: 0.5rem;
}

.login-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-width: 1000px;
  width: 100%;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  min-height: auto;
}

.login-left {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid var(--border-light);
}

.login-brand h1 {
  font-size: 1.75rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
  margin-top: 0;
}

.login-subtitle {
  color: var(--text-light);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  line-height: 1.4;
}

.login-features {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text);
  font-size: 0.9rem;
}

.feature-item svg {
  color: var(--primary);
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.login-right {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 100%;
  max-width: 380px;
}

.login-card-header {
  text-align: center;
  margin-bottom: 1.25rem;
}

.login-card-header h2 {
  font-size: 1.5rem;
  color: var(--text);
  margin-bottom: 0.25rem;
  margin-top: 0;
}

.login-card-header p {
  color: var(--text-light);
  font-size: 0.85rem;
  margin: 0;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.login-divider {
  display: flex;
  align-items: center;
  margin: 1rem 0;
  text-align: center;
}

.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border);
}

.login-divider span {
  padding: 0 0.75rem;
  color: var(--text-light);
  font-size: 0.8rem;
}

.login-footer {
  text-align: center;
  margin-top: 1rem;
}

.login-footer p {
  color: var(--text-light);
  font-size: 0.85rem;
  margin: 0;
}

.link-primary {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}

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

.btn-block {
  width: 100%;
  justify-content: center;
}

.btn-large {
  padding: 1rem 2rem;
  font-size: 1.1rem;
}

@media (max-width: 968px) {
  .login-wrapper {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  
  .login-left {
    display: none;
  }
  
  .login-right {
    padding: 1.25rem;
  }
}

@media (max-width: 768px) {
  .login-page {
    padding: 0.5rem;
  }
  
  .login-wrapper {
    border-radius: var(--radius);
    min-height: auto;
  }
  
  .login-right {
    padding: 1rem;
  }
  
  .login-left {
    padding: 1.25rem;
  }
  
  .login-card-header h2 {
    font-size: 1.35rem;
  }
  
  .login-brand h1 {
    font-size: 1.5rem;
  }
  
  .login-card-header {
    margin-bottom: 1rem;
  }
  
  .login-form {
    gap: 0.875rem;
  }
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.375rem;
  font-weight: 500;
  font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 0.875rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  background: var(--background-alt);
  transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
  background: white;
}

.form-footer {
  text-align: center;
  margin-top: 1rem;
  color: var(--text-light);
}

.form-footer a {
  color: var(--primary);
  text-decoration: none;
}

/* Icons */
.icon {
  width: 20px;
  height: 20px;
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

.icon-sm {
  width: 16px;
  height: 16px;
}

.icon-lg {
  width: 24px;
  height: 24px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

/* Buttons */
.btn {
  padding: 0.875rem 1.75rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
  width: 300px;
  height: 300px;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 4px 14px 0 rgba(59, 130, 246, 0.39);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 rgba(59, 130, 246, 0.5);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn-secondary {
  background: #f9fafb;
  color: #374151;
  border: 2px solid #e5e7eb;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-secondary:hover {
  background: #f3f4f6;
  border-color: #3b82f6;
  color: #2563eb;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.btn-secondary:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.btn-danger {
  background: var(--danger);
  color: white;
  box-shadow: 0 4px 14px 0 rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: var(--danger-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 rgba(239, 68, 68, 0.4);
}

.btn-generate {
  background: var(--gradient-success);
  color: white;
  box-shadow: 0 4px 14px 0 rgba(16, 185, 129, 0.3);
}

.btn-generate:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 rgba(16, 185, 129, 0.4);
}

/* Dashboard */
.dashboard {
  max-width: 1400px;
  margin: 0 auto;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 3rem;
}

.stat-card {
  background: var(--background-alt);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--gradient-primary);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.stat-card h3 {
  font-size: 0.875rem;
  color: var(--text-light);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 2rem;
  font-weight: bold;
  color: var(--primary);
}

.stat-detail {
  font-size: 0.875rem;
  color: var(--text-light);
  margin-top: 0.5rem;
}

/* Stats Page */
.stats-page {
  max-width: 1400px;
  margin: 0 auto;
}

.stats-section {
  margin-bottom: 3rem;
}

.stats-section h2 {
  color: var(--primary);
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border-light);
}

.users-stats-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.user-stats-card {
  background: var(--background-alt);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
  padding: 1.5rem;
  transition: all 0.3s;
}

.user-stats-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.user-stats-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.user-stats-header > div:first-child {
  flex: 1;
}

.user-stats-header h3 {
  margin: 0 0 0.5rem 0;
  color: var(--text);
  font-size: 1.25rem;
}

.user-stats-actions {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

.user-meta {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.875rem;
  color: var(--text-light);
}

.user-email {
  color: var(--primary);
  font-weight: 500;
}

.user-role-badge {
  background: var(--background);
  color: var(--text);
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--border);
}

.user-role-badge.admin-badge {
  background: var(--gradient-primary);
  color: white;
  border: none;
}

.user-date {
  color: var(--text-light);
}

.user-stats-content {
  margin-top: 1rem;
}

.user-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.user-stat-item {
  text-align: center;
  padding: 1rem;
  background: white;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.user-stat-item strong {
  display: block;
  color: var(--text-light);
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.user-stat-value {
  font-size: 1.75rem;
  font-weight: bold;
  color: var(--primary);
  margin-bottom: 0.25rem;
}

.user-stat-detail {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 0.25rem;
}

/* Impersonation Banner */
.impersonation-banner {
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  color: white;
  padding: 1rem 1.5rem;
  z-index: 998;
  box-shadow: var(--shadow-md);
  animation: slideDown 0.3s ease-out;
}

.impersonation-banner-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.impersonation-banner-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
}

.impersonation-banner-info svg {
  flex-shrink: 0;
}

.impersonation-banner-info strong {
  font-weight: 600;
}

.impersonation-banner .btn-secondary {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.3);
  color: white;
}

.impersonation-banner .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
  color: white;
}

.main-content.with-impersonation {
  margin-top: 120px;
}

@media (max-width: 768px) {
  .user-stats-grid {
    grid-template-columns: 1fr;
  }
  
  .user-meta {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .user-stats-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .user-stats-actions {
    width: 100%;
  }
  
  .user-stats-actions .btn {
    width: 100%;
  }
  
  .impersonation-banner-content {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .impersonation-banner .btn {
    width: 100%;
  }
}

.recent-posts h2 {
  margin-bottom: 1rem;
}

.posts-list {
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.post-item {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.post-item:last-child {
  border-bottom: none;
}

.post-item h4 {
  margin-bottom: 0.5rem;
}

.post-meta {
  color: var(--text-light);
  font-size: 0.875rem;
}

/* Post Form */
.post-form-container {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-width: 900px;
  margin: 0 auto;
}

.form-intro {
  color: var(--text-light);
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

.form-section {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.form-section:last-of-type {
  border-bottom: none;
}

.form-section-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--primary);
}

.post-form {
  margin-bottom: 2rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-hint {
  display: block;
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 0.25rem;
  margin-top: 0.25rem;
}

.required {
  color: #EF4444;
}

.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 1rem;
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
}

.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 2px solid var(--border);
}

.btn-large {
  padding: 1rem 2rem;
  font-size: 1.1rem;
}

@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .form-actions {
    flex-direction: column;
  }
  
  .btn-large {
    width: 100%;
  }
}

/* My Posts */
.my-posts {
  max-width: 1400px;
  margin: 0 auto;
}

.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.post-card {
  background: white;
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}

.post-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.post-card h3 {
  margin-bottom: 0.5rem;
}

.post-type {
  display: inline-block;
  background: var(--secondary);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
}

/* Cluster Accordion */
.cluster-accordion {
  background: var(--background-alt);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  margin-bottom: 1.5rem;
  overflow: hidden;
  border: 1px solid var(--border-light);
  transition: all 0.3s;
}

.cluster-accordion:hover {
  box-shadow: var(--shadow-lg);
}

.accordion-header {
  padding: 1.5rem 2rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #F8FAFC 0%, #FFFFFF 100%);
  transition: all 0.3s;
  border-bottom: 2px solid var(--border-light);
}

.accordion-header:hover {
  background: linear-gradient(135deg, #F1F5F9 0%, #F8FAFC 100%);
}

.accordion-header-content {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
}

.accordion-icon {
  width: 24px;
  height: 24px;
  color: var(--primary);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.accordion-icon.open {
  transform: rotate(90deg);
}

.accordion-title {
  flex: 1;
}

.accordion-title h3 {
  margin: 0;
  color: var(--text);
  font-size: 1.25rem;
}

.cluster-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: var(--gradient-primary);
  color: white;
  padding: 0.375rem 0.875rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 0.5rem;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.accordion-meta {
  color: var(--text-light);
  font-size: 0.875rem;
}

.accordion-content {
  padding: 0;
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
  }
  to {
    opacity: 1;
    max-height: 2000px;
  }
}

/* Article Items */
.article-item {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border-light);
  transition: all 0.3s;
  background: var(--background-alt);
}

.article-item:last-child {
  border-bottom: none;
}

.article-item:hover {
  background: var(--background);
}

.pillar-item {
  background: linear-gradient(to right, rgba(37, 99, 235, 0.05), transparent);
  border-left: 4px solid var(--primary);
}

.satellite-item {
  padding-left: 2.5rem;
  border-left: 4px solid var(--secondary);
  background: linear-gradient(to right, rgba(124, 58, 237, 0.03), transparent);
}

.standalone-item {
  border-left: 4px solid var(--border);
}

.article-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.article-item-info {
  flex: 1;
}

.article-item-info h4 {
  margin: 0 0 0.5rem 0;
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 600;
}

.article-item-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  color: var(--text-light);
  font-size: 0.875rem;
}

.article-item-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
  color: #6b7280;
}

.btn-icon svg {
  transition: all 0.25s;
  color: inherit;
}

.btn-icon:hover {
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
  transform: scale(1.15);
}

.btn-icon:active {
  transform: scale(1.05);
}

.btn-icon.btn-danger {
  color: #dc2626;
}

.btn-icon.btn-danger:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #b91c1c;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
}

.btn-icon.btn-generate {
  color: #059669;
}

.btn-icon.btn-generate:hover {
  background: rgba(16, 185, 129, 0.15);
  color: #047857;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.btn-icon.btn-publish {
  color: #7c3aed;
}

.btn-icon.btn-publish:hover {
  background: rgba(139, 92, 246, 0.15);
  color: #6d28d9;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.2);
}

.btn-icon.btn-images {
  color: #3b82f6;
}

.btn-icon.btn-images:hover {
  background: rgba(59, 130, 246, 0.15);
  color: #2563eb;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.btn-icon:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.satellites-list {
  padding: 1rem 0;
}

.satellites-title {
  margin: 0 0 1rem 1.5rem;
  color: var(--secondary);
  font-size: 1rem;
  font-weight: 600;
}

.standalone-posts {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 2px solid var(--border);
}

.standalone-posts h2 {
  color: var(--text);
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
}

/* Legacy - use .empty-state instead */
.no-posts {
  text-align: center;
  padding: 3rem;
  color: var(--text-light);
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.post-words,
.post-date {
  color: var(--text-light);
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
}

.post-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
}

/* Profil */
.profil-card {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

/* Utilities */
.loading {
  text-align: center;
  padding: 2rem;
  color: var(--text-light);
}

/* Loading Container */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  text-align: center;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1.5rem;
}

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

.loading-spinner-small {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  vertical-align: middle;
  margin-right: 0.5rem;
}

.loading-text h3 {
  color: var(--primary);
  margin-bottom: 0.5rem;
  font-size: 1.25rem;
}

.loading-text p {
  color: var(--text-light);
  margin: 0.5rem 0;
}

.loading-detail {
  font-size: 0.9rem;
  font-style: italic;
  color: var(--text-light);
}

.error-message {
  color: #EF4444;
  margin-top: 1rem;
  padding: 0.75rem;
  background: #FEE2E2;
  border-radius: 4px;
  display: none;
}

.error-message:not(:empty) {
  display: block;
}

.success-message {
  color: var(--success);
  margin-top: 1rem;
  padding: 0.75rem;
  background: #D1FAE5;
  border-radius: 4px;
}

.error {
  color: #EF4444;
  text-align: center;
  padding: 2rem;
}

/* Cluster Results */
.form-result {
  margin-top: 2rem;
}

.cluster-result {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-top: 2rem;
}

.pillar-article {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 2px solid var(--border);
}

.pillar-article h2 {
  color: var(--primary);
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
}

.article-preview {
  background: var(--background);
  padding: 1.5rem;
  border-radius: 8px;
  border-left: 4px solid var(--primary);
}

.article-preview h3 {
  color: var(--text);
  margin-bottom: 1rem;
  font-size: 1.25rem;
}

.article-meta {
  color: var(--text-light);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.article-content-preview {
  color: var(--text);
  line-height: 1.8;
  white-space: pre-wrap;
}

.satellites-list {
  margin-top: 2rem;
}

.satellites-list h2 {
  color: var(--secondary);
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
}

.satellites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.satellite-card {
  background: var(--background);
  padding: 1.5rem;
  border-radius: 8px;
  border-left: 4px solid var(--secondary);
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
}

.satellite-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.satellite-number {
  position: absolute;
  top: -12px;
  left: 1rem;
  background: var(--secondary);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.875rem;
}

.satellite-card h4 {
  color: var(--text);
  margin-top: 0.5rem;
  margin-bottom: 0.75rem;
  font-size: 1.1rem;
}

.satellite-meta {
  color: var(--text-light);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.satellite-content-preview {
  color: var(--text);
  line-height: 1.6;
  font-size: 0.9rem;
  white-space: pre-wrap;
}

.result-actions {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Edit Post Form */
.edit-post-container {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-width: 1000px;
}

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

.edit-post-header h1 {
  color: var(--primary);
  font-size: 1.75rem;
  margin: 0;
}

.edit-post-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.edit-post-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.edit-post-form label {
  font-weight: 600;
  color: var(--text);
}

.edit-post-form input[type="text"],
.edit-post-form input[type="number"],
.edit-post-form textarea {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

.edit-post-form input[type="text"]:focus,
.edit-post-form input[type="number"]:focus,
.edit-post-form textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.edit-post-form input:disabled {
  background-color: var(--background);
  color: var(--text-light);
  cursor: not-allowed;
}

.edit-post-form textarea {
  resize: vertical;
  min-height: 200px;
}

.edit-post-form #editContent {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.9rem;
  line-height: 1.6;
}

.edit-post-form .form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

#editError {
  margin-top: 1rem;
}

#editSuccess {
  margin-top: 1rem;
}

/* Post Popup */
.post-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 2rem;
  animation: fadeIn 0.2s;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.post-popup {
  background: white;
  border-radius: 8px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  max-width: 900px;
  max-height: 90vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s;
}

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

.post-popup-header {
  padding: 1.5rem;
  border-bottom: 2px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.post-popup-header h2 {
  margin: 0;
  color: var(--primary);
  font-size: 1.5rem;
}

.post-popup-content {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.post-popup-meta {
  color: var(--text-light);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.post-popup-body {
  color: var(--text);
  line-height: 1.8;
}

.post-popup-body h1 {
  font-size: 2rem;
  margin: 1.5rem 0 1rem 0;
  color: var(--primary);
}

.post-popup-body h2 {
  font-size: 1.5rem;
  margin: 1.25rem 0 0.75rem 0;
  color: var(--text);
}

.post-popup-body h3 {
  font-size: 1.25rem;
  margin: 1rem 0 0.5rem 0;
  color: var(--text);
}

.post-popup-body p {
  margin: 0.75rem 0;
}

.post-popup-footer {
  padding: 1.5rem;
  border-top: 2px solid var(--border);
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

/* Pending Badge */
.pending-badge {
  display: inline-block;
  background: #FEF3C7;
  color: #92400E;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
}

/* Generate Button */
.btn-generate {
  background: var(--success) !important;
  color: white !important;
}

.btn-generate:hover {
  background: #059669 !important;
}

.btn-generate:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Responsive */
@media (max-width: 1024px) {
  .sidebar {
    box-shadow: var(--shadow-xl);
  }
  
  .main-content.with-sidebar {
    margin-left: 0;
  }
}

@media (max-width: 768px) {
  .sidebar {
    width: 100%;
    max-width: 320px;
  }
  
  .main-content {
    padding: 1rem;
  }
  
  .topbar {
    padding: 0 1rem;
  }
}

  .main-content {
    padding: 0 1rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .posts-grid {
    grid-template-columns: 1fr;
  }

  .post-popup {
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .post-popup-overlay {
    padding: 0;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .blog-card-header {
    flex-direction: column;
    gap: 1rem;
  }

  .modal-overlay {
    padding: 1rem;
  }
}

/* WordPress Blogs */
.my-blogs {
  max-width: 1400px;
  margin: 0 auto;
}

.blogs-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.blog-card {
  background: var(--background-alt);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
  padding: 1.5rem;
  transition: all 0.3s;
}

.blog-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.blog-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.blog-info h3 {
  margin: 0 0 0.5rem 0;
  color: var(--text);
  font-size: 1.25rem;
}

.blog-domain {
  color: var(--primary);
  font-weight: 500;
  margin: 0.25rem 0;
}

.blog-meta {
  color: var(--text-light);
  font-size: 0.875rem;
  margin-top: 0.5rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.blog-actions {
  display: flex;
  gap: 0.5rem;
}

.blog-categories {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-light);
}

.blog-categories h4 {
  font-size: 0.875rem;
  color: var(--text-light);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.categories-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.category-badge {
  display: inline-block;
  background: var(--background);
  color: var(--text);
  padding: 0.375rem 0.75rem;
  border-radius: 20px;
  font-size: 0.875rem;
  border: 1px solid var(--border);
}

.category-badge small {
  color: var(--text-light);
  font-size: 0.75rem;
}

/* Connection Status */
.connection-status {
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.connection-status.status-connected {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
}

.connection-status.status-disconnected {
  background: rgba(239, 68, 68, 0.1);
  color: #DC2626;
}

/* Alert Styles */
.alert {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}

.alert-warning {
  background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
  border: 2px solid #F59E0B;
  color: #92400E;
}

.alert-warning strong {
  color: #92400E;
  display: block;
  margin-bottom: 0.25rem;
}

.alert-warning span {
  color: #78350F;
  font-size: 0.9rem;
}

/* Empty State Component - Design System */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  background: var(--background-alt);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
  max-width: 600px;
  margin: 2rem auto;
}

.empty-state-icon {
  margin: 0 auto 2rem;
  width: 80px;
  height: 80px;
  opacity: 0.5;
  color: var(--text-light);
}

.empty-state-icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  stroke-width: 1.5;
}

.empty-state-title {
  color: var(--text);
  margin-bottom: 1rem;
  font-size: 1.5rem;
  font-weight: 600;
}

.empty-state-description {
  color: var(--text-light);
  margin-bottom: 2rem;
  font-size: 1rem;
  line-height: 1.6;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.empty-state-action {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.empty-state-action .btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* Legacy support - deprecated, use .empty-state instead */
.no-blogs, .no-categories {
  text-align: center;
  padding: 2rem;
  color: var(--text-light);
}

/* Page Layout Components */
.page-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1rem;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--border-light);
}

.page-header > div:first-child {
  flex: 1;
}

.page-header h1 {
  margin: 0 0 0.5rem 0;
  color: var(--primary);
  font-size: 1.75rem;
  font-weight: 600;
}

.page-description {
  color: var(--text-light);
  font-size: 1rem;
  margin: 0;
  line-height: 1.5;
}

.page-header-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-shrink: 0;
}

/* Content Cards */
.content-card {
  background: var(--background-alt);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
  padding: 1.5rem;
  transition: all 0.3s;
}

.content-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

/* Legacy - deprecated */
.no-posts-message {
  margin: 2rem 0;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 2rem;
  animation: fadeIn 0.2s;
}

.modal-content {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-xl);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s;
}

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

.modal-header h2 {
  margin: 0;
  color: var(--primary);
}

.modal-form {
  padding: 1.5rem;
}

.modal-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-light);
}

.modal-actions .btn {
  flex: 1;
}

/* Pillar Ideas Page */
.pillar-ideas-page {
  max-width: 1400px;
  margin: 0 auto;
}


.ideas-form-container {
  margin-bottom: 2rem;
}

.form-card {
  background: var(--background-alt);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
}

.form-card h2 {
  color: var(--primary);
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
}

.ideas-result {
  margin-top: 2rem;
}

.ideas-context {
  background: var(--background-alt);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
  border-left: 4px solid var(--primary);
}

.ideas-context h3 {
  color: var(--primary);
  margin-bottom: 1rem;
  font-size: 1.25rem;
}

.context-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.context-item {
  padding: 0.75rem;
  background: white;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.context-item strong {
  color: var(--primary);
  display: block;
  margin-bottom: 0.25rem;
}

.ideas-list h3 {
  color: var(--text);
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
}

.ideas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
}

.idea-card {
  background: var(--background-alt);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
  position: relative;
  transition: all 0.3s;
}

.idea-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.idea-number {
  position: absolute;
  top: -12px;
  left: 1.5rem;
  background: var(--gradient-primary);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.875rem;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.idea-title {
  color: var(--text);
  margin: 0.5rem 0 1rem 0;
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.4;
}

.idea-description {
  color: var(--text);
  margin-bottom: 1rem;
  line-height: 1.6;
  font-size: 0.95rem;
}

.idea-justification {
  background: var(--background);
  padding: 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  border-left: 3px solid var(--secondary);
}

.idea-justification strong {
  color: var(--secondary);
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.idea-justification p {
  color: var(--text);
  margin: 0;
  line-height: 1.6;
  font-size: 0.9rem;
}

.idea-actions {
  display: flex;
  gap: 0.5rem;
}

.no-ideas-message {
  text-align: center;
  padding: 3rem;
  background: var(--background-alt);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.no-ideas-message h3 {
  color: var(--text);
  margin-bottom: 1rem;
}

.no-ideas-message p {
  color: var(--text-light);
  margin-bottom: 1.5rem;
}

/* Ideas History */
.ideas-history-section {
  margin-bottom: 2rem;
  background: var(--background-alt);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
}

.ideas-history-section h2 {
  color: var(--primary);
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
}

.ideas-history-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.history-item {
  background: white;
  padding: 1.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  transition: all 0.3s;
}

.history-item:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.history-meta {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.history-date {
  color: var(--text-light);
  font-size: 0.875rem;
}

.history-badge {
  background: var(--gradient-primary);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.history-filter {
  background: var(--background);
  color: var(--text);
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  border: 1px solid var(--border);
}

.history-context {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-light);
}

.context-summary {
  color: var(--text-light);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.history-ideas-preview {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.history-ideas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

.preview-idea-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem;
  background: var(--background);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--secondary);
}

.preview-idea-item strong {
  color: var(--secondary);
  margin-right: 0.5rem;
}

.preview-more {
  color: var(--text-light);
  font-size: 0.875rem;
  font-style: italic;
  text-align: center;
  padding: 0.5rem;
}

@media (max-width: 768px) {
  .ideas-grid {
    grid-template-columns: 1fr;
  }
  
  .context-info {
    grid-template-columns: 1fr;
  }

  .history-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .history-ideas-grid {
    grid-template-columns: 1fr;
  }
}

/* Image Selection */
.images-selection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
  max-height: 60vh;
  overflow-y: auto;
  padding: 1rem;
}

.image-selection-card {
  position: relative;
  background: white;
  border-radius: var(--radius);
  overflow: hidden;
  border: 3px solid var(--border-light);
  transition: all 0.3s;
  cursor: pointer;
}

.image-selection-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.image-selection-card.selected {
  border-color: var(--success);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.image-selection-card.recommended {
  border-color: var(--warning);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.05) 0%, rgba(255, 255, 255, 1) 100%);
}

.image-selection-card.main-image {
  border-color: var(--success);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, rgba(255, 255, 255, 1) 100%);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.image-selection-checkbox {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 10;
}

.image-selection-checkbox input[type="checkbox"] {
  width: 24px;
  height: 24px;
  cursor: pointer;
  accent-color: var(--success);
}

.image-selection-badge {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 0.375rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  z-index: 10;
}

.image-selection-badge.recommended-badge {
  background: var(--warning);
  color: white;
  font-weight: 700;
}

.image-selection-badge.main-image-badge {
  background: var(--success);
  color: white;
  font-weight: 700;
  top: 3.5rem;
}

.image-selection-badge.secondary-image-badge {
  background: var(--primary);
  color: white;
  top: 3.5rem;
}

.image-selection-preview {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.image-selection-info {
  padding: 1rem;
  background: var(--background);
}

.image-selection-source {
  font-size: 0.875rem;
  color: var(--text-light);
  margin-bottom: 0.5rem;
}

.image-selection-score {
  font-size: 0.875rem;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.image-selection-description {
  font-size: 0.875rem;
  color: var(--text);
  margin-top: 0.5rem;
  font-style: italic;
}

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

/* Ebook Status & Progress */
.ebook-status {
  background: var(--background-alt);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
  padding: 2rem;
  margin: 2rem 0;
  animation: slideDown 0.3s ease-out;
}

.status-header {
  margin-bottom: 1.5rem;
}

.status-header h2 {
  color: var(--primary);
  margin-bottom: 1rem;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.progress-bar {
  width: 100%;
  height: 12px;
  background: var(--border-light);
  border-radius: 6px;
  overflow: hidden;
  margin: 1rem 0;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.progress-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: 6px;
  transition: width 0.5s ease-out;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
  position: relative;
  overflow: hidden;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.progress-text {
  color: var(--text);
  font-size: 1rem;
  font-weight: 500;
  margin-top: 0.75rem;
  line-height: 1.6;
}

.progress-text strong {
  color: var(--primary);
  font-size: 1.1rem;
}

.progress-text small {
  display: block;
  margin-top: 0.25rem;
  color: var(--text-light);
  font-size: 0.9rem;
}

.status-details {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-light);
}

.status-image {
  text-align: center;
  margin-bottom: 1rem;
}

.status-image img {
  max-width: 200px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 2px solid var(--border-light);
}

.status-image p {
  margin-top: 0.5rem;
  color: var(--text-light);
  font-size: 0.9rem;
}

.chapters-progress {
  background: var(--background);
  padding: 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.status-complete {
  text-align: center;
  padding: 2rem;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(5, 150, 105, 0.05) 100%);
  border-radius: var(--radius);
  border: 2px solid var(--success);
}

.status-complete p {
  font-size: 1.25rem;
  color: var(--success-dark);
  font-weight: 600;
  margin-bottom: 1rem;
}

.status-complete .btn {
  margin-top: 1rem;
}

.btn-success {
  background: var(--gradient-success);
  color: white;
  box-shadow: 0 4px 14px 0 rgba(16, 185, 129, 0.39);
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 rgba(16, 185, 129, 0.5);
}

/* Ebook Cards */
.ebooks-list {
  margin-top: 3rem;
}

.ebooks-list h2 {
  color: var(--primary);
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
}

.ebook-card {
  background: var(--background-alt);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-light);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: all 0.3s;
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.ebook-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  border-color: var(--primary);
}

.ebook-cover {
  flex-shrink: 0;
  width: 120px;
  height: 160px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}

.ebook-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ebook-cover .placeholder {
  width: 100%;
  height: 100%;
  background: var(--background);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 0.875rem;
}

.ebook-info {
  flex: 1;
}

.ebook-info h3 {
  margin: 0 0 0.5rem 0;
  color: var(--text);
  font-size: 1.25rem;
}

.ebook-description {
  color: var(--text-light);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.ebook-meta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
  font-size: 0.875rem;
  color: var(--text-light);
}

.ebook-meta strong {
  color: var(--text);
  font-weight: 600;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}