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

:root {
  --bg: #f5f5f5;
  --bg-dark: #1a1a2e;
  --card: #ffffff;
  --text: #333333;
  --text-light: #666666;
  --primary: #4a6cf7;
  --primary-hover: #3a5ce5;
  --danger: #e74c3c;
  --border: #e0e0e0;
  --success: #27ae60;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.hidden {
  display: none !important;
}

/* Buttons */
.btn {
  padding: 10px 20px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.btn:hover {
  background: var(--bg);
}

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

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

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

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-github {
  background: #24292e;
  border-color: #24292e;
  color: white;
}

.btn-github:hover {
  background: #1b1f23;
}

.status {
  color: var(--text-light);
  font-size: 14px;
  margin-top: 10px;
}

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

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 14px;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="date"],
.form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}

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

.form-group small {
  display: block;
  margin-top: 6px;
  color: var(--text-light);
  font-size: 12px;
}

.form-group code {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}

.error {
  color: var(--danger);
  font-size: 14px;
  margin-top: 10px;
}

/* Login Screen */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-dark);
}

.login-box {
  background: var(--card);
  padding: 40px;
  border-radius: 12px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.login-box h1 {
  margin-bottom: 8px;
}

.login-box > p {
  color: var(--text-light);
  margin-bottom: 30px;
}

.login-box .btn {
  width: 100%;
}

/* Admin Header */
.admin-header {
  background: var(--card);
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.admin-header h1 {
  font-size: 20px;
}

.admin-header nav {
  display: flex;
  gap: 10px;
}

/* Admin Main */
.admin-main {
  padding: 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.admin-main h2 {
  margin-bottom: 20px;
}

/* Posts List */
.posts-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.post-item {
  background: var(--card);
  padding: 20px;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--border);
}

.post-item-info h3 {
  font-size: 16px;
  margin-bottom: 4px;
}

.post-item-info span {
  color: var(--text-light);
  font-size: 13px;
}

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

.loading {
  color: var(--text-light);
  text-align: center;
  padding: 40px;
}

/* Editor */
.editor-main {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 24px;
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
  min-height: calc(100vh - 65px);
}

.editor-sidebar {
  background: var(--card);
  padding: 20px;
  border-radius: 8px;
  border: 1px solid var(--border);
  height: fit-content;
  position: sticky;
  top: 89px;
}

.editor-content {
  background: var(--card);
  padding: 20px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.editor-content textarea {
  min-height: 500px;
  resize: vertical;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.thumbnail-preview {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--bg);
  border-radius: 6px;
  margin-bottom: 10px;
  overflow: hidden;
}

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

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: var(--card);
  padding: 30px;
  border-radius: 12px;
  max-width: 400px;
  width: 100%;
}

.modal-content h3 {
  margin-bottom: 10px;
}

.modal-content p {
  color: var(--text-light);
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* SEO Section */
.seo-section {
  margin-top: 20px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.seo-toggle {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
  transition: all 0.2s;
}

.seo-toggle:hover {
  border-color: var(--primary);
}

.seo-toggle-icon {
  transition: transform 0.2s;
  font-size: 12px;
}

.seo-toggle.active .seo-toggle-icon {
  transform: rotate(180deg);
}

.seo-panel {
  display: none;
  padding-top: 20px;
}

.seo-panel.active {
  display: block;
}

.seo-panel .form-group select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  background: var(--card);
  cursor: pointer;
}

.seo-panel .form-group select:focus {
  outline: none;
  border-color: var(--primary);
}

/* Character Counter */
.char-counter {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-light);
}

.char-counter .char-count {
  font-weight: 600;
}

.char-counter.good .char-count {
  color: var(--success);
}

.char-counter.warning .char-count {
  color: #f39c12;
}

.char-counter.bad .char-count {
  color: var(--danger);
}

.char-status {
  font-size: 11px;
}

/* Checkbox */
.checkbox-group {
  margin-top: 15px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: normal;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

/* SEO Score */
.seo-score {
  margin-top: 20px;
  padding: 15px;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.seo-score-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-weight: 600;
  font-size: 14px;
}

.score-value {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

.score-value.excellent {
  background: #d4edda;
  color: #155724;
}

.score-value.good {
  background: #fff3cd;
  color: #856404;
}

.score-value.poor {
  background: #f8d7da;
  color: #721c24;
}

.seo-checklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.seo-check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-light);
}

.seo-check-item.pass {
  color: var(--success);
}

.seo-check-item.fail {
  color: var(--danger);
}

.seo-check-item .icon {
  font-size: 14px;
}

/* Preview Section */
.preview-section {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.preview-section h3 {
  font-size: 16px;
  margin-bottom: 20px;
  color: var(--text);
}

.preview-card {
  margin-bottom: 24px;
}

.preview-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

/* Google SERP Preview */
.serp-preview {
  padding: 20px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: Arial, sans-serif;
}

.serp-url {
  font-size: 12px;
  color: #202124;
  margin-bottom: 4px;
}

.serp-title {
  font-size: 18px;
  color: #1a0dab;
  margin-bottom: 6px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.serp-title:hover {
  text-decoration: underline;
  cursor: pointer;
}

.serp-description {
  font-size: 13px;
  color: #4d5156;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Social Preview */
.social-preview {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.social-image {
  width: 100%;
  aspect-ratio: 1.91 / 1;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  overflow: hidden;
}

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

.social-content {
  padding: 12px 16px;
}

.social-url {
  font-size: 11px;
  color: #65676b;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.social-title {
  font-size: 15px;
  font-weight: 600;
  color: #1c1e21;
  line-height: 1.3;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.social-description {
  font-size: 13px;
  color: #65676b;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Responsive */
@media (max-width: 768px) {
  .editor-main {
    grid-template-columns: 1fr;
  }

  .editor-sidebar {
    position: static;
  }

  .post-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}
