/* ==========================================
   RESET
   ========================================== */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;

  background: #f5f7fa;
  color: #222;
  line-height: 1.6;
}

/* ==========================================
   GENERAL
   ========================================== */

.container {
  width: min(1100px, 92%);
  margin: 0 auto;
}

a {
  color: #2563eb;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
}

/* ==========================================
   HEADER
   ========================================== */

.site-header {
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  padding: 18px 0;
}

.site-header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.site-title {
  font-size: 1.6rem;
  font-weight: 700;
}

.site-title a {
  color: #111827;
  text-decoration: none;
}

.main-navigation {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
}

.main-navigation a {
  color: #374151;
  font-weight: 500;
}

.main-navigation a:hover {
  color: #2563eb;
  text-decoration: none;
}

.welcome {
  color: #6b7280;
}

/* ==========================================
   MAIN CONTENT
   ========================================== */

main.container {
  min-height: calc(100vh - 180px);
  padding-top: 40px;
  padding-bottom: 60px;
}

h1,
h2,
h3,
h4 {
  color: #111827;
  line-height: 1.3;
}

h1 {
  font-size: 2.2rem;
  margin-top: 0;
}

h2 {
  font-size: 1.7rem;
}

h3 {
  font-size: 1.3rem;
}

/* ==========================================
   POSTS LIST
   ========================================== */

.posts {
  max-width: 850px;
  margin: 0 auto;
}

.post {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 25px;
  margin-bottom: 25px;

  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.post h3 {
  margin-top: 0;
  margin-bottom: 8px;
}

.post h3 a {
  color: #111827;
}

.post h3 a:hover {
  color: #2563eb;
  text-decoration: none;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;

  color: #6b7280;
  font-size: 0.9rem;

  margin-bottom: 15px;
}

.post p {
  color: #374151;
}

.read-more {
  display: inline-block;
  margin-top: 10px;

  font-weight: 600;
}

/* ==========================================
   SINGLE POST
   ========================================== */

.post-content {
  background: #ffffff;

  border: 1px solid #e5e7eb;
  border-radius: 10px;

  padding: 35px;

  font-size: 1.05rem;

  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
  margin-top: 1.5em;
}

.post-content h1:first-child,
.post-content h2:first-child,
.post-content h3:first-child {
  margin-top: 0;
}

.post-content blockquote {
  margin: 25px 0;
  padding: 15px 20px;

  border-left: 4px solid #2563eb;

  background: #f3f4f6;
  color: #4b5563;
}

.post-content pre {
  overflow-x: auto;

  padding: 15px;

  border-radius: 6px;

  background: #1f2937;
  color: #f9fafb;
}

.post-content code {
  font-family: Consolas, Monaco, "Courier New", monospace;
}

.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 25px 0;
}

.post-content th,
.post-content td {
  border: 1px solid #d1d5db;
  padding: 10px;
  text-align: left;
}

.post-content th {
  background: #f3f4f6;
}

/* ==========================================
   BUTTONS
   ========================================== */

button,
.button {
  display: inline-block;

  border: none;
  border-radius: 6px;

  padding: 10px 18px;

  background: #2563eb;
  color: #ffffff;

  font-size: 0.95rem;
  font-weight: 600;

  cursor: pointer;

  text-decoration: none;
}

