* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
  background: #f7f4f0;
  color: #2b2b2b;
}

.header {
  text-align: center;
  padding: 24px 16px 12px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.logo {
  height: 70px;
  width: auto;
}

.title {
  font-size: 1.6rem;
  margin: 0;
  color: #1a1a1a;
}

#admin-trigger {
  cursor: default;
  user-select: none;
}

.arabic-text {
  direction: rtl;
  font-size: 1.6rem;
  font-weight: bold;
  margin: 16px 0 6px;
  color: #4a4a4a;
}

.flags {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
}

.flag {
  height: 40px;
  width: auto;
  border: 1px solid #ddd;
}

.divider {
  border: none;
  border-top: 1px solid #ccc;
  margin: 16px auto 12px;
  width: 80%;
}

.notif-btn {
  background: #2c5f8a;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  cursor: pointer;
}

.notif-btn:disabled {
  background: #8aa9bd;
  cursor: default;
}

.condolences-list {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.condolence-card {
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
}

.condolence-img-wrap {
  width: 100%;
  height: 260px;
  background: #f0f0ee;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-in;
}

.condolence-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.condolence-remark {
  padding: 12px 12px 2px;
  border-top: 1px solid #e0e0e0;
  font-size: 0.95rem;
  flex-grow: 1;
}

.condolence-date {
  padding: 0 12px 10px;
  font-size: 0.78rem;
  color: #888;
}

.empty-state {
  text-align: center;
  color: #888;
  grid-column: 1 / -1;
  padding: 40px 0;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-box {
  background: #fff;
  border-radius: 10px;
  padding: 22px;
  width: 90%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-box h2 {
  margin: 0 0 6px;
  font-size: 1.2rem;
}

.modal-box input,
.modal-box textarea {
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
}

.modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.modal-actions button {
  flex: 1;
  padding: 9px;
  border: none;
  border-radius: 6px;
  background: #2c5f8a;
  color: #fff;
  font-size: 0.95rem;
  cursor: pointer;
}

.modal-actions button.secondary {
  background: #e0e0e0;
  color: #333;
}

.error-text {
  color: #c0392b;
  font-size: 0.85rem;
  margin: 0;
}

.error-text.hidden {
  display: none;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  cursor: zoom-out;
  padding: 24px;
}

.lightbox.hidden {
  display: none;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
  position: fixed;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}

/* Mobile: show only the 5 latest condolences */
@media (max-width: 640px) {
  .condolences-list {
    display: block;
  }
  .condolence-card:nth-child(n + 6) {
    display: none;
  }
}
