/* ========================================
   GLOBAL RESET & BASE
   ======================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: #1e293b;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Make media fit smaller screens */
img,
video {
  max-width: 100%;
  height: auto;
}

/* Prevent layout overflow from long words/URLs */
* {
  overflow-wrap: anywhere;
}

.dark body {
  color: #e2e8f0;
}

/* ========================================
   ANIMATED BACKGROUND BLOBS
   ======================================== */
.bg-blob {
  position: absolute;
  will-change: transform;
}

.bg-blob-1 {
  top: -8%;
  left: -5%;
  animation: blobFloat1 24s ease-in-out infinite;
}
.bg-blob-2 {
  top: 35%;
  right: -8%;
  animation: blobFloat2 28s ease-in-out infinite;
}
.bg-blob-3 {
  bottom: 5%;
  left: 20%;
  animation: blobFloat3 22s ease-in-out infinite;
}
.bg-blob-4 {
  top: 60%;
  left: 55%;
  animation: blobFloat4 20s ease-in-out infinite;
}

@keyframes blobFloat1 {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  20% {
    transform: translate(70px, -80px) scale(1.08);
  }
  40% {
    transform: translate(-40px, 60px) scale(0.95);
  }
  60% {
    transform: translate(80px, 40px) scale(1.05);
  }
  80% {
    transform: translate(-30px, -40px) scale(0.98);
  }
}
@keyframes blobFloat2 {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  25% {
    transform: translate(-80px, 60px) scale(1.12);
  }
  50% {
    transform: translate(50px, -70px) scale(0.88);
  }
  75% {
    transform: translate(-60px, -30px) scale(1.07);
  }
}
@keyframes blobFloat3 {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  33% {
    transform: translate(60px, -70px) scale(1.15);
  }
  66% {
    transform: translate(-70px, 50px) scale(0.85);
  }
}
@keyframes blobFloat4 {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(-90px, -60px) scale(1.1);
  }
}

