/* CSS Variables for button colors */
:root {
  --btn-color: #006400;     /* Default: dark green */
  --btn-hover: #008000;
}

/* Reset & Basic styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #f5f5f5;
  color: #222;
  padding-bottom: 80px;
  min-height: 100vh;
}

/* Header Styles */
header {
  background: linear-gradient(135deg, #006400, #228B22);
  color: white;
  text-align: center;
  padding: 1.4rem 1rem;
  box-shadow: 0 3px 10px rgba(0,0,0,0.25);
}

header h1 {
  margin-bottom: 0.4rem;
  font-size: 1.9rem;
}

header h2 {
  font-size: 1.3rem;
  font-weight: normal;
}

header .intro {
  font-size: 1.05rem;
  opacity: 0.95;
}

/* Navbar Styles */
.navbar {
  background-color: #1a3c5e;
  padding: 1rem 2rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.nav-menu {
  list-style: none;
  display: flex;
  gap: 2rem;
}

.nav-menu li a {
  color: white;
  text-decoration: none;
  font-size: 1.05rem;
  padding: 0.6rem 0.4rem;
  transition: all 0.25s ease;
  position: relative;
}

.nav-menu li a:hover,
.nav-menu li a.active {
  color: #4da3ff;
}

/* Underline hover effect */
.nav-menu li a::after {
  content: '';
  position: absolute;
  width: 0;
  height: 2.5px;
  bottom: 0;
  left: 50%;
  background-color: #4da3ff;
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

.nav-menu li a:hover::after,
.nav-menu li a.active::after {
  width: 70%;
}

/* Mobile hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
}

.hamburger span {
  width: 28px;
  height: 3px;
  background-color: white;
  border-radius: 3px;
  transition: all 0.3s;
}

/* Mobile menu toggle */
#menu-toggle {
  display: none;
}

/* Responsive - mobile view */
@media screen and (max-width: 768px) {
  .hamburger {
    display: flex;
  }

  .nav-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: #1a3c5e;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 0;
    gap: 1.2rem;
    transform: translateY(-100%);
    transition: transform 0.35s ease-in-out;
    box-shadow: 0 8px 15px rgba(0,0,0,0.2);
  }

  #menu-toggle:checked ~ .nav-menu {
    transform: translateY(0);
  }

  /* Hamburger animation → X */
  #menu-toggle:checked + .hamburger span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
  }

  #menu-toggle:checked + .hamburger span:nth-child(2) {
    opacity: 0;
  }

  #menu-toggle:checked + .hamburger span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
  }
}

/* Color Toggle Button */
.color-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
  cursor: pointer;
  transition: all 0.22s;
  z-index: 200;
  background: var(--btn-color);
}

.color-toggle:hover {
  transform: scale(1.12);
  box-shadow: 0 6px 18px rgba(0,0,0,0.4);
}

.color-toggle:active {
  transform: scale(0.95);
}

/* Add Button Section */
.add-button-section {
  text-align: center;
  margin: 1.5rem auto;
  padding: 0 1rem;
}

.add-new-btn {
  background: linear-gradient(135deg, #4CAF50, #45a049);
  color: white;
  border: none;
  padding: 14px 32px;
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.add-new-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(76, 175, 80, 0.4);
  background: linear-gradient(135deg, #45a049, #3d8b40);
}

.add-new-btn:active {
  transform: translateY(0);
}

.plus-icon {
  font-size: 1.4rem;
  font-weight: bold;
  line-height: 1;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(5px);
  animation: fadeIn 0.3s ease;
}

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

.modal-content {
  background-color: white;
  margin: 8% auto;
  padding: 2rem;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  animation: slideDown 0.3s ease;
  position: relative;
}

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

.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.3s;
  line-height: 1;
}

.close:hover,
.close:focus {
  color: #000;
}

.modal-content h2 {
  margin-bottom: 1.5rem;
  color: #333;
  font-size: 1.6rem;
}

.form-group {
  margin-bottom: 1.2rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: #555;
  font-weight: 600;
  font-size: 0.95rem;
}

.form-group input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
  transition: all 0.3s;
}

.form-group input:focus {
  outline: none;
  border-color: #4CAF50;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

.submit-btn,
.cancel-btn {
  flex: 1;
  padding: 12px 24px;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.submit-btn {
  background: #4CAF50;
  color: white;
}

.submit-btn:hover {
  background: #45a049;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.cancel-btn {
  background: #f44336;
  color: white;
}

.cancel-btn:hover {
  background: #da190b;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(244, 67, 54, 0.3);
}

/* Hint Text */
.hint {
  text-align: center;
  color: #1E3C59;
  font-style: italic;
  margin: 0.7rem 1.2rem 1rem;
  font-size: 0.95rem;
}

/* Button Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Button Styles */
.btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 65px;
  padding: 10px 14px;
  background: var(--btn-color);
  color: white;
  font-weight: 600;
  font-size: 1.15rem;
  text-align: center;
  text-decoration: none;
  border-radius: 12px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.18);
  transition: all 0.22s ease;
  cursor: grab;
  user-select: none;
  border: 1px solid rgba(255,255,255,0.25);
  position: relative;
}

.btn i {
  font-size: 2rem;
  margin-bottom: 2px;
}

.btn .btn-text {
  line-height: 1.3;
}

.btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 18px rgba(0,0,0,0.25);
  background: var(--btn-hover);
}

.btn:active {
  cursor: grabbing;
  transform: scale(0.98);
}

/* Delete button on custom buttons */
.btn .delete-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  background: rgba(255, 0, 0, 0.8);
  color: white;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn:hover .delete-btn {
  opacity: 1;
}

.delete-btn:hover {
  background: rgba(200, 0, 0, 1);
  transform: scale(1.1);
}

/* Footer Styles */
footer {
  text-align: center;
  padding: 2.5rem 1rem;
  color: #666;
  font-size: 0.9rem;
  margin-top: 2rem;
}

.visitor-counter {
  margin-top: 1rem;
}

.visitor-counter a {
  text-decoration: none;
}

/* Responsive - Mobile */
@media (max-width: 600px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
  
  .btn {
    min-height: 60px;
    font-size: 1.05rem;
  }

  .btn i {
    font-size: 1.6rem;
  }
  
  .color-toggle {
    top: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
  }
  
  header h1 {
    font-size: 1.5rem;
  }
  
  header h2 {
    font-size: 1.1rem;
  }

  .modal-content {
    margin: 20% auto;
    padding: 1.5rem;
  }

  .add-new-btn {
    font-size: 1rem;
    padding: 12px 24px;
  }
}
