/* ===================================
   ANIMATION KEYFRAMES
   Use these keyframes in your templates to create smooth animations

   USAGE EXAMPLES:

   1. Fade in container:
      .dashboard-container {
          opacity: 0;
          animation: fadeInPage 0.5s ease-in 0.1s forwards;
      }

   2. Fade in up with staggered delays:
      .stat-card {
          opacity: 0;
          transform: translateY(20px);
          animation: fadeInUp 0.5s ease-out forwards;
      }
      .stat-card:nth-child(1) { animation-delay: 0.15s; }
      .stat-card:nth-child(2) { animation-delay: 0.25s; }
      .stat-card:nth-child(3) { animation-delay: 0.35s; }

   3. Table rows with staggered animation:
      .modern-table tbody tr {
          opacity: 0;
          transform: translateY(10px);
          animation: fadeInUp 0.4s ease-out forwards;
      }
      .modern-table tbody tr:nth-child(1) { animation-delay: 0.75s; }
      .modern-table tbody tr:nth-child(2) { animation-delay: 0.8s; }
      .modern-table tbody tr:nth-child(3) { animation-delay: 0.85s; }

   =================================== */

/* ===================================
   PAGE LOAD ANIMATIONS
   =================================== */

/* Simple fade in - for containers */
@keyframes fadeInPage {
    to {
        opacity: 1;
    }
}

/* Fade in with upward slide - for cards, sections */
@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade in with downward slide */
@keyframes fadeInDown {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Fade in with left slide */
@keyframes fadeInLeft {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Fade in with right slide */
@keyframes fadeInRight {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===================================
   UTILITY ANIMATIONS
   =================================== */

/* Simple fade in */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Simple fade out */
@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

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

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

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

/* Pulse effect */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

/* Spinner rotation */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Shimmer loading effect */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

/* Ripple effect */
@keyframes ripple {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

.loader-content {
    text-align: center;
    color: white;
}

.loader-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.loader-text {
    font-size: 18px;
    font-weight: 500;
    letter-spacing: 0.5px;
    animation: pulse 2s ease-in-out infinite;
}

/* ===================================
   REFRESH BUTTON STYLES
   =================================== */

.refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
    position: relative;
    overflow: hidden;
}

.refresh-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
}

.refresh-btn:active:not(:disabled) {
    transform: translateY(0);
}

.refresh-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.refresh-btn-icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.refresh-btn.loading .refresh-btn-icon {
    animation: spin 1s linear infinite;
}

/* Ripple effect for button clicks */
.refresh-btn::after {
    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%);
    transition: width 0.6s, height 0.6s;
}

.refresh-btn:active::after {
    width: 300px;
    height: 300px;
}

/* ===================================
   CONTENT REFRESH CONTAINER
   =================================== */

.refresh-container {
    position: relative;
}

.refresh-container.loading {
    pointer-events: none;
    opacity: 0.6;
}

.refresh-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10;
    border-radius: 12px;
}

.refresh-container.loading .refresh-overlay {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.refresh-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(59, 130, 246, 0.3);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ===================================
   FORM SUBMISSION ANIMATIONS
   =================================== */

.form-submit-btn {
    position: relative;
    transition: all 0.3s ease;
}

.form-submit-btn.loading {
    pointer-events: none;
    opacity: 0.8;
}

.form-submit-btn .btn-text {
    transition: opacity 0.3s ease;
}

.form-submit-btn.loading .btn-text {
    opacity: 0;
}

.form-submit-btn .btn-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    display: none;
    animation: spin 0.8s linear infinite;
}

.form-submit-btn.loading .btn-spinner {
    display: block;
}

/* ===================================
   TABLE/LIST REFRESH ANIMATIONS
   =================================== */

.table-row-enter {
    animation: slideUp 0.4s ease;
}

.table-refresh-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.5rem 1rem;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    color: #0369a1;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    animation: slideDown 0.3s ease;
}

.table-refresh-indicator .spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(3, 105, 161, 0.3);
    border-top-color: #0369a1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ===================================
   SKELETON LOADING (For content placeholders)
   =================================== */

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
    border-radius: 4px;
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: 12px;
}

.skeleton-card {
    height: 120px;
    border-radius: 12px;
}

/* ===================================
   SUCCESS/ERROR FEEDBACK ANIMATIONS
   =================================== */

.success-feedback {
    animation: slideDown 0.4s ease, fadeOut 0.3s ease 2.7s forwards;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

.error-feedback {
    animation: slideDown 0.4s ease;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ===================================
   UTILITY CLASSES
   =================================== */

.fade-in {
    animation: fadeIn 0.5s ease;
}

.fade-out {
    animation: fadeOut 0.5s ease;
}

.slide-up {
    animation: slideUp 0.5s ease;
}

.slide-down {
    animation: slideDown 0.5s ease;
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

.smooth-transition {
    transition: all 0.3s ease;
}

/* ===================================
   NOTIFICATION BELL ANIMATION (Enhanced)
   =================================== */

.notification-bell-pulse {
    animation: pulse 2s ease-in-out infinite;
}

.notification-badge-pop {
    animation: pulse 0.5s ease;
}

/* ===================================
   RESPONSIVE ADJUSTMENTS
   =================================== */

@media (max-width: 768px) {
    .loader-spinner {
        width: 50px;
        height: 50px;
    }

    .loader-text {
        font-size: 16px;
    }

    .refresh-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
}

/* ===================================
   DARK MODE SUPPORT (Optional)
   =================================== */

@media (prefers-color-scheme: dark) {
    .refresh-overlay {
        background: rgba(30, 41, 59, 0.9);
    }

    .skeleton {
        background: linear-gradient(90deg, #334155 25%, #475569 50%, #334155 75%);
        background-size: 200% 100%;
    }
}