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

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: #f8f9fa;
  color: #333;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

header {
  background: linear-gradient(135deg, #007bff, #00c6ff);
  color: white;
  padding: 30px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.controls {
  margin-top: 15px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

#searchBox {
  width: 250px;
  max-width: 400px;
  padding: 10px;
  border-radius: 8px;
  border: none;
  outline: none;
  font-size: 1em;
}

#langToggle {
  background: white;
  border: none;
  padding: 10px 15px;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  color: #007bff;
  transition: all 0.2s;
}

#langToggle:hover {
  background: #eaf4ff;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  padding: 30px;
  flex: 1;
  align-items: stretch;
}

.card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  padding: 20px;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}

.card h2 {
  color: #0077cc;
  margin-bottom: 10px;
}

.card p {
  font-size: 0.95em;
  margin: 6px 0;
}

.card .description {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  margin-bottom: 10px;
}

.card .card-footer {
  margin-top: auto;
  padding-top: 10px;
}

.card a {
  display: inline-block;
  color: #0077cc;
  text-decoration: none;
  font-weight: bold;
}

.card a:hover {
  text-decoration: underline;
}

footer {
  text-align: center;
  padding: 15px;
  background: #eee;
  font-size: 0.9em;
}

/* ------------------- LOADING SPINNER ------------------- */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  padding: 40px;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #007bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-text {
  margin-top: 20px;
  color: #666;
  font-size: 1.1em;
  font-weight: 500;
}

/* ------------------- MODAL POPUP ------------------- */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.5);
  animation: fadeIn 0.3s;
}

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

.modal-content {
  background-color: #fefefe;
  margin: 5% auto;
  padding: 30px;
  border: none;
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  animation: slideDown 0.3s;
  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;
  position: absolute;
  right: 20px;
  top: 20px;
  cursor: pointer;
  line-height: 1;
}

.close:hover,
.close:focus {
  color: #000;
  text-decoration: none;
}

#modal-body h2 {
  color: #0077cc;
  margin-bottom: 20px;
  padding-right: 30px;
}

#modal-body .modal-field {
  margin: 12px 0;
  font-size: 1em;
}

#modal-body .modal-field strong {
  color: #555;
  display: inline-block;
  min-width: 120px;
}

#modal-body .modal-description {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #eee;
  line-height: 1.6;
}

#modal-body .modal-website {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #eee;
}

#modal-body .modal-website a {
  display: inline-block;
  padding: 10px 20px;
  background: #007bff;
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-weight: bold;
  transition: background 0.2s;
}

#modal-body .modal-website a:hover {
  background: #0056b3;
}
