/* ==========================================================================
   SDS NURANI JAKARTA - UI COMPONENTS & MODALS
   ========================================================================== */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  line-height: 1.3;
  max-width: 100%;
  box-sizing: border-box;
}

@media (max-width: 640px) {
  .btn {
    white-space: normal;
    text-align: center;
  }
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #059669 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(6, 95, 70, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #047857 0%, #065f46 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(6, 95, 70, 0.35);
  color: #ffffff;
}

.btn-secondary {
  background: #ffffff;
  color: var(--primary);
  border-color: var(--border-color);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--primary-soft);
  border-color: var(--primary-light);
  transform: translateY(-2px);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent) 0%, #d97706 100%);
  color: #000000;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.4);
}

/* AI Smart Button */
.btn-ai {
  background: linear-gradient(135deg, #065f46 0%, #10b981 50%, #f59e0b 100%);
  background-size: 200% 200%;
  color: #ffffff;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.35);
  animation: shimmer 4s ease infinite;
}

.btn-ai:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
  color: #ffffff;
}

@keyframes shimmer {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.btn-outline {
  background: transparent;
  color: #ffffff;
  border: 2px solid rgba(255, 255, 255, 0.7);
}

.btn-outline:hover {
  background: #ffffff;
  color: var(--primary);
}

.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
}

.btn-block {
  width: 100%;
}

/* Badges */
.badge-cat {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-pengumuman {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.badge-kegiatan {
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid #a7f3d0;
}

.badge-prestasi {
  background: var(--accent-soft);
  color: #b45309;
  border: 1px solid #fde68a;
}

/* Cards Berita */
.berita-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
}

.berita-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-xl);
  border-color: #a7f3d0;
}

.berita-image-wrapper {
  position: relative;
  height: 210px;
  overflow: hidden;
  background: #e2e8f0;
}

.berita-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.berita-card:hover .berita-image-wrapper img {
  transform: scale(1.05);
}

.berita-badge-overlay {
  position: absolute;
  top: 1rem;
  left: 1rem;
}

.berita-card-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.berita-date {
  font-size: 0.8rem;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.berita-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.35;
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: color 0.2s ease;
}

.berita-title:hover {
  color: var(--primary);
}

.berita-summary {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1.25rem;
  flex-grow: 1;
}

.berita-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.btn-read-more {
  color: var(--primary);
  font-weight: 700;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: none;
  border: none;
  cursor: pointer;
}

.btn-read-more:hover {
  text-decoration: underline;
}

/* Galeri Cards */
.galeri-card {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  height: 240px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  background: #cbd5e1;
}

.galeri-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.galeri-card:hover img {
  transform: scale(1.08);
}

.galeri-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(2, 44, 34, 0.9) 0%, rgba(2, 44, 34, 0.2) 60%, transparent 100%);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.25rem;
  opacity: 0.9;
  transition: opacity 0.3s ease;
}

.galeri-overlay h4 {
  color: #ffffff;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.3rem;
}

.galeri-overlay p {
  color: #a7f3d0;
  font-size: 0.75rem;
  line-height: 1.4;
}

.galeri-zoom-icon {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(5px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.1rem;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-container {
  background: #ffffff;
  width: 100%;
  max-width: 680px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.95) translateY(10px);
  transition: all 0.3s ease;
}

.modal-overlay.active .modal-container {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
}

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
}

.modal-close:hover {
  color: #ef4444;
  background: #fee2e2;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background: var(--bg-main);
}

/* Forms in Modal AI */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background: #ffffff;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

/* Image Upload / Dropzone */
.image-upload-zone {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  background: var(--bg-main);
  transition: all 0.2s ease;
  position: relative;
}

.image-upload-zone:hover {
  border-color: var(--primary-light);
  background: var(--primary-soft);
}

.preview-container {
  display: none;
  position: relative;
  max-height: 200px;
  overflow: hidden;
  border-radius: var(--radius-sm);
  margin-top: 0.75rem;
}

.preview-container img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.btn-remove-preview {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  cursor: pointer;
}

/* Quick Topic Presets */
.topic-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.preset-chip {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.preset-chip:hover {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: #a7f3d0;
}

/* AI Generation Preview Box */
.ai-preview-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-top: 1.25rem;
  position: relative;
}

.ai-preview-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #15803d;
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  margin-bottom: 0.75rem;
}

/* Lightbox Modal */
.modal-lightbox {
  background: transparent;
  max-width: 900px;
  box-shadow: none;
}

.lightbox-img-wrapper {
  max-height: 75vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.lightbox-img-wrapper img {
  max-height: 75vh;
  width: auto;
  object-fit: contain;
}

.lightbox-caption {
  background: #ffffff;
  padding: 1.25rem;
  border-radius: var(--radius-md);
  margin-top: 0.75rem;
}

/* Article Reader Modal */
.article-modal-img {
  width: 100%;
  height: 280px;
  object-fit: cover;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
}

.article-modal-content {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text-main);
  white-space: pre-line;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: #065f46;
  color: #ffffff;
  padding: 0.85rem 1.35rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 640px) {
  .modal-overlay {
    padding: 0.5rem;
  }
  .modal-container {
    max-height: 92vh;
    border-radius: var(--radius-md);
  }
  .modal-header {
    padding: 1rem 1.15rem;
  }
  .modal-header h3 {
    font-size: 1.1rem;
  }
  .modal-body {
    padding: 1.15rem;
  }
  .modal-footer {
    padding: 0.85rem 1.15rem;
  }
  .article-modal-img {
    height: 200px;
  }
  .lightbox-img-wrapper {
    max-height: 55vh;
  }
  .lightbox-img-wrapper img {
    max-height: 55vh;
  }
  .lightbox-caption {
    padding: 1rem;
  }
}
