/* skeleton.css - Calzada Modernized Loading & Skeleton System */

/* Ensure the root canvas is always opaque — prevents incoming page from
   compositing semi-transparently over a previous page's frozen paint buffer */
html {
    background-color: #ffffff;
}

/* Base Skeleton Token: Light Gray (#E2E8F0) with calm opacity pulse */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.42;
    }
}

.skeleton {
    background-color: #E2E8F0;
    animation: pulse 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm, 8px);
    pointer-events: none;
    user-select: none;
}

/* Shape Utilities */
.sk-text {
    width: 100%;
    height: 14px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.sk-title {
    width: 60%;
    height: 24px;
    margin-bottom: 12px;
    border-radius: 6px;
}

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

.sk-card {
    width: 100%;
    background: #ffffff;
    height: 150px;
    border-radius: var(--radius-md, 16px);
    border: 1px solid #E2E8F0;
}

.sk-btn {
    width: 110px;
    height: 38px;
    border-radius: var(--radius-sm, 8px);
}

.sk-map {
    width: 100%;
    height: 100%;
    min-height: 400px;
    border-radius: var(--radius-md, 16px);
}

/* =========================================================
   AUTH CHECK GATE (Minimal brand-blue progress indicator)
   ========================================================= */
.auth-gate {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 70vh;
    gap: 16px;
    padding: 24px;
    color: var(--navy-muted, #64748B);
    font-family: var(--font-primary, 'Sora', sans-serif);
    font-size: 0.875rem;
    letter-spacing: -0.01em;
}

.auth-gate-bar {
    width: 120px;
    height: 3px;
    background: #E2E8F0;
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.auth-gate-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 40%;
    background: var(--primary, #378ADD);
    border-radius: 999px;
    animation: auth-bar-slide 1.2s ease-in-out infinite;
}

@keyframes auth-bar-slide {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(300%);
    }
}

.auth-gate-dot {
    width: 10px;
    height: 10px;
    background-color: var(--primary, #378ADD);
    border-radius: 50%;
    animation: auth-gate-pulse 1.2s ease-in-out infinite;
}

@keyframes auth-gate-pulse {
    0%, 100% {
        transform: scale(0.85);
        opacity: 0.45;
    }
    50% {
        transform: scale(1.25);
        opacity: 1;
    }
}

/* =========================================================
   QUIET ERROR STATE (Plain-text non-alarming notice)
   ========================================================= */
.quiet-error-state {
    padding: 32px 16px;
    text-align: center;
    color: var(--navy-muted, #64748B);
    font-size: 0.875rem;
    font-family: var(--font-primary, 'Sora', sans-serif);
    line-height: 1.5;
}

/* =========================================================
   PAGE-SPECIFIC CONTENT-SHAPED SKELETONS
   ========================================================= */

/* 1. Discover Post Card Skeleton */
.sk-discover-card {
    display: flex;
    flex-direction: column;
    background: #FFFFFF;
    border: 1px solid var(--border-color, #E2E8F0);
    border-radius: var(--radius-md, 16px);
    overflow: hidden;
    margin-bottom: 28px;
}

@media (min-width: 768px) {
    .sk-discover-card {
        flex-direction: row;
        height: 520px;
    }
}

.sk-discover-media {
    width: 100%;
    aspect-ratio: 16 / 10;
    background-color: #E2E8F0;
    flex-shrink: 0;
}

@media (min-width: 768px) {
    .sk-discover-media {
        width: 60%;
        height: 100%;
        aspect-ratio: auto;
    }
}

.sk-discover-info {
    width: 100%;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-sizing: border-box;
}

@media (min-width: 768px) {
    .sk-discover-info {
        width: 40%;
        height: 100%;
    }
}

/* 2. Business Profile Skeleton */
.sk-business-hero {
    background: #FFFFFF;
    border: 1px solid var(--border-color, #E2E8F0);
    border-radius: var(--radius-md, 16px);
    padding: 28px;
    margin-bottom: 28px;
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.sk-business-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sk-posts-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.sk-post-square {
    aspect-ratio: 1 / 1;
    border-radius: 8px;
}

/* 3. Card Spec / Row Skeletons (My Business & Admin) */
.sk-flat-card {
    background: #FFFFFF;
    border: 1px solid var(--border-color, #E2E8F0);
    border-radius: var(--radius-md, 16px);
    padding: 28px;
    margin-bottom: 24px;
}

.sk-spec-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #F1F5F9;
}

.sk-spec-row:last-child {
    border-bottom: none;
}

/* 4. Search Options Skeleton (Planner Modal) */
.sk-search-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-bottom: 1px solid #F8FAFC;
}

/* Container for skeleton overlay to match page background */
#skeleton-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #ffffff;
    z-index: 99999;
    overflow-y: auto;
    overflow-x: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#skeleton-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

/* Page exit transition — applied by transitions.js before navigating away */
body.page-is-exiting {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.15s ease-out !important;
}

/* Helper flex/grid classes for skeletons */
.sk-flex { display: flex; gap: 1rem; align-items: center; }
.sk-flex-col { display: flex; flex-direction: column; gap: 1rem; }
.sk-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.sk-grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }

@media (max-width: 768px) {
    .sk-grid-3 { grid-template-columns: 1fr; }
}

/* Review & List item skeleton */
.review-skeleton-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: var(--radius-sm, 8px);
}

.skeleton-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: #E2E8F0;
    animation: pulse 1.5s ease-in-out infinite;
    flex-shrink: 0;
}

.skeleton-lines {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.skeleton-line {
    width: 100%;
    height: 12px;
    border-radius: 4px;
    background-color: #E2E8F0;
    animation: pulse 1.5s ease-in-out infinite;
}

.skeleton-line.short {
    width: 45%;
}