/* Subtle grid pattern */
.bg-grid-pattern {
  background-image: linear-gradient(rgba(99, 102, 241, 0.5) 1px, transparent 1px), linear-gradient(90deg, rgba(99, 102, 241, 0.5) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* ========================================
   NAVBAR POLISH
   ======================================== */
.nav-link {
  position: relative;
  transition: all 0.2s ease;
}
.nav-link::after {
  content: "";
  position: absolute;
  bottom: 2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #2563eb, #10b981);
  border-radius: 2px;
  transform: translateX(-50%);
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.nav-link:hover::after {
  width: 70%;
}

/* ========================================
   TYPOGRAPHY
   ======================================== */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 800;
  line-height: 1.15;
  color: #0f172a;
}
.dark h1,
.dark h2,
.dark h3,
.dark h4,
.dark h5,
.dark h6 {
  color: #f8fafc;
}
p {
  color: #475569;
  margin-bottom: 0.75rem;
}
.dark p {
  color: #94a3b8;
}

a {
  color: #2563eb;
  text-decoration: none;
  transition: color 0.2s ease;
}
a:hover {
  color: #1d4ed8;
}

/* ========================================
   LINE CLAMPING
   ======================================== */
.line-clamp-1,
.line-clamp-2,
.line-clamp-3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.line-clamp-1 {
  -webkit-line-clamp: 1;
}
.line-clamp-2 {
  -webkit-line-clamp: 2;
}
.line-clamp-3 {
  -webkit-line-clamp: 3;
}

/* ========================================
   SCROLLBAR
   ======================================== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #94a3b8;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}
.dark ::-webkit-scrollbar-track {
  background: #0f172a;
}
.dark ::-webkit-scrollbar-thumb {
  background: #334155;
}
.dark ::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* ========================================
   CARD STYLES
   ======================================== */
.card {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
  border-radius: 1.25rem;
  border: 1px solid rgba(226, 232, 240, 0.8);
  padding: 2rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.07);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.dark .card {
  background: rgba(15, 23, 42, 0.8);
  border-color: rgba(51, 65, 85, 0.6);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}
.card:hover {
  box-shadow: 0 12px 40px rgba(37, 99, 235, 0.15);
  transform: translateY(-4px);
}

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-24px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(24px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes float {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-12px);
  }
}
@keyframes glow {
  0%,
  100% {
    box-shadow:
      0 0 20px rgba(37, 99, 235, 0.4),
      0 0 40px rgba(16, 185, 129, 0.2);
  }
  50% {
    box-shadow:
      0 0 40px rgba(37, 99, 235, 0.7),
      0 0 80px rgba(16, 185, 129, 0.4);
  }
}
@keyframes pulse-ring {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 10px rgba(37, 99, 235, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
  }
}
@keyframes marquee {
  0% {
    transform: translateX(100%);
  }
  100% {
    transform: translateX(-100%);
  }
}

/* Utility animation classes */
.animate-fade-in-up {
  animation: fadeInUp 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  opacity: 0;
}
.animate-slide-in {
  animation: slideInLeft 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  opacity: 0;
}
.animate-slide-in-right {
  animation: slideInRight 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  opacity: 0;
}
.animate-scale-in {
  animation: scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  opacity: 0;
}
.animate-float {
  animation: float 5s ease-in-out infinite;
}
.animate-glow {
  animation: glow 3s ease-in-out infinite;
}
.animate-marquee {
  animation: marquee 30s linear infinite;
}
.animate-marquee:hover {
  animation-play-state: paused;
}

/* Stagger delays */
.stagger-1 {
  animation-delay: 0.08s;
}
.stagger-2 {
  animation-delay: 0.16s;
}
.stagger-3 {
  animation-delay: 0.24s;
}
.stagger-4 {
  animation-delay: 0.32s;
}
.stagger-5 {
  animation-delay: 0.4s;
}
.stagger-6 {
  animation-delay: 0.48s;
}

/* ========================================
   BUTTONS
   ======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.5rem;
  border-radius: 0.75rem;
  font-weight: 600;
  font-size: 0.875rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}
.btn:hover {
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}
.btn-primary:hover {
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.5);
}

.btn-success {
  background: linear-gradient(135deg, #059669, #047857);
  color: #fff;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35);
}
.btn-success:hover {
  box-shadow: 0 8px 24px rgba(5, 150, 105, 0.5);
}

.btn-danger {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: #fff;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.35);
}

/* ========================================
   FORM STYLES
   ======================================== */
.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid #e2e8f0;
  border-radius: 0.75rem;
  font-size: 0.9rem;
  background: rgba(248, 250, 252, 0.9);
  color: #0f172a;
  transition: all 0.2s ease;
}
.dark .form-control {
  background: rgba(15, 23, 42, 0.7);
  border-color: #334155;
  color: #f8fafc;
}
.form-control:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* ========================================
   ALERTS
   ======================================== */
.alert {
  padding: 1rem 1.25rem;
  border-radius: 0.875rem;
  border-left: 4px solid;
  margin-bottom: 1rem;
  animation: slideInLeft 0.3s ease;
}
.alert-success {
  background: rgba(5, 150, 105, 0.08);
  color: #065f46;
  border-color: #059669;
}
.alert-danger {
  background: rgba(220, 38, 38, 0.08);
  color: #7f1d1d;
  border-color: #dc2626;
}
.alert-warning {
  background: rgba(217, 119, 6, 0.08);
  color: #78350f;
  border-color: #d97706;
}
.alert-info {
  background: rgba(37, 99, 235, 0.08);
  color: #1e3a5f;
  border-color: #2563eb;
}

/* ========================================
   NEWS STYLES
   ======================================== */
