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

body {
  font-family: 'Segoe UI', sans-serif;
  background: #f4f4f4;
  color: #333;
  padding: 20px;
  transition: background 0.3s, color 0.3s;
}

/* Header Styles */
header {
  text-align: center;
  margin-bottom: 2rem;
}

h1 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

/* Navbar Styles */
.navbar {
  background: #c56262;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 100;
}

.navbar .logo {
  color: white;
  font-size: 1.5rem;
  font-weight: bold;
  text-decoration: none;
}

.menu {
  list-style: none;
  display: flex;
  gap: 20px;
  align-items: center;
}

.menu li {
  display: inline;
}

.menu li a {
  text-decoration: none;
  color: white;
  font-size: 1rem;
  padding: 5px 10px;
  border-radius: 5px;
  transition: background 0.3s;
}

.menu li a:hover {
  background: #555;
}

/* Menu Toggle Icon */
.menu-icon {
  font-size: 1.5rem;
  color: white;
  cursor: pointer;
  display: none;
}
/* Sidebar Styles */
.sidebar {
  position: fixed;
  top: 0;
  left: -250px;
  width: 250px;
  height: 100vh;
  background: #333;
  padding-top: 20px;
  transition: left 0.3s;
  z-index: 1000; /* Higher than header */
}

.sidebar.show {
  left: 0;
}

.sidebar .menu {
  list-style: none;
  padding: 20px;
  margin: 0;
}

.sidebar .menu li {
  margin-bottom: 15px;
}

.sidebar .menu a {
  color: white;
  text-decoration: none;
  font-size: 1.1rem;
  display: block;
  padding: 8px 0;
}

.sidebar .menu a:hover {
  color: #ddd;
}

/* Dark Mode Icon in Sidebar */
#dark-mode-toggle-sidebar {
  font-size: 1.5rem;
  cursor: pointer;
  color: white;
  display: block; /* Default display for mobile */
  margin-top: 20px;
  text-align: center;
  transition: transform 0.3s;
}

#dark-mode-toggle-sidebar:hover {
  transform: scale(1.2);
}

/* Hide dark-mode-toggle-sidebar on desktop */
@media (min-width: 769px) {
  #dark-mode-toggle-sidebar {
    display: none; /* Hide on desktop */
  }
}

.dark-mode-toggle {
  background: transparent;
  border: none;
  color: white;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 8px 0;
  width: 100%;
  text-align: left;
}

/* Show sidebar on mobile */
@media (max-width: 768px) {
  .menu {
    display: none; /* Hide the menu in the navbar */
  }

  .sidebar {
    padding-top: 70px; /* Push content below header */
    display: block; /* Ensure the sidebar is displayed */
  }

  .sidebar .menu {
    display: block; /* Display the menu inside the sidebar */
  }

  .sidebar .menu a, 
  .dark-mode-toggle {
    color: white;
  }
}

/* Dark Mode Icon */
.dark-mode-icon {
  font-size: 1.5rem;
  cursor: pointer;
  color: white;
  transition: transform 0.3s;
}

.dark-mode-icon:hover {
  transform: scale(1.2);
}

/* Search Section */
#search-section {
  text-align: center;
  margin-bottom: 2rem;
}

#search {
  margin-top: 1rem;
  padding: 10px;
  width: 80%;
  max-width: 400px;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  display: block;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 1rem;
}

#continent-filter {
  padding: 10px;
  width: 80%;
  max-width: 400px;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

/* Countries Grid */
.countries-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.country-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  overflow: hidden;
  transition: transform 0.3s;
  cursor: pointer;
}

.country-card:hover {
  transform: scale(1.03);
}

.country-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
}

.country-info {
  padding: 15px;
}

.country-info h2 {
  font-size: 1.2rem;
  margin-bottom: 10px;
}

.country-info p {
  font-size: 0.95rem;
}

/* Footer Styles */
footer {
  text-align: center;
  margin-top: 2rem;
  padding: 1rem 0;
  background: #c56262;
  color: white;
}

footer p {
  margin: 5px 0;
}

/* Dark Mode Styles */
body.dark {
  background-color: #121212;
  color: #eee;
}

body.dark .navbar {
  background: #1e1e1e;
}

body.dark .sidebar {
  background: #1e1e1e;
}

body.dark footer {
  background: #1e1e1e;
}

body.dark #search,
body.dark #continent-filter {
  background: #2b2b2b;
  color: #eee;
  border-color: #444;
}

.dark .country-card {
  background-color: #1e1e1e;
  border-color: #333;
  color: #eee;
}

/* Responsive Design */
@media (max-width: 768px) {
  .menu {
    display: none;
  }

  .menu-icon {
    display: block;
  }

  .sidebar {
    display: block;
  }

  #search {
    width: 90%;
  }

  #continent-filter {
    width: 90%;
  }
}