/* Admin Panel Styles */

.admin-container {
  min-height: 100vh;
  background: var(--light-bg);
}

/* Login Screen */
.admin-login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  background: var(--white);
  padding: 48px;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  max-width: 400px;
  width: 100%;
}

.login-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--dark-base);
  margin-bottom: 8px;
  text-align: center;
}

.login-subtitle {
  font-size: 16px;
  color: var(--secondary-text);
  margin-bottom: 32px;
  text-align: center;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.login-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.login-form .form-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--dark-base);
}

.login-form .form-input {
  padding: 14px 16px;
  font-size: 16px;
  font-family: inherit;
  color: var(--primary-text);
  background: var(--white);
  border: 2px solid var(--borders);
  border-radius: 8px;
  transition: all 0.3s ease;
  width: 100%;
  box-sizing: border-box;
}

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

.login-form .form-input::placeholder {
  color: var(--muted-text);
  opacity: 0.7;
}

.login-message {
  margin-top: 8px;
}

.error-message {
  background: rgba(239, 68, 68, 0.1);
  color: #DC2626;
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.success-message {
  background: rgba(34, 197, 94, 0.1);
  color: #16A34A;
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

/* Admin Dashboard */
.admin-dashboard {
  min-height: 100vh;
}

.admin-header {
  background: var(--white);
  border-bottom: 1px solid var(--borders);
  padding: 24px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.admin-header-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--dark-base);
}

.admin-header-actions {
  display: flex;
  gap: 12px;
}

.admin-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 20px;
}

/* Posts List View */
.admin-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.admin-section-header h2 {
  font-size: 24px;
  font-weight: 600;
  color: var(--dark-base);
}

.admin-filter {
  display: flex;
  gap: 8px;
}

.filter-btn {
  padding: 8px 16px;
  background: var(--white);
  border: 2px solid var(--borders);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--secondary-text);
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  border-color: var(--primary-blue);
  color: var(--primary-blue);
}

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

.posts-table-container {
  background: var(--white);
  border-radius: 12px;
  border: 1px solid var(--borders);
  overflow: hidden;
}

.posts-table {
  width: 100%;
  border-collapse: collapse;
}

.posts-table thead {
  background: var(--light-bg);
}

.posts-table th {
  padding: 16px;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  color: var(--dark-base);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.posts-table td {
  padding: 16px;
  border-top: 1px solid var(--borders);
  font-size: 15px;
  color: var(--primary-text);
}

.posts-table tbody tr:hover {
  background: var(--light-bg);
}

.posts-table code {
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary-blue);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 13px;
  font-family: monospace;
}

.status-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.status-badge.published {
  background: rgba(34, 197, 94, 0.1);
  color: #16A34A;
}

.status-badge.draft {
  background: rgba(251, 191, 36, 0.1);
  color: #D97706;
}

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

.action-btn {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-size: 14px;
}

.action-btn.edit-btn {
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary-blue);
}

.action-btn.edit-btn:hover {
  background: var(--primary-blue);
  color: var(--white);
}

.action-btn.delete-btn {
  background: rgba(239, 68, 68, 0.1);
  color: #DC2626;
}

.action-btn.delete-btn:hover {
  background: #DC2626;
  color: var(--white);
}

/* Post Editor */
.admin-post-editor {
  background: var(--white);
  border-radius: 12px;
  border: 1px solid var(--borders);
  padding: 32px;
}

.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--borders);
  flex-wrap: wrap;
  gap: 16px;
}

.editor-actions {
  display: flex;
  gap: 12px;
}

.post-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.form-group-large {
  grid-column: 1 / -1;
}

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

.form-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--dark-base);
}

.form-input {
  padding: 14px 16px;
  font-size: 16px;
  font-family: inherit;
  color: var(--primary-text);
  background: var(--white);
  border: 2px solid var(--borders);
  border-radius: 8px;
  transition: all 0.3s ease;
  width: 100%;
  box-sizing: border-box;
}

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

.form-input::placeholder {
  color: var(--muted-text);
  opacity: 0.7;
}

.form-input:disabled {
  background: var(--light-bg);
  cursor: not-allowed;
  opacity: 0.6;
}

.form-input:invalid:not(:placeholder-shown) {
  border-color: #EF4444;
}

.form-input:valid:not(:placeholder-shown):not(:focus) {
  border-color: #10B981;
}

/* File input styling */
input[type="file"] {
  display: none;
}

/* Number input styling */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  opacity: 1;
}

select.form-input {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%232563EB' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

.form-textarea {
  resize: vertical;
  min-height: 150px;
  font-family: inherit;
  line-height: 1.6;
}

.form-textarea.form-input {
  font-family: 'Courier New', monospace;
  font-size: 14px;
}

.form-help {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted-text);
  line-height: 1.5;
}

.editor-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px;
  background: var(--light-bg);
  border-radius: 8px;
}

.toolbar-btn {
  padding: 6px 12px;
  background: var(--white);
  border: 1px solid var(--borders);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
}

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

.form-textarea {
  font-family: 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.6;
}

.editor-preview {
  margin-top: 24px;
  padding: 24px;
  background: var(--light-bg);
  border-radius: 8px;
  border: 1px solid var(--borders);
}

.editor-preview h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--dark-base);
  margin-bottom: 16px;
}

#previewContent {
  font-size: 15px;
  line-height: 1.7;
  color: var(--primary-text);
}

/* Responsive */
@media (max-width: 768px) {
  .admin-header-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .admin-header-actions {
    width: 100%;
    flex-direction: column;
  }

  .admin-header-actions .btn {
    width: 100%;
  }

  .posts-table-container {
    overflow-x: auto;
  }

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

  .editor-header {
    flex-direction: column;
    align-items: stretch;
  }

  .editor-actions {
    width: 100%;
    flex-direction: column;
  }

  .editor-actions .btn {
    width: 100%;
  }
}

