/* Base Layout */
body {
  font-family: 'Segoe UI', sans-serif;
  background-color: #f5f5f5;
  margin: 0;
}

/* Navigation */
nav {
  background-color: #000;
  padding: 20px 40px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-logo img {
  height: 40px;
}

.nav-buttons {
  display: flex;
  gap: 15px;
}

.nav-buttons button {
  background-color: transparent;
  border: 1px solid #fff;
  color: #fff;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95em;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.nav-buttons button:hover {
  background-color: #fff;
  color: #000;
}
.delete-button {
  background: #ff4d4f !important;
  color: white;
  font-weight: bold;
}

.delete-button:hover {
  background: #d9363e;
}
/* Card Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(700px, 1fr));
  gap: 30px;
  padding: 40px;
}

.container {
  position: relative;
  z-index: 1;
  isolation: isolate;
}

.card {
  position: relative;
  background-color: #fff;
  border-radius: 20px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
  display: flex;
  padding: 30px;
  gap: 30px;
  align-items: center;
}

/* Card Content */
.card-text {
  flex: 1;
}

.card-category {
  font-style: italic;
  color: #666;
  margin-bottom: 10px;
}

.card-title {
  font-size: clamp(1rem, 2vw, 1.8em);
  font-weight: bold;
  margin: 0 0 20px 0;
  line-height: 1.2;
  max-height: 2.4em; /* approx 2 lines */
  overflow: hidden;
}

.card-title.smaller {
  font-size: 1.2em;
}

/* Card Footer Buttons */
.card-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.card-footer button {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  font-size: 0.8em;
  color: #333;
  background-color: transparent;
  border: 1px solid #ccc;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}

.card-footer button:hover {
  background-color: #f0f0f0;
  border-color: #999;
}

/* Card Image */
.card-image {
  width: 160px;
  height: 160px;
  border-radius: 20px;
  overflow: hidden;
  flex-shrink: 0;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Responsive Layout */
@media (max-width: 768px) {
  .card {
    flex-direction: column;
    align-items: flex-start;
  }

  .card-image {
    width: 100%;
    height: auto;
  }
}

/* Plus Button */
.plus-button {
  background: #ffffff;
  border: 1px solid #ccc;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 1em;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.plus-button:hover {
  background-color: #f0f0f0;
}

.plus-button svg {
  width: 16px;
  height: 16px;
  fill: #333;
}

/* Modal Overlay */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.6);
  justify-content: center;
  align-items: center;
  z-index: 99999;
}

.modal-overlay.active {
  display: flex;
  animation: fadeOverlay 0.3s ease-in forwards;
}

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

/* Modal Box */
.modal {
  background: #fff;
  padding: 20px; /* Reduced from 40px */
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
  text-align: center;
  width: 400px;  /* Fixed width */
  max-width: 90%;
  animation: fadeInScale 0.3s ease-out forwards;
  overflow-y: auto;
  max-height: 90vh;  /* Scroll if content gets long */
}
.modal input[type="text"],
.modal input[type="number"],
.modal textarea {
  margin-bottom: 10px;
}

@keyframes fadeInScale {
  0% {
    opacity: 0;
    transform: scale(0.9);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.modal h2 {
  margin-top: 0;
  font-size: 1.5em;
}

.modal button {
  margin: 10px 5px;
  padding: 10px 24px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(to right, #4facfe, #00f2fe);
  color: #fff;
  font-size: 1em;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.3s ease;
}

.modal button:hover {
  transform: scale(1.05);
  background: linear-gradient(to right, #43e97b, #38f9d7);
}

.modal-close {
  margin-top: 30px;
  background: #eee !important;
  color: #444 !important;
  font-weight: bold;
  border: 1px solid #ccc;
}

/* Form Styles */
form {
  background-color: #fff;
  padding: 40px;
  border-radius: 20px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
  max-width: 700px;
  margin: 40px auto;
}

form label {
  display: block;
  margin-top: 20px;
  margin-bottom: 6px;
  font-weight: bold;
  font-size: 1em;
  text-align: left;
}

form input[type="text"],
form input[type="number"],
form textarea,
form select {
  width: 100%;
  padding: 10px;
  font-size: 1em;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-sizing: border-box;
}

form input[type="checkbox"] {
  width: auto;
  margin-left: 10px;
}

form input[type="submit"] {
  margin-top: 30px;
  padding: 12px 20px;
  font-size: 1em;
  background-color: #000;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

form input[type="submit"]:hover {
  background-color: #333;
}
