/* Global Styles for Fit Savanna Editorial CMS */

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

:root {
  --primary: rgba(5, 245, 13, 0.9);
  --primary-hover: rgba(5, 245, 13, 1);
  --secondary: #6B7280;
  --dark: #111827;
  --light: #F9FAFB;
  --border: #E5E7EB;
  --danger: #EF4444;
  --success: #10B981;
  --warning: #F59E0B;
  --text: #1F2937;
  --text-light: #6B7280;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--light);
  color: var(--text);
  line-height: 1.6;
}

/* Navbar */
.navbar {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand h2, .nav-brand a {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-info {
  font-size: 0.9rem;
  color: var(--text-light);
}

/* Container */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* Auth Pages */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.auth-container {
  width: 100%;
  max-width: 450px;
  padding: 1.5rem;
}

.auth-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  padding: 2.5rem;
}

.logo {
  text-align: center;
  margin-bottom: 2rem;
}

.logo h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.logo p {
  color: var(--text-light);
  font-size: 0.95rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.auth-footer {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-light);
}

/* Forms */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

label {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text);
}

label.required::after {
  content: " *";
  color: var(--danger);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
textarea,
select {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
}

textarea {
  resize: vertical;
  font-family: inherit;
}

small {
  font-size: 0.8rem;
  color: var(--text-light);
}

.char-count {
  text-align: right;
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

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

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(5, 245, 13, 0.3);
}

.btn-secondary {
  background: var(--secondary);
  color: white;
}

.btn-secondary:hover:not(:disabled) {
  background: #4B5563;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-outline:hover:not(:disabled) {
  background: var(--light);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

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

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

/* Spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0,0,0,0.1);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* Messages */
.error-message {
  background: #FEE2E2;
  border: 1px solid #FCA5A5;
  color: #991B1B;
  padding: 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
}

.success-message {
  background: #D1FAE5;
  border: 1px solid #6EE7B7;
  color: #065F46;
  padding: 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
}

/* Dashboard */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.dashboard-actions {
  display: flex;
  gap: 0.75rem;
}

.activity-indicator {
  background: #FEF3C7;
  border: 1px solid #FCD34D;
  padding: 1rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  font-size: 0.9rem;
}

/* Articles Section */
.articles-section {
  margin-bottom: 3rem;
}

.articles-section h2 {
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
}

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

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

.article-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.draft-card {
  border-left: 4px solid var(--warning);
}

.article-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--warning);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 600;
}

.article-card h3 {
  font-size: 1.15rem;
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.article-excerpt {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 1rem;
  line-height: 1.5;
}

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

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

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-light);
}

.loader {
  text-align: center;
  padding: 2rem;
  color: var(--text-light);
}

/* Editor */
.editor-container {
  display: flex;
  gap: 1.5rem;
  max-width: 1600px;
  margin: 0 auto;
  padding: 1.5rem;
  height: calc(100vh - 70px);
}

.editor-sidebar {
  width: 350px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-section {
  margin-bottom: 2rem;
}

.sidebar-section h3 {
  font-size: 1.1rem;
  margin-bottom: 1rem;
  cursor: pointer;
  user-select: none;
}

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

.section-content {
  display: block;
}

.editor-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.editor-toolbar {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--light);
  flex-wrap: wrap;
  align-items: center;
}

.word-count {
  margin-left: auto;
  color: var(--text-light);
}

.editor-split-view {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.editor-pane,
.preview-pane {
  flex: 1;
  overflow-y: auto;
}

.editor-pane {
  border-right: 1px solid var(--border);
}

.editor-pane textarea {
  width: 100%;
  height: 100%;
  padding: 1.5rem;
  border: none;
  resize: none;
  font-family: 'Monaco', 'Menlo', monospace;
  font-size: 0.95rem;
  line-height: 1.7;
}

.preview-pane {
  padding: 1.5rem;
  background: #FAFAFA;
}

.save-status {
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  background: var(--light);
}

.status-loading {
  background: #FEF3C7;
  color: #92400E;
}

.status-success {
  background: #D1FAE5;
  color: #065F46;
}

.status-error {
  background: #FEE2E2;
  color: #991B1B;
}

.expert-input-group {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.expert-input {
  flex: 1;
}

/* Article Preview Styles */
.article-content {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text);
}

.article-content h2 {
  font-size: 1.75rem;
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.article-content h3 {
  font-size: 1.4rem;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.article-content p {
  margin-bottom: 1rem;
}

.article-content ul,
.article-content ol {
  margin-bottom: 1rem;
  padding-left: 2rem;
}

.article-content li {
  margin-bottom: 0.5rem;
}

.article-content blockquote {
  border-left: 4px solid var(--primary);
  padding-left: 1rem;
  margin: 1.5rem 0;
  font-style: italic;
  color: var(--text-light);
}

.article-content a {
  color: var(--primary);
  text-decoration: underline;
}

.article-content code {
  background: #F3F4F6;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  font-family: 'Monaco', 'Menlo', monospace;
  font-size: 0.9em;
}

.article-content pre {
  background: #1F2937;
  color: #F9FAFB;
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1.5rem 0;
}

.article-content pre code {
  background: none;
  padding: 0;
  color: inherit;
}

/* Admin */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
  gap: 2rem;
}

.admin-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2rem;
}

.admin-card h2 {
  margin-bottom: 1.5rem;
}

.success-box {
  background: #D1FAE5;
  border: 2px solid #6EE7B7;
  padding: 1.5rem;
  border-radius: 8px;
  margin-top: 1.5rem;
}

.success-box h3 {
  color: #065F46;
  margin-bottom: 1rem;
}

.success-box code {
  background: white;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-size: 1.1rem;
  display: inline-block;
  font-family: 'Monaco', 'Menlo', monospace;
  border: 1px solid #6EE7B7;
}

.info-note {
  font-size: 0.9rem;
  color: #065F46;
  margin-top: 1rem;
}

.info-box {
  background: #F3F4F6;
  padding: 1.5rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
}

.info-box h3 {
  margin-bottom: 0.75rem;
  font-size: 1rem;
}

.info-box ul {
  list-style: none;
  padding: 0;
}

.info-box li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.info-box li:last-child {
  border-bottom: none;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--light);
  padding: 1.5rem;
  border-radius: 8px;
  text-align: center;
}

.stat-number {
  font-size: 2rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Responsive */
@media (max-width: 1200px) {
  .editor-container {
    flex-direction: column;
    height: auto;
  }
  
  .editor-sidebar {
    width: 100%;
  }
  
  .editor-main {
    min-height: 600px;
  }
}

@media (max-width: 768px) {
  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .articles-grid {
    grid-template-columns: 1fr;
  }
  
  .admin-grid {
    grid-template-columns: 1fr;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .editor-split-view {
    flex-direction: column;
  }
  
  .editor-pane {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}
