/* ================================================================
   skeleton_loader.css — SacliConnect Skeleton Loading System
   Dark-green glassmorphism theme matching the existing design.
   Include this file in ALL pages that need skeleton loading.
================================================================ */

/* ── Shimmer Keyframe ──────────────────────────────────────────── */
@keyframes skeletonShimmer {
    0%   { background-position: -300% center; }
    100% { background-position:  300% center; }
}

/* Soft pulse glow on top of shimmer for extra depth */
@keyframes skeletonPulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.6; }
}

@keyframes skeletonFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Staggered wave for skeleton children */
@keyframes skeletonWave {
    0%   { transform: translateY(0px); }
    50%  { transform: translateY(-3px); }
    100% { transform: translateY(0px); }
}

/* ── Base Skeleton Element ─────────────────────────────────────── */
.skel {
    background: linear-gradient(
        105deg,
        rgba(0, 255, 170, 0.03) 20%,
        rgba(0, 255, 170, 0.05) 35%,
        rgba(0, 255, 170, 0.14) 50%,
        rgba(0, 255, 170, 0.05) 65%,
        rgba(0, 255, 170, 0.03) 80%
    );
    background-size: 300% 100%;
    animation: skeletonShimmer 1.2s infinite ease-in-out;
    border-radius: 8px;
    display: block;
    position: relative;
    overflow: hidden;
    will-change: background-position;
}

/* Subtle glow line that sweeps across */
.skel::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        105deg,
        transparent 30%,
        rgba(0, 255, 170, 0.06) 50%,
        transparent 70%
    );
    background-size: 300% 100%;
    animation: skeletonShimmer 1.2s infinite ease-in-out;
    border-radius: inherit;
}

/* ── Light Mode Override ───────────────────────────────────────── */
body.user-theme-light .skel {
    background: linear-gradient(
        105deg,
        #dce9e2 20%,
        #eaf3ee 35%,
        #c4d9cd 50%,
        #eaf3ee 65%,
        #dce9e2 80%
    );
    background-size: 300% 100%;
    animation: skeletonShimmer 1.2s infinite ease-in-out;
}
body.user-theme-light .skel::after {
    background: linear-gradient(
        105deg,
        transparent 30%,
        rgba(255, 255, 255, 0.5) 50%,
        transparent 70%
    );
    background-size: 300% 100%;
    animation: skeletonShimmer 1.2s infinite ease-in-out;
}

/* ── Shape Utilities ───────────────────────────────────────────── */
.skel-circle  { border-radius: 50%; }
.skel-round   { border-radius: 999px; }
.skel-card    { border-radius: 16px; }

/* ── Common Sizes ──────────────────────────────────────────────── */
.skel-avatar-sm  { width: 36px;  height: 36px; }
.skel-avatar     { width: 45px;  height: 45px; }
.skel-avatar-lg  { width: 80px;  height: 80px; }
.skel-avatar-xl  { width: 120px; height: 120px; }
.skel-avatar-xxl { width: 170px; height: 170px; }

.skel-line-xs  { height: 10px; }
.skel-line-sm  { height: 12px; }
.skel-line     { height: 14px; }
.skel-line-lg  { height: 18px; }
.skel-line-xl  { height: 22px; }
.skel-line-h2  { height: 28px; }

/* Width helpers */
.skel-w-30  { width: 30%; }
.skel-w-40  { width: 40%; }
.skel-w-50  { width: 50%; }
.skel-w-60  { width: 60%; }
.skel-w-70  { width: 70%; }
.skel-w-80  { width: 80%; }
.skel-w-90  { width: 90%; }
.skel-w-full{ width: 100%; }

/* ================================================================
   SKELETON WRAPPER — wraps the skeleton before real content loads
================================================================ */
.skeleton-wrapper {
    display: none;
}
.skeleton-wrapper.active {
    display: block;
    animation: skeletonFadeIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}
