/* Skeleton Loader Styles */
.skeleton {
    position: relative;
    overflow: hidden;
    background: linear-gradient(90deg, #f0f0f0 25%, #f8f8f8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 4px;
    user-select: none;
    /* Maintain minimum height */
    min-height: 1em;
    display: inline-block;
    min-width: 60px;
    /* Hide text content */
    color: transparent !important;
    text-indent: -9999px;
}

.skeleton::before {
    content: '\00a0';
    display: inline-block;
    visibility: hidden;
}

.skeleton * {
    visibility: hidden !important;
    opacity: 0;
    color: transparent !important;
}

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

/* Specific skeleton styles for different elements */
.skeleton-text {
    height: 1.2em;
    margin: 0.5em 0;
    width: 100%;
    display: block;
}

.skeleton-title {
    height: 2em;
    margin: 0.5em auto;
    width: 250px;
    max-width: 70%;
    display: block;
}

.skeleton-subtitle {
    height: 1.5em;
    margin: 0.5em auto;
    width: 350px;
    max-width: 80%;
    display: block;
}

.skeleton-button {
    height: 48px;
    width: 200px;
    border-radius: 30px;
    display: inline-block;
}

.skeleton-nav-item {
    display: inline-block;
    height: 1.2em;
    width: 80px;
    margin: 0 10px;
}

.skeleton-badge {
    height: 1.2em;
    width: 120px;
    display: inline-block;
    margin: 0 10px;
}

.skeleton-card {
    height: 200px;
    border-radius: 12px;
    margin: 20px 0;
    display: block;
}

.skeleton-stat {
    height: 3em;
    width: 100px;
    margin: 10px auto;
    display: block;
}

.skeleton-paragraph {
    height: 4em;
    margin: 1em 0;
    display: block;
    width: 100%;
}

/* Hide original content while loading */
body.loading .content-loaded {
    display: none;
}

/* Smooth transition when content loads */
.content-loaded {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Center skeletons in headers */
.page-header .skeleton,
.section-title.skeleton,
h1.skeleton,
h2.skeleton {
    margin-left: auto;
    margin-right: auto;
}

/* Specific sizes for page header elements */
.page-header h1.skeleton-title {
    width: 250px;
    max-width: 90%;
}

.page-header p.skeleton-subtitle {
    width: 400px;
    max-width: 90%;
}

/* Section titles should also be appropriately sized */
.section-title.skeleton-title {
    width: 300px;
    max-width: 90%;
}

.section-lead.skeleton-subtitle {
    width: 500px;
    max-width: 90%;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .skeleton {
        background: linear-gradient(90deg, #2a2a2a 25%, #3a3a3a 50%, #2a2a2a 75%);
    }
}