/* ============================================================================
   Skeleton Loader Styles
   Description: Animated skeleton/placeholder loading states
   ============================================================================ */

/* Base Skeleton Styles */
.skeleton-loader-container {
    width: 100%;
}

/* Base animated skeleton element (used with dimension modifiers like skeleton-text, skeleton-button, etc.) */
.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 0px,
        #e8e8e8 40px,
        #f0f0f0 80px
    );
    background-size: 300px 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
    display: block;
}

/* Skeleton Animation */
@keyframes skeleton-loading {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.skeleton-animate {
    background: linear-gradient(
        90deg,
        #f0f0f0 0px,
        #e0e0e0 40px,
        #f0f0f0 80px
    );
    background-size: 200px 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .skeleton-animate {
        background: linear-gradient(
            90deg,
            #2a2a2a 0px,
            #3a3a3a 40px,
            #2a2a2a 80px
        );
    }
}

/* Base Skeleton Elements */
.skeleton-text {
    height: 12px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.skeleton-text-sm {
    height: 10px;
}

.skeleton-text-md {
    height: 14px;
}

.skeleton-text-lg {
    height: 18px;
}

.skeleton-text-xl {
    height: 24px;
}

.skeleton-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.skeleton-button {
    height: 38px;
    border-radius: 4px;
    width: 100%;
}

.skeleton-input {
    height: 45px;
    border-radius: 4px;
    width: 100%;
}

.skeleton-image {
    width: 100%;
    border-radius: 8px;
}

.skeleton-line {
    height: 2px;
    width: 100%;
    margin: 10px 0;
}

.skeleton-card {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Flight Card Skeleton */
.skeleton-flight-card {
    margin-bottom: 20px;
}

.skeleton-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.skeleton-airline {
    display: flex;
    align-items: center;
    gap: 12px;
}

.skeleton-card-body {
    margin-bottom: 20px;
}

.skeleton-flight-route {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.skeleton-flight-time {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.skeleton-flight-duration {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.skeleton-card-footer {
    display: flex;
    justify-content: flex-end;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

/* Flight List Item Skeleton */
.skeleton-flight-list-item {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Hotel Card Skeleton */
.skeleton-hotel-card {
    margin-bottom: 20px;
}

.skeleton-hotel-card .skeleton-card {
    padding: 0;
    overflow: hidden;
}

.skeleton-hotel-card .skeleton-card-body {
    padding: 20px;
}

/* Booking Summary Skeleton */
.skeleton-booking-summary {
    position: sticky;
    top: 100px;
}

/* Search Form Skeleton */
.skeleton-search-form {
    background: #fff;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .skeleton-flight-route {
        flex-direction: column;
        align-items: flex-start;
    }

    .skeleton-flight-duration {
        width: 100%;
    }

    .skeleton-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .skeleton-price {
        width: 100%;
    }
}

/* Loading Overlay */
.skeleton-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.skeleton-overlay-content {
    text-align: center;
    padding: 40px;
}

.skeleton-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Fade In Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.content-loaded {
    animation: fadeIn 0.5s ease-in-out;
}

/* Hide actual content while loading */
.loading-active .actual-content {
    display: none;
}

.loading-active .skeleton-loader-container {
    display: block;
}

.skeleton-loader-container.hidden {
    display: none;
}

/* Pulse Animation (Alternative) */
@keyframes skeleton-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.skeleton-pulse {
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

/* Grid Layout for Cards */
.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

@media (max-width: 576px) {
    .skeleton-grid {
        grid-template-columns: 1fr;
    }
}

/* Skeleton Page Container */
.skeleton-page-container {
    min-height: 400px;
    padding: 20px 0;
}

/* Loading State Message */
.skeleton-loading-message {
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 14px;
    margin-top: 20px;
}

.skeleton-loading-message .loading-icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}
