.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  background-color: rgba(0, 0, 0, 0.6);
  animation: fadeIn 0.3s;
  padding: 20px 0;
  -webkit-overflow-scrolling: touch;
}

.modal.show {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  background-color: #fefefe;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 500px;
  position: relative;
  animation: slideDown 0.3s;
  margin: 20px auto;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

/* Mobile optimizations */
@media (max-width: 768px) {
  .modal {
    padding: 10px 0;
  }
  .modal-content {
    width: 95%;
    padding: 20px 15px;
    margin: 10px auto;
    max-height: calc(100vh - 20px);
    border-radius: 8px;
  }

  .modal-header h2 {
    font-size: 20px;
  }

  .modal-header p {
    font-size: 13px;
  }

  .close {
    right: 10px;
    top: 10px;
    font-size: 28px;
  }
}

@keyframes slideDown {
  from {
    transform: translateY(-50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  margin-bottom: 20px;
  border-bottom: 2px solid #e74c3c;
  padding-bottom: 15px;
}

.modal-header h2 {
  margin: 0 0 10px 0;
  color: #c0392b;
  font-size: 24px;
}

.modal-header p {
  margin: 5px 0;
  color: #555;
  font-size: 18px;
}

.modal-header .dijete-name {
  font-weight: bold;
  color: #2c3e50;
}

.close {
  position: absolute;
  right: 20px;
  top: 20px;
  color: #aaa;
  font-size: 32px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s;
  line-height: 1;
}

.close:hover,
.close:focus {
  color: #e74c3c;
}

.form-group {
  margin-bottom: 8px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: #2c3e50;
  font-weight: 600;
  font-size: 14px;
}

.form-group input {
  width: 100%;
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 6px;
  font-size: 15px;
  transition: border-color 0.3s;
  box-sizing: border-box;
}

.form-group input:focus {
  outline: none;
  border-color: #3498db;
}

.form-group input.error {
  border-color: #e74c3c;
}

.error-message {
  color: #e74c3c;
  font-size: 12px;
  margin-top: 5px;
  display: none;
}

.btn-submit {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
  margin-top: 10px;
}

.btn-submit:hover:not(:disabled) {
  background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
}

.btn-submit:active:not(:disabled) {
  transform: translateY(0);
}

.btn-submit:disabled {
  background: #95a5a6;
  cursor: not-allowed;
  transform: none;
}

/* Success/Error messages */
.message {
  padding: 15px;
  border-radius: 6px;
  margin-bottom: 20px;
  display: none;
  animation: slideDown 0.3s;
}

.message.show {
  display: block;
}

.message.success {
  background: #27ae60;
  color: white;
}

.message.error {
  background: #e74c3c;
  color: white;
}

/* Loading spinner */
.spinner {
  display: none;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.btn-submit.loading .spinner {
  display: block;
}

.btn-submit.loading .btn-text {
  display: none;
}

/* Grid styles */
.cards {
  padding: 20px 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.griditem {
  position: relative;
}

.gridlink {
  display: block;
  padding: 20px;
  background: #feeee0;
  border: 2px solid #ddd;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  text-align: center;
}

.gridlink:hover:not(.zelja-ispunjena) {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.gridlink.zelja-otvorena {
  border-color: #026c3f;
}

.gridlink.zelja-ispunjena {
  border-color: #95a5a6;
  opacity: 0.6;
  pointer-events: none;
}

.gridimg {
  width: 120px;
  height: 120px;
  object-fit: contain;
}

@media (max-width: 768px) {
  .gridimg {
    width: 80px;
    height: 80px;
  }
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
}