button:hover,
.button:hover {
  background: #1d4ed8;
  text-decoration: none;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ==========================================
   FORMS
   ========================================== */

form {
  margin: 0;
}

label {
  display: inline-block;

  margin-bottom: 6px;

  font-weight: 600;
  color: #374151;
}

input,
textarea,
select {
  width: 100%;

  padding: 10px 12px;

  border: 1px solid #d1d5db;
  border-radius: 6px;

  background: #ffffff;

  color: #111827;

  font-family: inherit;
  font-size: 1rem;

  outline: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #2563eb;

  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

textarea {
  min-height: 150px;
  resize: vertical;
}

/* ==========================================
   LOGIN / REGISTER
   ========================================== */

.auth-container {
  width: min(450px, 100%);
  margin: 40px auto;
}

.auth-card {
  background: #ffffff;

  padding: 35px;

  border: 1px solid #e5e7eb;
  border-radius: 10px;

  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.auth-card h1 {
  margin-top: 0;
  text-align: center;
}

.auth-card .form-group {
  margin-bottom: 20px;
}

.auth-card button {
  width: 100%;
}

.auth-links {
  margin-top: 20px;
  text-align: center;
}

/* ==========================================
   COMMENTS
   ========================================== */

.comments {
  max-width: 850px;
  margin: 50px auto 0;
}

.comment {
  background: #ffffff;

  border: 1px solid #e5e7eb;
  border-radius: 8px;

  padding: 20px;

  margin-bottom: 15px;
}

.comment-meta {
  color: #6b7280;
  font-size: 0.9rem;

  margin-bottom: 10px;
}

.comment-content {
  white-space: normal;
  overflow-wrap: break-word;
}

.comment-form {
  background: #ffffff;

  border: 1px solid #e5e7eb;
  border-radius: 8px;

  padding: 25px;

  margin-top: 30px;
}

/* ==========================================
   ALERTS
   ========================================== */

.alert {
  padding: 12px 16px;

  margin-bottom: 20px;

  border-radius: 6px;

  border: 1px solid transparent;
}

.alert-error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.alert-success {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.alert-warning {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

/* ==========================================
   ADMIN
   ========================================== */

.admin-container {
  max-width: 1200px;
  margin: 0 auto;
}

.dashboard-grid {
  display: grid;

  grid-template-columns: repeat(3, 1fr);

  gap: 20px;

  margin-top: 30px;
}

.dashboard-card {
  background: #ffffff;

  border: 1px solid #e5e7eb;
  border-radius: 10px;

  padding: 25px;

  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.dashboard-card h3 {
  margin-top: 0;
}

.dashboard-number {
  font-size: 2rem;
  font-weight: 700;

  color: #2563eb;

  margin: 10px 0 20px;
}

/* ==========================================
   TABLES
   ========================================== */

.table-wrapper {
  width: 100%;
  overflow-x: auto;

  background: #ffffff;

  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 15px;

  border-bottom: 1px solid #e5e7eb;

  text-align: left;
  vertical-align: middle;
}

th {
  background: #f9fafb;

  color: #374151;

  font-weight: 600;
}

tbody tr:hover {
  background: #f9fafb;
}

tbody tr:last-child td {
  border-bottom: none;
}

/* ==========================================
   STATUS
   ========================================== */

.status {
  display: inline-block;

  padding: 4px 10px;

  border-radius: 20px;

  font-size: 0.85rem;
  font-weight: 600;
}

.status-pending {
  background: #fef3c7;
  color: #92400e;
}

.status-approved {
  background: #dcfce7;
  color: #166534;
}

.status-rejected {
  background: #fee2e2;
  color: #991b1b;
}

/* ==========================================
   ACTIONS
   ========================================== */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.actions form {
  display: inline;
}

.button-small {
  padding: 6px 10px;
  font-size: 0.85rem;
}

.button-danger {
  background: #dc2626;
}

.button-danger:hover {
  background: #b91c1c;
}

.button-secondary {
  background: #6b7280;
}

.button-secondary:hover {
  background: #4b5563;
}

.button-success {
  background: #16a34a;
}

.button-success:hover {
  background: #15803d;
}

/* ==========================================
   FOOTER
   ========================================== */

.site-footer {
  background: #111827;
  color: #d1d5db;

  padding: 25px 0;

  margin-top: 50px;
}

.site-footer p {
  margin: 0;
  text-align: center;
}

.site-footer a {
  color: #ffffff;
}

/* ==========================================
   EMPTY STATES
   ========================================== */

.empty-state {
  background: #ffffff;

  border: 1px solid #e5e7eb;
  border-radius: 8px;

  padding: 40px;

  text-align: center;

  color: #6b7280;
}

/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */

@media (max-width: 800px) {
  .site-header .container {
    flex-direction: column;
    align-items: flex-start;
  }

  .main-navigation {
    width: 100%;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .post-content {
    padding: 25px;
  }
}

@media (max-width: 600px) {
  body {
    font-size: 15px;
  }

  main.container {
    padding-top: 25px;
  }

  h1 {
    font-size: 1.8rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  .site-header {
    padding: 15px 0;
  }

  .main-navigation {
    gap: 12px;
  }

  .post {
    padding: 20px;
  }

  .post-content {
    padding: 20px;

    font-size: 1rem;
  }

  .auth-card {
    padding: 25px 20px;
  }

  .dashboard-grid {
    gap: 15px;
  }

  th,
  td {
    padding: 8px 10px;
  }
}