.real-content {
    display: none;
}
.real-content.loaded {
    display: block;
    animation: skeletonFadeIn 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Staggered wave for multiple .skel children inside a wrapper */
.skeleton-wrapper.active .skel:nth-child(1)  { animation-delay: 0s; }
.skeleton-wrapper.active .skel:nth-child(2)  { animation-delay: 0.05s; }
.skeleton-wrapper.active .skel:nth-child(3)  { animation-delay: 0.1s; }
.skeleton-wrapper.active .skel:nth-child(4)  { animation-delay: 0.15s; }
.skeleton-wrapper.active .skel:nth-child(5)  { animation-delay: 0.2s; }

/* ================================================================
   PAGE-LEVEL SKELETONS
================================================================ */

/* ── Skeleton: Feed Page (SacliConnect.php / saclisacli.php) ──── */
.skel-feed-container {
    padding: 20px 0;
}

/* Story / create-post bar */
.skel-stories {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    padding: 14px 18px;
    background: rgba(16, 46, 34, 0.6);
    border-radius: 16px;
    border: 1px solid rgba(0,255,170,0.08);
}
.skel-story-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Post card skeleton */
.skel-post {
    background: rgba(16, 46, 34, 0.6);
    border: 1px solid rgba(0, 255, 170, 0.08);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
}
.skel-post-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.skel-post-header-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 7px;
}
.skel-post-image {
    height: 220px;
    border-radius: 12px;
    margin-bottom: 14px;
}
.skel-post-actions {
    display: flex;
    gap: 16px;
    margin-top: 10px;
}
.skel-action-btn {
    height: 32px;
    width: 80px;
    border-radius: 999px;
}

/* ── Skeleton: Right Sidebar ───────────────────────────────────── */
.skel-right-sidebar {
    padding: 20px;
}
.skel-section-title {
    height: 18px;
    width: 70%;
    margin-bottom: 18px;
    border-radius: 6px;
}
.skel-gc-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 12px;
    background: rgba(16, 46, 34, 0.5);
    border-radius: 14px;
}
.skel-gc-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* ── Skeleton: Left Sidebar (nav items) ────────────────────────── */
.skel-sidebar-nav {
    padding: 20px 14px;
}
.skel-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    margin-bottom: 14px;
    border-radius: 10px;
}
.skel-nav-icon { width: 22px; height: 22px; flex-shrink: 0; }
.skel-nav-label { height: 14px; flex: 1; }

/* ── Skeleton: Profile Page ────────────────────────────────────── */
.skel-cover-area {
    height: 240px;
    border-radius: 18px 18px 0 0;
    margin-bottom: 0;
}
.skel-profile-header {
    background: rgba(16, 46, 34, 0.75);
    border-radius: 0 0 18px 18px;
    padding: 0 28px 24px;
    display: flex;
    align-items: flex-end;
    gap: 20px;
    margin-bottom: 20px;
}
.skel-profile-avatar-wrap {
    margin-top: -60px;
    flex-shrink: 0;
}
.skel-profile-name-block {
    flex: 1;
    padding-bottom: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.skel-profile-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}
.skel-tab {
    height: 36px;
    width: 100px;
    border-radius: 999px;
}
.skel-profile-bio-card {
    background: rgba(16, 46, 34, 0.6);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.skel-detail-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.skel-detail-icon { width: 20px; height: 20px; flex-shrink: 0; }
.skel-detail-text { height: 13px; flex: 1; }
.skel-photos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.skel-photo-thumb {
    aspect-ratio: 1;
    border-radius: 10px;
}

/* ── Skeleton: Admin Dashboard ─────────────────────────────────── */
.skel-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.skel-stat-card {
    background: rgba(16, 46, 34, 0.6);
    border-radius: 16px;
    padding: 22px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border: 1px solid rgba(0,255,170,0.08);
}
.skel-stat-icon { width: 38px; height: 38px; border-radius: 10px; }
.skel-stat-num  { height: 26px; width: 50%; }
.skel-stat-lbl  { height: 12px; width: 70%; }

.skel-admin-section {
    background: rgba(16, 46, 34, 0.6);
    border-radius: 16px;
    padding: 22px;
    margin-bottom: 22px;
    border: 1px solid rgba(0,255,170,0.08);
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.skel-admin-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: rgba(7, 27, 18, 0.5);
    border-radius: 12px;
}

/* ── Skeleton: Login / Signup Page ────────────────────────────── */
.skel-login-card {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    background: rgba(16, 46, 34, 0.7);
    border-radius: 20px;
    padding: 36px 30px;
    border: 1px solid rgba(0,255,170,0.12);
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.skel-logo { height: 54px; width: 54px; margin: 0 auto 8px; border-radius: 50%; }
.skel-input-field { height: 46px; border-radius: 12px; }
.skel-btn { height: 48px; border-radius: 999px; }

/* ── Skeleton: Chat / Meeting ──────────────────────────────────── */
.skel-chat-message {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}
.skel-chat-message.outgoing { flex-direction: row-reverse; }
.skel-chat-bubble {
    height: 48px;
    width: 200px;
    border-radius: 18px;
    max-width: 60%;
}
.skel-chat-bubble.short { width: 120px; }
.skel-chat-bubble.long  { width: 260px; }

/* ── Skeleton: Meeting Room ────────────────────────────────────── */
.skel-video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}
.skel-video-tile {
    aspect-ratio: 16/9;
    border-radius: 14px;
}

/* ── Skeleton: SacliRoom / Assignments ─────────────────────────── */
.skel-room-card {
    background: rgba(16, 46, 34, 0.6);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 1px solid rgba(0,255,170,0.08);
}
.skel-room-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 6px;
}
.skel-room-icon { width: 42px; height: 42px; border-radius: 10px; flex-shrink: 0; }

