/* ==========================================================================
   Skeleton Loading Component with Shimmer Effect
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties
   -------------------------------------------------------------------------- */
:root {
    --skeleton-base: #e8eef4;
    --skeleton-highlight: #f5f8fa;
    --skeleton-animation-duration: 1.5s;
    --skeleton-border-radius: 4px;
    --skeleton-border-radius-lg: 8px;
}

/* --------------------------------------------------------------------------
   Base Skeleton Class
   -------------------------------------------------------------------------- */
.skeleton {
    background: var(--skeleton-base);
    background-image: linear-gradient(
        90deg,
        var(--skeleton-base) 0%,
        var(--skeleton-highlight) 50%,
        var(--skeleton-base) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer var(--skeleton-animation-duration) ease-in-out infinite;
    border-radius: var(--skeleton-border-radius);
    position: relative;
    overflow: hidden;
}

/* Shimmer Animation */
@keyframes skeleton-shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* --------------------------------------------------------------------------
   Skeleton Text Placeholders
   -------------------------------------------------------------------------- */
.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
    border-radius: var(--skeleton-border-radius);
}

.skeleton-text:last-child {
    margin-bottom: 0;
}

/* Text Size Variants */
.skeleton-h1 {
    height: 2.5rem;
    margin-bottom: 1rem;
}

.skeleton-h2 {
    height: 2rem;
    margin-bottom: 0.875rem;
}

.skeleton-h3 {
    height: 1.5rem;
    margin-bottom: 0.75rem;
}

