@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');

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

:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --text-primary: #1a1a2e;
  --text-secondary: #636e72;
  --card-bg: #ffffff;
  --shadow: rgba(0, 0, 0, 0.1);
  --shadow-hover: rgba(0, 0, 0, 0.2);
}

body.dark {
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --text-primary: #f1f1f1;
  --text-secondary: #b2bec3;
  --card-bg: #0f3460;
  --shadow: rgba(0, 0, 0, 0.5);
  --shadow-hover: rgba(0, 0, 0, 0.7);
}

body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  transition: all 0.4s ease;
}

/* ============================================
   APP LAYOUT
   ============================================ */

.app {
  display: flex;
  min-height: 100vh;
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
  width: 320px;
  background: var(--bg-secondary);
  padding: 30px 20px;
  overflow-y: auto;
  box-shadow: 4px 0 20px var(--shadow);
  position: sticky;
  top: 0;
  height: 100vh;
  transition: all 0.3s ease;
}

.sidebar-header {
  text-align: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--shadow);
}

.sidebar-header h2 {
  font-size: 24px;
  margin-bottom: 5px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-header p {
  font-size: 13px;
  color: var(--text-secondary);
}

.country {
  padding: 15px 20px;
  margin-bottom: 12px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  background: var(--card-bg);
  border: 2px solid transparent;
  box-shadow: 0 4px 10px var(--shadow);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.country:hover {
  transform: translateX(8px);
  box-shadow: 0 6px 15px var(--shadow-hover);
}

.country.active {
  animation: glow 1.5s ease-in-out infinite;
  transform: scale(1.05);
  font-weight: 700;
}

@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 20px currentColor, 0 0 40px currentColor;
  }
  50% {
    box-shadow: 0 0 30px currentColor, 0 0 60px currentColor;
  }
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.main {
  flex: 1;
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  position: relative;
  transition: all 0.6s ease;
}

.main::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 0;
}

.main > * {
  position: relative;
  z-index: 1;
}

/* ============================================
   HEADER
   ============================================ */

.header {
  text-align: center;
  padding: 80px 40px 60px;
  color: white;
  animation: fadeInDown 0.8s ease;
}

.header h1 {
  font-size: 56px;
  font-weight: 700;
  margin-bottom: 15px;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  line-height: 1.2;
}

.header p {
  font-size: 22px;
  opacity: 0.95;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

/* ============================================
   THEME TOGGLE
   ============================================ */

.theme-toggle {
  position: fixed;
  top: 30px;
  right: 30px;
  z-index: 1000;
  background: var(--card-bg);
  border: none;
  padding: 15px 20px;
  border-radius: 50px;
  cursor: pointer;
  font-size: 20px;
  box-shadow: 0 8px 25px var(--shadow-hover);
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  transform: scale(1.1) rotate(20deg);
}

/* ============================================
   POST FORM (3D CARD)
   ============================================ */

.post-form {
  max-width: 700px;
  margin: 40px auto;
  padding: 40px;
  background: var(--card-bg);
  border-radius: 25px;
  box-shadow: 0 20px 60px var(--shadow-hover);
  transform-style: preserve-3d;
  transition: all 0.4s ease;
  animation: fadeInUp 0.8s ease;
}

.post-form:hover {
  transform: translateY(-10px);
  box-shadow: 0 30px 80px var(--shadow-hover);
}

.post-form input,
.post-form textarea {
  width: 100%;
  padding: 15px 20px;
  margin-bottom: 20px;
  border: 2px solid var(--shadow);
  border-radius: 12px;
  font-size: 16px;
  font-family: 'Poppins', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: all 0.3s ease;
}

.post-form input:focus,
.post-form textarea:focus {
  outline: none;
  border-color: currentColor;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.1);
}

.post-form textarea {
  min-height: 150px;
  resize: vertical;
}

.post-form button {
  width: 100%;
  padding: 18px;
  background: linear-gradient(135deg, currentColor 0%, currentColor 100%);
  color: white;
  border: none;
  border-radius: 15px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 10px 30px var(--shadow-hover);
}

.post-form button:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 40px var(--shadow-hover);
}

/* ============================================
   POSTS GRID
   ============================================ */

.posts-section {
  max-width: 1400px;
  margin: 0 auto;
  padding: 60px 40px;
}

.posts-section h2 {
  text-align: center;
  font-size: 42px;
  color: white;
  margin-bottom: 40px;
  text-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.posts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 35px;
  animation: fadeIn 0.8s ease;
}

/* ============================================
   POST CARD
   ============================================ */

.card {
  background: var(--card-bg);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 15px 40px var(--shadow-hover);
  transition: all 0.4s ease;
  cursor: pointer;
  position: relative;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(0,0,0,0.3), rgba(0,0,0,0.1));
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
}

.card:hover::before {
  opacity: 1;
}

.card:hover {
  transform: translateY(-12px) scale(1.02);
  box-shadow: 0 25px 60px var(--shadow-hover);
}

.card img {
  width: 100%;
  height: 250px;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.card:hover img {
  transform: scale(1.1);
}

.card .content {
  padding: 25px;
  position: relative;
  z-index: 2;
}

.card h3 {
  font-size: 22px;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.card .author {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 15px;
  font-style: italic;
}

.card p {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 20px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card a {
  display: inline-block;
  padding: 12px 30px;
  background: currentColor;
  color: white;
  text-decoration: none;
  border-radius: 25px;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 8px 20px var(--shadow);
}

.card a:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px var(--shadow-hover);
}

/* ============================================
   ALL POSTS SECTION
   ============================================ */

.all-posts-section {
  background: var(--bg-secondary);
  padding: 80px 40px;
  margin-top: 60px;
}

.all-posts-section h2 {
  text-align: center;
  font-size: 42px;
  margin-bottom: 50px;
  color: var(--text-primary);
}

/* ============================================
   POST DETAIL PAGE
   ============================================ */

.post-detail {
  max-width: 900px;
  margin: 60px auto;
  padding: 50px;
  background: var(--card-bg);
  border-radius: 25px;
  box-shadow: 0 20px 60px var(--shadow-hover);
  animation: fadeInUp 0.8s ease;
}

.post-detail h1 {
  font-size: 48px;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.post-detail .meta {
  display: flex;
  gap: 20px;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--shadow);
  color: var(--text-secondary);
}

.post-detail img {
  width: 100%;
  max-height: 500px;
  object-fit: cover;
  border-radius: 15px;
  margin-bottom: 30px;
}

.post-detail .content {
  font-size: 18px;
  line-height: 1.8;
  color: var(--text-primary);
  white-space: pre-wrap;
  margin-bottom: 40px;
}

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

.post-actions button {
  flex: 1;
  padding: 15px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.edit-btn {
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: white;
}

.delete-btn {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: white;
}

.post-actions button:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px var(--shadow-hover);
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  .app {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
  }

  .header h1 {
    font-size: 36px;
  }

  .posts {
    grid-template-columns: 1fr;
  }

  .post-form {
    padding: 30px 20px;
  }

  .theme-toggle {
    top: 15px;
    right: 15px;
  }
}