.featured-article {
  animation: fadeInUp 0.6s ease;
}
.featured-article > div {
  border-radius: 1rem;
  overflow: hidden;
  transition: all 0.3s ease;
}
.featured-article:hover > div {
  box-shadow: 0 12px 40px rgba(37, 99, 235, 0.18);
  transform: translateY(-2px);
}

.news-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #e2e8f0;
  transition: all 0.25s ease;
}
.dark .news-card {
  background: rgba(15, 23, 42, 0.8);
  border-color: #1e293b;
}
.news-card:hover {
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.15);
  transform: translateY(-4px);
}

.list-news-item {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #e2e8f0;
  transition: all 0.2s ease;
}
.dark .list-news-item {
  background: rgba(15, 23, 42, 0.8);
  border-color: #1e293b;
}
.list-news-item:hover {
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.12);
  transform: translateY(-2px);
}

/* Category Tabs */
.category-tab {
  position: relative;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}
.category-tab.active {
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
  transform: translateY(-2px);
}
.category-tab:not(.active):hover {
  transform: translateY(-1px);
}

/* Breaking ticker */
.animate-marquee {
  animation: marquee 30s linear infinite;
}
.animate-marquee:hover {
  animation-play-state: paused;
}

/* Three.js canvas */
.three-container {
  cursor: grab;
}
.three-container:active {
  cursor: grabbing;
}
#ukm-globe {
  border-radius: inherit;
}

/* ========================================
   LAYOUT & GRID
   ======================================== */
.container {
  max-width: 80rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ========================================
   HOVER UTILITIES
   ======================================== */
.hover-lift:hover {
  transform: translateY(-6px) !important;
}
.hover-scale:hover {
  transform: scale(1.03) !important;
}
.hover-shadow:hover {
  box-shadow: 0 16px 40px rgba(37, 99, 235, 0.2) !important;
}

/* Shadow utilities */
.shadow-blue {
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.25);
}
.shadow-green {
  box-shadow: 0 8px 24px rgba(5, 150, 105, 0.25);
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
  h1 {
    font-size: 1.75rem;
  }
  h2 {
    font-size: 1.5rem;
  }
  h3 {
    font-size: 1.125rem;
  }
  .card {
    padding: 1.25rem;
  }
  .category-tab {
    min-width: 72px;
    font-size: 0.8125rem;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.5rem;
  }
  h2 {
    font-size: 1.25rem;
  }
}

/* ========================================
   DARK MODE OVERRIDES
   ======================================== */
.dark .news-card,
.dark .list-news-item {
  border-color: rgba(51, 65, 85, 0.5);
}

/* Font inter helper */
.font-inter {
  font-family: "Inter", sans-serif;
}

/* Rounded-2xl enhanced shadows */
.rounded-2xl {
  transition:
    box-shadow 0.3s ease,
    transform 0.3s ease;
}
.rounded-2xl:hover {
  box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.15) !important;
}

/* Glass card helper */
.glass {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.4);
}
.dark .glass {
  background: rgba(15, 23, 42, 0.75);
  border-color: rgba(51, 65, 85, 0.5);
}

/* ── Leaflet UKM Map ── */
#ukm-map {
  position: relative;
  z-index: 1;
}
/* Pastikan tile gambar tidak difilter oleh dark mode */
#ukm-map img,
#ukm-map .leaflet-tile {
  filter: none !important;
  -webkit-filter: none !important;
}
.ukm-tooltip {
  background: rgba(15, 23, 42, 0.88) !important;
  border: none !important;
  border-radius: 6px !important;
  color: #f1f5f9 !important;
  font-size: 10px !important;
  font-weight: 700 !important;
  padding: 3px 8px !important;
  white-space: nowrap !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}
.ukm-tooltip::before {
  display: none !important;
}
.leaflet-popup-content-wrapper {
  border-radius: 12px !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important;
}
.leaflet-popup-tip {
  display: none !important;
}
.leaflet-container {
  font-family: "Inter", sans-serif;
}