/* ── Skeleton: Announcements / Event Cards ─────────────────────── */
.skel-event-card {
    background: rgba(16, 46, 34, 0.6);
    border-radius: 16px;
    padding: 18px;
    margin-bottom: 14px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
    border: 1px solid rgba(0,255,170,0.08);
}
.skel-event-date { width: 52px; height: 60px; border-radius: 12px; flex-shrink: 0; }
.skel-event-info { flex: 1; display: flex; flex-direction: column; gap: 9px; }

/* ── Skeleton: Table / List ────────────────────────────────────── */
.skel-table-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    background: rgba(16, 46, 34, 0.45);
    border-radius: 12px;
    margin-bottom: 8px;
}
.skel-table-cell-sm  { height: 14px; width: 60px;  flex-shrink: 0; }
.skel-table-cell-md  { height: 14px; flex: 1; }
.skel-table-cell-lg  { height: 14px; flex: 2; }
.skel-table-badge    { height: 24px; width: 70px; border-radius: 999px; flex-shrink: 0; }

/* ── Skeleton: Analytics / Charts ─────────────────────────────── */
.skel-chart-area {
    height: 260px;
    border-radius: 16px;
    margin-bottom: 18px;
}
.skel-chart-legend {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.skel-legend-item { height: 14px; width: 90px; border-radius: 999px; }

/* ── Skeleton: Page-wide full overlay ─────────────────────────── */
@keyframes logoOrbit {
    0%   { box-shadow: 0 0 0 0 rgba(0,255,170,0.35), 0 0 18px 2px rgba(0,255,170,0.12); }
    50%  { box-shadow: 0 0 0 10px rgba(0,255,170,0), 0 0 28px 6px rgba(0,255,170,0.22); }
    100% { box-shadow: 0 0 0 0 rgba(0,255,170,0.35), 0 0 18px 2px rgba(0,255,170,0.12); }
}
@keyframes logoSpin {
    0%   { transform: rotate(0deg) scale(1); }
    50%  { transform: rotate(180deg) scale(1.08); }
    100% { transform: rotate(360deg) scale(1); }
}
@keyframes overlayTextBlink {
    0%, 100% { opacity: 0.45; letter-spacing: 0.08em; }
    50%       { opacity: 0.9;  letter-spacing: 0.14em; }
}

.page-skeleton-overlay {
    position: fixed;
    inset: 0;
    background: #050f0b;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    transition: opacity 0.45s cubic-bezier(0.22, 1, 0.36, 1),
                visibility 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.page-skeleton-overlay.hide {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
body.user-theme-light .page-skeleton-overlay {
    background: #f2f8f5;
}
.page-skeleton-overlay .skel-logo-pulse {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(0, 255, 170, 0.12);
    border: 2px solid rgba(0, 255, 170, 0.5);
    animation: logoOrbit 1.2s ease-in-out infinite,
               skeletonFadeIn 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
/* Inner ring for depth */
.page-skeleton-overlay .skel-logo-pulse::before {
    content: '';
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid rgba(0, 255, 170, 0.3);
    animation: logoSpin 2.4s linear infinite;
}
.page-skeleton-overlay p {
    color: rgba(0, 255, 170, 0.5);
    font-size: 12px;
    font-family: 'Inter', 'Segoe UI', sans-serif;
    letter-spacing: 0.08em;
    animation: overlayTextBlink 1.2s ease-in-out infinite;
}

/* Loading bar below the logo */
.page-skeleton-overlay .skel-loading-bar {
    width: 120px;
    height: 3px;
    background: rgba(0,255,170,0.1);
    border-radius: 999px;
    overflow: hidden;
}
.page-skeleton-overlay .skel-loading-bar::after {
    content: '';
    display: block;
    height: 100%;
    width: 40%;
    background: linear-gradient(90deg, transparent, rgba(0,255,170,0.7), transparent);
    border-radius: 999px;
    animation: skeletonShimmer 1.2s ease-in-out infinite;
    background-size: 300% 100%;
}

/* ── Inline skeleton placeholder shown while content is fetching ─ */
.content-skel-placeholder {
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