.skeleton-p {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-small {
    height: 0.875rem;
    margin-bottom: 0.375rem;
}

/* --------------------------------------------------------------------------
   Skeleton Image Placeholder
   -------------------------------------------------------------------------- */
.skeleton-image {
    width: 100%;
    height: 200px;
    border-radius: var(--skeleton-border-radius-lg);
}

.skeleton-image--sm {
    height: 100px;
}

.skeleton-image--lg {
    height: 300px;
}

.skeleton-image--xl {
    height: 400px;
}

/* Aspect Ratio Variants */
.skeleton-image--square {
    aspect-ratio: 1 / 1;
    height: auto;
}

.skeleton-image--video {
    aspect-ratio: 16 / 9;
    height: auto;
}

.skeleton-image--portrait {
    aspect-ratio: 3 / 4;
    height: auto;
}

/* --------------------------------------------------------------------------
   Skeleton Card Component
   -------------------------------------------------------------------------- */
.skeleton-card {
    background: #ffffff;
    border-radius: var(--skeleton-border-radius-lg);
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.skeleton-card__image {
    width: 100%;
    height: 180px;
    margin-bottom: 1rem;
    border-radius: var(--skeleton-border-radius);
}

.skeleton-card__title {
    height: 1.5rem;
    width: 70%;
    margin-bottom: 0.75rem;
}

.skeleton-card__text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-card__text:last-child {
    width: 60%;
}

/* --------------------------------------------------------------------------
   Skeleton Circle (Avatars/Icons)
   -------------------------------------------------------------------------- */
.skeleton-circle {
    border-radius: 50%;
    flex-shrink: 0;
}

.skeleton-circle--xs {
    width: 24px;
    height: 24px;
}

.skeleton-circle--sm {
    width: 32px;
    height: 32px;
}

.skeleton-circle--md {
    width: 48px;
    height: 48px;
}

.skeleton-circle--lg {
    width: 64px;
    height: 64px;
}

.skeleton-circle--xl {
    width: 96px;
    height: 96px;
}

/* --------------------------------------------------------------------------
   Width Utility Classes
   -------------------------------------------------------------------------- */
.skeleton-w-25 {
    width: 25%;
}

.skeleton-w-33 {
    width: 33.333%;
}

.skeleton-w-50 {
    width: 50%;
}

.skeleton-w-66 {
    width: 66.666%;
}

.skeleton-w-75 {
    width: 75%;
}

.skeleton-w-100 {
    width: 100%;
}

/* --------------------------------------------------------------------------
   Skeleton Button
   -------------------------------------------------------------------------- */
.skeleton-button {
    height: 48px;
    width: 160px;
    border-radius: var(--skeleton-border-radius);
}

.skeleton-button--sm {
    height: 36px;
    width: 120px;
}

.skeleton-button--lg {
    height: 56px;
    width: 200px;
}

.skeleton-button--full {
    width: 100%;
}

/* --------------------------------------------------------------------------
   Skeleton Input
   -------------------------------------------------------------------------- */
.skeleton-input {
    height: 48px;
    width: 100%;
    border-radius: var(--skeleton-border-radius);
}

.skeleton-input--sm {
    height: 36px;
}

.skeleton-input--lg {
    height: 56px;
}

.skeleton-textarea {
    height: 120px;
    width: 100%;
    border-radius: var(--skeleton-border-radius);
}

/* --------------------------------------------------------------------------
   Complete Skeleton: Hero Section
   -------------------------------------------------------------------------- */
.skeleton-hero {
    padding: 4rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.skeleton-hero__badge {
    height: 1.5rem;
    width: 120px;
    margin-bottom: 1.5rem;
    border-radius: 20px;
}

.skeleton-hero__title {
    height: 3rem;
    width: 80%;
    margin-bottom: 1rem;
}

.skeleton-hero__title-line-2 {
    height: 3rem;
    width: 60%;
    margin-bottom: 1.5rem;
}

.skeleton-hero__subtitle {
    height: 1.25rem;
    width: 70%;
    margin-bottom: 0.5rem;
}

.skeleton-hero__subtitle-line-2 {
    height: 1.25rem;
    width: 50%;
    margin-bottom: 2rem;
}

.skeleton-hero__cta-group {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.skeleton-hero__cta {
    height: 52px;
    width: 180px;
    border-radius: var(--skeleton-border-radius);
}

.skeleton-hero__cta--secondary {
    width: 140px;
}

/* Responsive Hero */
@media (max-width: 768px) {
    .skeleton-hero {
        padding: 2rem 1rem;
    }

    .skeleton-hero__title,
    .skeleton-hero__title-line-2 {
        height: 2rem;
        width: 90%;
    }

    .skeleton-hero__cta-group {
        flex-direction: column;
        width: 100%;
    }

    .skeleton-hero__cta,
    .skeleton-hero__cta--secondary {
        width: 100%;
    }
}

/* --------------------------------------------------------------------------
   Complete Skeleton: Service Card
   -------------------------------------------------------------------------- */
.skeleton-service-card {
    background: #ffffff;
    border-radius: var(--skeleton-border-radius-lg);
    padding: 2rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
}

.skeleton-service-card__icon {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.skeleton-service-card__title {
    height: 1.5rem;
    width: 70%;
    margin-bottom: 1rem;
}

.skeleton-service-card__description {
    height: 1rem;
    width: 100%;
    margin-bottom: 0.5rem;
}

.skeleton-service-card__description:nth-child(4) {
    width: 90%;
}

.skeleton-service-card__description:nth-child(5) {
    width: 75%;
    margin-bottom: 1.5rem;
}

.skeleton-service-card__link {
    height: 1rem;
    width: 100px;
    margin-top: auto;
}

/* Service Card Grid */
.skeleton-services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    padding: 2rem;
}

/* --------------------------------------------------------------------------
   Complete Skeleton: Contact Form
   -------------------------------------------------------------------------- */
.skeleton-contact-form {
    background: #ffffff;
    border-radius: var(--skeleton-border-radius-lg);
    padding: 2.5rem;
    max-width: 600px;
    margin: 0 auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.skeleton-contact-form__title {
    height: 2rem;
    width: 60%;
    margin-bottom: 0.75rem;
}

.skeleton-contact-form__subtitle {
    height: 1rem;
    width: 80%;
    margin-bottom: 2rem;
}

.skeleton-contact-form__row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.skeleton-contact-form__field {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.skeleton-contact-form__label {
    height: 0.875rem;
    width: 80px;
    margin-bottom: 0.5rem;
}

.skeleton-contact-form__input {
    height: 48px;
    width: 100%;
    border-radius: var(--skeleton-border-radius);
}

.skeleton-contact-form__textarea {
    height: 140px;
    width: 100%;
    border-radius: var(--skeleton-border-radius);
    margin-bottom: 1.5rem;
}

.skeleton-contact-form__submit {
    height: 52px;
    width: 100%;
    border-radius: var(--skeleton-border-radius);
}

/* Responsive Contact Form */
@media (max-width: 576px) {
    .skeleton-contact-form {
        padding: 1.5rem;
    }

    .skeleton-contact-form__row {
        flex-direction: column;
    }
}

/* --------------------------------------------------------------------------
   Complete Skeleton: Testimonial Card
   -------------------------------------------------------------------------- */
.skeleton-testimonial {
    background: #ffffff;
    border-radius: var(--skeleton-border-radius-lg);
    padding: 2rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.skeleton-testimonial__quote {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-testimonial__quote:nth-child(1) {
    width: 100%;
}

.skeleton-testimonial__quote:nth-child(2) {
    width: 95%;
}

.skeleton-testimonial__quote:nth-child(3) {
    width: 70%;
    margin-bottom: 1.5rem;
}

.skeleton-testimonial__author {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.skeleton-testimonial__avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    flex-shrink: 0;
}

.skeleton-testimonial__info {
    flex: 1;
}

.skeleton-testimonial__name {
    height: 1rem;
    width: 120px;
    margin-bottom: 0.375rem;
}

.skeleton-testimonial__role {
    height: 0.875rem;
    width: 160px;
}

/* --------------------------------------------------------------------------
   Skeleton List
   -------------------------------------------------------------------------- */
.skeleton-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.skeleton-list-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #ffffff;
    border-radius: var(--skeleton-border-radius);
}

.skeleton-list-item__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
}

.skeleton-list-item__content {
    flex: 1;
}

.skeleton-list-item__title {
    height: 1rem;
    width: 60%;
    margin-bottom: 0.375rem;
}

.skeleton-list-item__subtitle {
    height: 0.875rem;
    width: 40%;
}

/* --------------------------------------------------------------------------
   Hide Skeleton When Content Loaded
   -------------------------------------------------------------------------- */
.loaded .skeleton,
.loaded .skeleton-text,
.loaded .skeleton-image,
.loaded .skeleton-card,
.loaded .skeleton-circle,
.loaded .skeleton-button,
.loaded .skeleton-input,
.loaded .skeleton-textarea,
.loaded .skeleton-hero,
.loaded .skeleton-service-card,
.loaded .skeleton-contact-form,
.loaded .skeleton-testimonial,
.loaded .skeleton-list,
.loaded .skeleton-list-item,
.loaded [class*="skeleton-"] {
    display: none !important;
}

/* Alternative: Fade out animation when loaded */
.fade-loaded .skeleton,
.fade-loaded [class*="skeleton-"] {
    animation: skeleton-fade-out 0.3s ease-out forwards;
}

@keyframes skeleton-fade-out {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        visibility: hidden;
    }
}

/* --------------------------------------------------------------------------
   Accessibility: Reduced Motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .skeleton,
    [class*="skeleton-"] {
        animation: none;
        background-image: none;
    }
}

/* --------------------------------------------------------------------------
   Dark Mode Support
   -------------------------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
    :root {
        --skeleton-base: #2a3441;
        --skeleton-highlight: #3d4a5c;
    }

    .skeleton-card,
    .skeleton-service-card,
    .skeleton-contact-form,
    .skeleton-testimonial,
    .skeleton-list-item {
        background: #1a2332;
    }
}

/* Manual dark mode class */
.dark-mode {
    --skeleton-base: #2a3441;
    --skeleton-highlight: #3d4a5c;
}

.dark-mode .skeleton-card,
.dark-mode .skeleton-service-card,
.dark-mode .skeleton-contact-form,
.dark-mode .skeleton-testimonial,
.dark-mode .skeleton-list-item {
    background: #1a2332;
}
