/**
 * Loading States and Skeleton Screens
 */

/* Loading Spinner */
.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    padding: 40px 0;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: var(--theme-color, #2563eb);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Skeleton Loader Base */
.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Skeleton Variants */
.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.skeleton-title {
    height: 32px;
    width: 60%;
    margin-bottom: 16px;
    border-radius: 6px;
}

.skeleton-subtitle {
    height: 20px;
    width: 40%;
    margin-bottom: 12px;
    border-radius: 4px;
}

.skeleton-image {
    width: 100%;
    height: 300px;
    border-radius: 8px;
}

.skeleton-card {
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Hero Slider Skeleton */
.hero-skeleton {
    width: 100%;
    height: 100vh;
    background: linear-gradient(
        90deg,
        #e0e0e0 25%,
        #d0d0d0 50%,
        #e0e0e0 75%
    );
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    position: relative;
}

.hero-skeleton-content {
    position: absolute;
    bottom: 100px;
    left: 50px;
    max-width: 600px;
}

/* Service Card Skeleton */
.service-skeleton {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 30px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.service-skeleton-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
}

.service-skeleton-title {
    height: 24px;
    width: 70%;
}

.service-skeleton-text {
    height: 14px;
    width: 100%;
}

/* About Section Skeleton */
.about-skeleton {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    padding: 60px 0;
}

.about-skeleton-image {
    width: 100%;
    height: 500px;
    border-radius: 12px;
}

.about-skeleton-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Counter Skeleton */
.counter-skeleton {
    display: flex;
    justify-content: space-around;
    gap: 20px;
    padding: 40px 0;
}

.counter-skeleton-item {
    text-align: center;
    flex: 1;
}

.counter-skeleton-number {
    height: 48px;
    width: 120px;
    margin: 0 auto 10px;
}

/* Fade in animation for loaded content */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading overlay */
.loading-overlay {
    position: relative;
    min-height: 200px;
}

.loading-overlay::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

/* Hide loading state when content is loaded */
.loaded .skeleton,
.loaded .loading-spinner,
.loaded .loading-overlay::after {
    display: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .about-skeleton {
        grid-template-columns: 1fr;
    }

    .counter-skeleton {
        flex-direction: column;
    }

    .hero-skeleton-content {
        left: 20px;
        right: 20px;
    }
}

/* Error state */
.error-state {
    text-align: center;
    padding: 40px;
    color: #dc2626;
}

.error-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.error-state-message {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.error-state-retry {
    margin-top: 16px;
    padding: 10px 24px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
}

.error-state-retry:hover {
    background: #1d4ed8;
}
