/* ===== Reset & Base ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: #0f1a2e;
  color: #e4e8f0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ===== Header ===== */
header {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  padding: 2.5rem 2rem 1rem;
}

header h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #ffffff;
}

.header-actions {
  position: absolute;
  right: 2rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 0.5rem;
}

.header-btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #8892a6;
  padding: 0.5rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
}

/* ===== Main ===== */
main {
  padding: 1.5rem 2rem 6rem;
  max-width: 1400px;
  margin: 0 auto;
}

/* ===== Project Grid ===== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 1.25rem;
}

/* ===== Project Card ===== */
.project-card {
  border-radius: 14px;
  border: 2px solid;
  padding: 0;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  display: flex;
  flex-direction: column;
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}

.card-image {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: 12px 12px 0 0;
  display: block;
}

.card-body {
  padding: 1.25rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  flex: 1;
}

.card-name {
  font-size: 1.2rem;
  font-weight: 600;
  color: #ffffff;
  text-decoration: none;
  transition: color 0.2s ease;
  cursor: pointer;
  display: inline-block;
  width: fit-content;
}

.card-name:hover {
  color: #a0c4ff;
}

.card-description {
  font-size: 0.9rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.7);
}

/* Admin controls on each card */
.card-admin-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.75rem;
}

.card-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #a0aec0;
  font-size: 0.78rem;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.card-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.card-btn.delete:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: #5a6578;
  font-size: 1.1rem;
}

/* ===== FAB ===== */
.fab {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #ffffff;
  color: #0f1a2e;
  border: none;
  font-size: 1.8rem;
  font-weight: 300;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  z-index: 100;
}

.fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.45);
}

.fab span {
  line-height: 1;
  margin-top: -2px;
}

/* ===== Modals ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: #162036;
  border-radius: 16px;
  padding: 2rem;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

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

.modal-content label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: #8892a6;
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.modal-content input[type="text"],
.modal-content input[type="url"],
.modal-content input[type="password"],
.modal-content textarea,
.modal-content select {
  width: 100%;
  background: #0f1a2e;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e4e8f0;
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  font-size: 0.95rem;
  font-family: inherit;
  margin-bottom: 1rem;
  transition: border-color 0.2s ease;
  outline: none;
}

.modal-content input:focus,
.modal-content textarea:focus,
.modal-content select:focus {
  border-color: rgba(160, 196, 255, 0.4);
}

.modal-content textarea {
  resize: vertical;
}

.modal-content select {
  cursor: pointer;
}

/* Color inputs */
.color-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.color-field {
  flex: 1;
}

.color-field label {
  margin-bottom: 0.35rem;
}

.color-input-wrap {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.color-input-wrap input[type="color"] {
  width: 40px;
  height: 38px;
  padding: 2px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: #0f1a2e;
  cursor: pointer;
  flex-shrink: 0;
}

.color-input-wrap input[type="text"] {
  flex: 1;
  margin-bottom: 0;
}

/* Error */
.error-msg {
  color: #ef4444;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

/* Buttons */
.form-buttons {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.btn-submit {
  flex: 1;
  background: #3b82f6;
  color: white;
  border: none;
  padding: 0.7rem 1.25rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn-submit:hover {
  background: #2563eb;
}

.btn-cancel {
  flex: 1;
  background: transparent;
  color: #8892a6;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.7rem 1.25rem;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-cancel:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #e4e8f0;
}

.btn-danger {
  background: #ef4444;
}

.btn-danger:hover {
  background: #dc2626;
}

.delete-confirm p {
  color: #a0aec0;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

/* ===== Utility ===== */
.hidden {
  display: none !important;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  header {
    padding: 2rem 1.25rem 0.75rem;
  }

  header h1 {
    font-size: 1.5rem;
  }

  .header-actions {
    right: 1.25rem;
  }

  main {
    padding: 1rem 1.25rem 6rem;
  }

  .projects-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .modal-content {
    padding: 1.5rem;
    width: 95%;
  }

  .color-row {
    flex-direction: column;
    gap: 0;
  }

  .color-field {
    margin-bottom: 1rem;
  }
}

@media (max-width: 400px) {
  .projects-grid {
    grid-template-columns: 1fr;
  }
}
