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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  color: #333;
  background: #f5f5f5;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

.layout {
  display: flex;
  gap: 30px;
  align-items: flex-start;
}

header {
  background: white;
  padding: 30px;
  border-radius: 8px;
  margin-bottom: 30px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 15px;
}

.menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 1.5em;
  cursor: pointer;
  color: #2c3e50;
  transition: all 0.2s;
}

.menu-toggle:hover {
  background: #f8f9fa;
  border-color: #95a5a6;
}

header h1 {
  font-size: 2.5em;
  color: #2c3e50;
  margin: 0;
}

/* Mobile menu overlay */
.mobile-menu-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s;
}

.mobile-menu-overlay.active {
  display: block;
  opacity: 1;
}

.mobile-menu-content {
  position: absolute;
  top: 0;
  left: -100%;
  width: 80%;
  max-width: 350px;
  height: 100%;
  background: white;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.2);
  overflow-y: auto;
  transition: left 0.3s;
}

.mobile-menu-overlay.active .mobile-menu-content {
  left: 0;
}

.mobile-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #e0e0e0;
  background: #2c3e50;
  color: white;
}

.mobile-menu-header h2 {
  margin: 0;
  font-size: 1.3em;
}

.menu-close {
  background: transparent;
  border: none;
  font-size: 2em;
  cursor: pointer;
  color: white;
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}

.menu-close:hover {
  transform: scale(1.1);
}

#mobile-navigation {
  padding: 15px;
}

.search-container {
  display: flex;
  gap: 10px;
  align-items: center;
  position: relative;
}

#search-input {
  flex: 1;
  padding: 10px 40px 10px 15px;
  font-size: 1em;
  border: 2px solid #e0e0e0;
  border-radius: 6px;
  transition: border-color 0.2s;
}

#search-input:focus {
  outline: none;
  border-color: #3498db;
}

#clear-search {
  position: absolute;
  right: 90px;
  padding: 5px 8px;
  font-size: 0.9em;
  border: none;
  background: transparent;
  color: #95a5a6;
  cursor: pointer;
  transition: color 0.2s;
  border-radius: 3px;
}

#clear-search:hover {
  color: #e74c3c;
  background: #f8f9fa;
}

#search-button {
  padding: 10px 20px;
  font-size: 1em;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s;
  background: #3498db;
  color: white;
}

#search-button:hover {
  background: #2980b9;
}

.admin-buttons {
  display: flex;
  gap: 10px;
  align-items: center;
}

.create-btn {
  background: #2ecc71;
  color: white;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9em;
  transition: all 0.2s;
  white-space: nowrap;
  font-weight: 500;
}

.create-btn:hover {
  background: #27ae60;
}

.logout-btn {
  background: transparent;
  color: #95a5a6;
  padding: 6px 12px;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85em;
  transition: all 0.2s;
  white-space: nowrap;
}

.logout-btn:hover {
  color: #7f8c8d;
  border-color: #95a5a6;
}

.search-results-header {
  padding: 15px;
  background: #e8f4f8;
  border-left: 4px solid #3498db;
  margin-bottom: 20px;
  border-radius: 4px;
  font-weight: 600;
  color: #2c3e50;
}

.filter-breadcrumb {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: #fff3cd;
  border-left: 4px solid #ffc107;
  margin-bottom: 20px;
  border-radius: 4px;
  gap: 15px;
}

.filter-text {
  color: #856404;
  font-size: 0.95em;
}

.filter-text strong {
  color: #533f03;
}

.filter-clear {
  background: #ffc107;
  color: #533f03;
  border: none;
  padding: 8px 15px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9em;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.2s;
}

.filter-clear:hover {
  background: #e0a800;
}

/* Sidebar Navigation */
#sidebar {
  flex: 0 0 220px;
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

#navigation {
  background: white;
  padding: 15px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-item {
  padding: 10px 12px;
  margin-bottom: 6px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s;
  font-weight: 500;
  font-size: 0.9em;
}

.nav-item:hover {
  background: #ecf0f1;
}

.nav-item.active,
.nav-month-item.active {
  background: #3498db;
  color: white;
}

.nav-all {
  background: #2c3e50;
  color: white;
  font-weight: 600;
  margin-bottom: 12px;
  text-align: center;
}

.nav-all:hover {
  background: #34495e;
}

.nav-all.active {
  background: #1abc9c;
}

.nav-year-section {
  margin-bottom: 2px;
}

.nav-year-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ecf0f1;
  color: #2c3e50;
  padding: 8px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9em;
  font-weight: 600;
  user-select: none;
  transition: all 0.2s;
}

.nav-year-section.expanded .nav-year-header {
  background: #34495e;
  color: white;
}

.nav-year-header:hover {
  background: #d5dbdb;
}

.nav-year-section.expanded .nav-year-header:hover {
  background: #2c3e50;
}

.nav-year-header .arrow {
  font-size: 0.7em;
  margin-right: 6px;
  transition: transform 0.2s;
}

.nav-year-header .year-text {
  flex: 1;
}

.nav-year-header .post-count,
.nav-month-item .post-count {
  background: rgba(0,0,0,0.15);
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 0.75em;
  font-weight: 500;
}

.nav-months-container {
  margin-top: 4px;
  margin-left: 15px;
  margin-bottom: 8px;
}

