/**
 * Dalia Loading States
 * Reusable loading komponente za cijelu aplikaciju
 */

/* ============================================
   LOADING SPINNER
   ============================================ */

.dalia-loader {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.dalia-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(232, 207, 154, 0.2);
    border-top-color: #e8cf9a;
    border-radius: 50%;
    animation: dalia-spinner-rotate 0.8s linear infinite;
}

.dalia-spinner-sm {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

.dalia-spinner-lg {
    width: 40px;
    height: 40px;
    border-width: 4px;
}

.dalia-spinner-xl {
    width: 64px;
    height: 64px;
    border-width: 5px;
}

@keyframes dalia-spinner-rotate {
    to { transform: rotate(360deg); }
}

/* Spinner s tekstom */
.dalia-loader-text {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}

/* ============================================
   FULL PAGE LOADER
   ============================================ */

.dalia-page-loader {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #faf8f5 0%, #f5f0e8 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
    z-index: 9998;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.dalia-page-loader.fade-out {
    opacity: 0;
    pointer-events: none;
}

.dalia-page-loader-content {
    text-align: center;
    max-width: 400px;
    padding: 0 24px;
}

.dalia-page-loader-title {
    font-family: 'Playfair Display', serif;
    font-size: 24px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 12px;
    letter-spacing: -0.01em;
}

.dalia-page-loader-message {
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    color: #6b7280;
    line-height: 1.6;
}

/* ============================================
   SKELETON SCREENS
   ============================================ */

.dalia-skeleton {
    background: linear-gradient(
        90deg,
        #f3f4f6 0%,
        #e5e7eb 20%,
        #f3f4f6 40%,
        #f3f4f6 100%
    );
    background-size: 200% 100%;
    animation: dalia-skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 8px;
}

@keyframes dalia-skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

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

.dalia-skeleton-text:last-child {
    margin-bottom: 0;
    width: 60%;
}

.dalia-skeleton-title {
    height: 28px;
    width: 50%;
    margin-bottom: 16px;
}

.dalia-skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.dalia-skeleton-card {
    padding: 24px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.dalia-skeleton-image {
    width: 100%;
    height: 200px;
    border-radius: 8px;
}

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

.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: dalia-spinner-rotate 0.6s linear infinite;
}

/* Variant za dark buttons */
.btn-loading.btn-dark::after {
    border-color: rgba(0, 0, 0, 0.2);
    border-top-color: #1f2937;
}

/* ============================================
   PROGRESS BAR
   ============================================ */

.dalia-progress {
    width: 100%;
    height: 8px;
    background: #f3f4f6;
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.dalia-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #e8cf9a 0%, #c9a84c 100%);
    border-radius: 999px;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.dalia-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: dalia-progress-shimmer 1.5s infinite;
}

@keyframes dalia-progress-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Indeterminate progress */
.dalia-progress-indeterminate .dalia-progress-bar {
    width: 40% !important;
    animation: dalia-progress-indeterminate 1.5s ease-in-out infinite;
}

@keyframes dalia-progress-indeterminate {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(250%); }
}

/* ============================================
   OVERLAY LOADER (za inline content)
   ============================================ */

.dalia-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: inherit;
}

.dalia-loading-overlay-dark {
    background: rgba(0, 0, 0, 0.5);
}

/* ============================================
   DOTS LOADER (alternativni stil)
   ============================================ */

.dalia-dots-loader {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

.dalia-dots-loader span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e8cf9a;
    animation: dalia-dots-bounce 1.4s infinite ease-in-out both;
}

.dalia-dots-loader span:nth-child(1) {
    animation-delay: -0.32s;
}

.dalia-dots-loader span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes dalia-dots-bounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ============================================
   PULSE ANIMATION (za kartice koje se učitavaju)
   ============================================ */

.dalia-pulse {
    animation: dalia-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes dalia-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

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

.loading-hidden {
    display: none !important;
}

.loading-invisible {
    visibility: hidden !important;
}

/* Disable interactions during loading */
.is-loading {
    pointer-events: none;
    opacity: 0.6;
    cursor: wait;
}

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

@media (max-width: 640px) {
    .dalia-page-loader-title {
        font-size: 20px;
    }

    .dalia-page-loader-message {
        font-size: 14px;
    }
}
