/* ===== ANIMASI GLOBAL ===== */

/* Fade In Animation */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Slide Up Animation */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Slide Down Animation */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Slide In From Left */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Slide In From Right */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(50px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Scale In Animation */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Pulse Animation */
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* Bounce Animation */
@keyframes bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* Glow Animation */
@keyframes glow {
  0%,
  100% {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  }
  50% {
    box-shadow: 0 4px 20px rgba(44, 88, 160, 0.15);
  }
}

/* Shimmer Animation (Loading) */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

/* Rotate Animation */
@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* ===== APLIKASI ANIMASI KE ELEMEN ===== */

/* Page Title */
.page-title {
  animation: slideDown 0.6s ease-out;
}

/* Incident Container */
.incident-container {
  animation: slideUp 0.7s ease-out;
}

/* Incident Item - Staggered Animation */
.incident-item {
  animation: slideUp 0.5s ease-out;
  animation-fill-mode: both;
}

.incident-item:nth-child(1) {
  animation-delay: 0.1s;
}
.incident-item:nth-child(2) {
  animation-delay: 0.2s;
}
.incident-item:nth-child(3) {
  animation-delay: 0.3s;
}
.incident-item:nth-child(4) {
  animation-delay: 0.4s;
}
.incident-item:nth-child(5) {
  animation-delay: 0.5s;
}
.incident-item:nth-child(6) {
  animation-delay: 0.6s;
}
.incident-item:nth-child(7) {
  animation-delay: 0.7s;
}
.incident-item:nth-child(8) {
  animation-delay: 0.8s;
}
.incident-item:nth-child(9) {
  animation-delay: 0.9s;
}
.incident-item:nth-child(10) {
  animation-delay: 1s;
}

/* Badge Status Bounce on Hover */
.badge-status {
  transition: all 0.3s ease;
}

.incident-item:hover .badge-status {
  animation: bounce 0.6s ease;
}

/* Filter Dropdown */
.filter-dropdown {
  animation: slideUp 0.6s ease-out 0.2s both;
  transition: all 0.3s ease;
}

.filter-dropdown:focus {
  animation: glow 0.6s ease infinite;
}

/* Buttons Animation */
.btn {
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

/* Button Ripple Effect */
.btn::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.btn:active::before {
  animation: ripple 0.6s ease-out;
}

@keyframes ripple {
  0% {
    width: 0;
    height: 0;
    opacity: 1;
  }
  100% {
    width: 300px;
    height: 300px;
    opacity: 0;
  }
}

/* ===== DASHBOARD ANIMATIONS ===== */

/* Stat Cards */
.stat-card {
  animation: slideUp 0.6s ease-out;
  animation-fill-mode: both;
}

.stat-card:nth-child(1) {
  animation-delay: 0.2s;
}
.stat-card:nth-child(2) {
  animation-delay: 0.4s;
}
.stat-card:nth-child(3) {
  animation-delay: 0.6s;
}

.stat-card {
  transition: all 0.3s ease;
}

.stat-card:hover {
  animation: bounce 0.5s ease;
}

/* Chart Wrapper */
.chart-wrapper {
  animation: slideUp 0.7s ease-out 0.8s both;
}

/* ===== FORM & INPUT ANIMATIONS ===== */

.form-control,
.form-select {
  transition: all 0.3s ease;
}

.form-control:focus,
.form-select:focus {
  animation: glow 0.4s ease;
  transform: scale(1.02);
}

input::placeholder {
  animation: fadeIn 0.5s ease;
}

/* ===== LOADING STATE ===== */

.loading {
  animation: shimmer 2s infinite;
  background: linear-gradient(90deg, #f0f0f0 0%, #e0e0e0 50%, #f0f0f0 100%);
  background-size: 1000px 100%;
}

.spinner {
  animation: rotate 1s linear infinite;
}

/* ===== SIDEBAR ANIMATIONS ===== */

.sidebar {
  animation: slideInLeft 0.5s ease-out;
}

.sidebar-item,
.nav-link {
  transition: all 0.3s ease;
}

.nav-link:hover {
  padding-left: 25px;
  animation: slideInRight 0.3s ease;
}

.nav-link.active {
  animation: glow 0.5s ease;
}

/* ===== HEADER ANIMATIONS ===== */

.header {
  animation: slideDown 0.5s ease-out;
}

/* ===== MODAL & POPUP ANIMATIONS ===== */

.modal {
  animation: fadeIn 0.3s ease-out;
}

.modal-content {
  animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-backdrop {
  animation: fadeIn 0.3s ease-out;
}

/* ===== ALERT ANIMATIONS ===== */

.alert {
  animation: slideDown 0.4s ease-out;
}

.alert-dismissible .btn-close {
  transition: all 0.3s ease;
}

.alert-dismissible .btn-close:hover {
  animation: rotate 0.3s ease;
}

/* ===== LINK & TEXT ANIMATIONS ===== */

a {
  transition: all 0.3s ease;
  position: relative;
}

a:not(.btn):not(.nav-link):hover {
  color: #2c58a0;
  text-shadow: 0 0 10px rgba(44, 88, 160, 0.3);
}

/* ===== DETAIL PAGE ANIMATIONS ===== */

.detail-container {
  animation: slideUp 0.6s ease-out;
}

.detail-card {
  animation: slideUp 0.5s ease-out;
  animation-fill-mode: both;
}

.detail-card:nth-child(1) {
  animation-delay: 0.1s;
}
.detail-card:nth-child(2) {
  animation-delay: 0.2s;
}
.detail-card:nth-child(3) {
  animation-delay: 0.3s;
}
.detail-card:nth-child(4) {
  animation-delay: 0.4s;
}

/* ===== TABLE ANIMATIONS ===== */

table {
  animation: slideUp 0.6s ease-out;
}

tbody tr {
  animation: fadeIn 0.4s ease-out;
  animation-fill-mode: both;
}

tbody tr:nth-child(1) {
  animation-delay: 0.1s;
}
tbody tr:nth-child(2) {
  animation-delay: 0.2s;
}
tbody tr:nth-child(3) {
  animation-delay: 0.3s;
}
tbody tr:nth-child(4) {
  animation-delay: 0.4s;
}
tbody tr:nth-child(5) {
  animation-delay: 0.5s;
}

tbody tr:hover {
  background-color: #f8f9fa !important;
  animation: glow 0.3s ease;
  transform: scale(1.01);
}

/* ===== BADGE ANIMATIONS ===== */

.badge {
  animation: scaleIn 0.4s ease-out;
}

.badge:hover {
  animation: bounce 0.4s ease;
}

/* ===== ICON ANIMATIONS ===== */

i {
  transition: all 0.3s ease;
}

.bi-trash:hover,
.bi-pencil:hover,
.bi-eye:hover {
  animation: rotate 0.3s ease;
  color: #dc3545 !important;
}

/* ===== SUCCESS/ERROR MESSAGE ANIMATIONS ===== */

.success-message,
.error-message {
  animation: slideDown 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.success-message {
  animation-delay: 0.3s;
}

/* ===== SCROLL ANIMATION TRIGGER ===== */

.scroll-animate {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s ease;
}

.scroll-animate.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* ===== SMOOTH TRANSITIONS ===== */

* {
  transition: background-color 0.3s ease, color 0.3s ease;
}

body {
  animation: fadeIn 0.5s ease-out;
}

/* ===== RESPONSIVE ANIMATIONS ===== */

@media (max-width: 768px) {
  .incident-item {
    animation: slideUp 0.4s ease-out;
  }

  .stat-card {
    animation: slideUp 0.4s ease-out;
  }

  .btn {
    animation: scaleIn 0.3s ease-out;
  }
}