.nav-month-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  margin-bottom: 2px;
  cursor: pointer;
  border-radius: 3px;
  transition: background 0.2s;
  font-size: 0.85em;
}

.nav-month-item:hover {
  background: #ecf0f1;
}

.nav-month-item.active {
  background: #3498db;
  color: white;
  font-weight: 600;
}

.nav-month-item.active .post-count {
  background: rgba(255,255,255,0.3);
}

.nav-month-item .month-name {
  flex: 1;
}

/* Main content area */
#app {
  flex: 1;
  min-width: 0;
}

/* Post List */
.post-item {
  background: white;
  padding: 25px;
  margin-bottom: 15px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.post-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.post-item h2 {
  color: #2c3e50;
  margin-bottom: 10px;
  font-size: 1.5em;
}

.post-meta {
  color: #7f8c8d;
  font-size: 0.9em;
  margin-bottom: 10px;
}

.post-excerpt {
  color: #555;
  margin-top: 10px;
}

.post-images-preview {
  display: flex;
  gap: 10px;
  margin-top: 15px;
  flex-wrap: wrap;
}

.post-images-preview img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
}

/* Post Detail */
.post-detail {
  background: white;
  padding: 30px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.post-detail h1 {
  color: #2c3e50;
  margin-bottom: 15px;
}

.post-header-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 10px;
}

.back-button {
  display: inline-block;
  padding: 10px 20px;
  background: #3498db;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  font-size: 1em;
}

.back-button:hover {
  background: #2980b9;
}

.edit-button {
  display: inline-block;
  padding: 4px 10px;
  background: transparent;
  color: #95a5a6;
  border: 1px solid #e0e0e0;
  border-radius: 3px;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.8em;
  transition: all 0.2s;
}

.edit-button:hover {
  color: #f39c12;
  border-color: #f39c12;
  background: #fef5e7;
}

.delete-button {
  display: inline-block;
  padding: 4px 10px;
  background: transparent;
  color: #95a5a6;
  border: 1px solid #e0e0e0;
  border-radius: 3px;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.8em;
  transition: all 0.2s;
}

.delete-button:hover {
  color: #e74c3c;
  border-color: #e74c3c;
  background: #fadbd8;
}

.translation-badge {
  display: inline-block;
  margin-left: 15px;
  padding: 4px 10px;
  background: #e8f4f8;
  border: 1px solid #bee5eb;
  border-radius: 3px;
  font-size: 0.85em;
  color: #0c5460;
  cursor: pointer;
  transition: background 0.2s;
}

.translation-badge:hover {
  background: #d1ecf1;
}

.translation-badge a {
  color: #3498db;
  text-decoration: none;
  font-weight: 500;
}

.translation-badge a:hover {
  text-decoration: underline;
}

.translation-action {
  opacity: 0.9;
  font-size: 0.9em;
}

.post-content {
  margin-top: 20px;
  line-height: 1.8;
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 20px 0;
}

.post-content p {
  margin-bottom: 15px;
}

.post-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 15px;
  margin-top: 30px;
}

.post-images img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.post-videos {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 15px;
  margin-top: 30px;
}

.post-videos video {
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  background: #000;
}

.loading {
  text-align: center;
  padding: 40px;
  color: #7f8c8d;
}

.error {
  background: #e74c3c;
  color: white;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  margin-top: 30px;
  padding: 20px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.pagination button {
  padding: 10px 20px;
  background: #3498db;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1em;
  transition: background 0.2s;
}

.pagination button:disabled {
  background: #bdc3c7;
  cursor: not-allowed;
}

.pagination button:not(:disabled):hover {
  background: #2980b9;
}

.pagination-info {
  color: #7f8c8d;
  font-weight: 500;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .container {
    padding: 10px;
  }

  header {
    padding: 15px;
    margin-bottom: 15px;
  }

  .header-top {
    margin-bottom: 15px;
  }

  .menu-toggle {
    display: block;
  }

  header h1 {
    font-size: 1.5em;
  }

  .search-container {
    flex-direction: row;
    gap: 8px;
  }

  #search-input {
    flex: 1;
    padding: 10px 15px;
  }

  #clear-search {
    display: none !important;
  }

  #search-button {
    padding: 10px 15px;
    white-space: nowrap;
  }

  .layout {
    flex-direction: column;
    gap: 15px;
  }

  #sidebar {
    display: none;
  }

  .filter-breadcrumb {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 15px;
    gap: 10px;
  }

  .filter-clear {
    width: 100%;
  }

  .post-item {
    padding: 15px;
    margin-bottom: 10px;
  }

  .post-item h2 {
    font-size: 1.3em;
  }

  .post-detail {
    padding: 15px;
  }

  .post-detail h1 {
    font-size: 1.5em;
  }

  .post-header-actions {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .back-button,
  .edit-button,
  .delete-button {
    width: 100%;
    text-align: center;
  }

  .translation-badge {
    margin-left: 0;
    margin-top: 10px;
    display: block;
    width: fit-content;
  }

  .post-images {
    grid-template-columns: 1fr;
  }

  .post-videos {
    grid-template-columns: 1fr;
  }

  .post-images-preview img {
    width: 50px;
    height: 50px;
  }

  .pagination {
    flex-wrap: wrap;
    gap: 10px;
    padding: 15px;
  }

  .pagination button {
    padding: 8px 16px;
    font-size: 0.9em;
  }
}
