/* ===================================
   SKELETON / SHIMMER LOADING SYSTEM
   =================================== */

/* === Keyframes === */
@keyframes shimmer {
    0%   { background-position: -600px 0; }
    100% { background-position: 600px 0; }
}

@keyframes skeletonFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes skeletonFadeOut {
    from { opacity: 1; }
    to   { opacity: 0; visibility: hidden; }
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}

/* ==================================
   PAGE LOADER  –  Full-screen skeleton
   ================================== */
.page-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #f8f9fa;
    overflow: hidden;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.page-loader.loaded {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* ==================================
   RESPONSIVE
.pl-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: #0B7FC4;
    animation: skeletonFadeIn 0.3s ease both;
}

.pl-header::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.08) 50%, transparent 100%);
    background-size: 600px 100%;
    animation: shimmer 1.6s ease-in-out infinite;
}

/* --- Skeleton hero --- */
.pl-hero {
    position: absolute;
    top: 70px;
    left: 0;
    right: 0;
    height: calc(50vh);
    min-height: 320px;
    background: #d5dbe0;
    animation: skeletonFadeIn 0.4s 0.1s ease both;
}

.pl-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.12) 50%, transparent 100%);
    background-size: 600px 100%;
    animation: shimmer 1.6s ease-in-out infinite;
}

/* --- Skeleton content blocks --- */
.pl-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 40px 3rem;
}

.pl-row {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    animation: skeletonFadeIn 0.4s 0.2s ease both;
}

.pl-block {
    flex: 1;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    background: #e8ecf0;
}

.pl-block::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.35) 50%, transparent 100%);
    background-size: 600px 100%;
    animation: shimmer 1.6s ease-in-out infinite;
}

.pl-block-sm { height: 60px; }
.pl-block-md { height: 120px; }
.pl-block-lg { height: 180px; }

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

/* Text lines inside blocks */
.pl-lines {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pl-line {
    height: 10px;
    border-radius: 5px;
    background: #d5dbe0;
    position: relative;
    overflow: hidden;
}

.pl-line::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    background-size: 600px 100%;
    animation: shimmer 1.6s ease-in-out infinite;
}

.pl-line-short { width: 60%; }
.pl-line-med   { width: 80%; }

/* ==================================
   RESPONSIVE
   ================================== */
@media (max-width: 768px) {
    .pl-logo { width: 60px; height: 60px; }
    .pl-hero { min-height: 200px; height: 35vh; }
    .pl-content { padding: 24px 1rem; }
    .pl-row { flex-direction: column; gap: 1rem; }
}

/* ==================================
   AJAX / BUTTON LOADERS  (unchanged)
   ================================== */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: btnSpin 0.7s linear infinite;
}

@keyframes btnSpin { to { transform: rotate(360deg); } }

.inline-loader {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(30, 147, 220, 0.25);
    border-top-color: #1E93DC;
    border-radius: 50%;
    animation: btnSpin 0.7s linear infinite;
    vertical-align: middle;
    margin-left: 0.5rem;
}

/* Form Overlay Loader */
.form-loader-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.88);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 12px;
    z-index: 100;
    border-radius: inherit;
}

.form-loader-overlay .skeleton-mini-bar {
    width: 100px;
    height: 4px;
    border-radius: 4px;
    background: rgba(30, 147, 220, 0.15);
    overflow: hidden;
    position: relative;
}

.form-loader-overlay .skeleton-mini-bar::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, #1E93DC, transparent);
    animation: shimmer 1.2s ease-in-out infinite;
}

.form-loader-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(30, 147, 220, 0.25);
    border-top-color: #1E93DC;
    border-radius: 50%;
    animation: btnSpin 0.8s linear infinite;
}

/* Admin Theme Override */
.page-loader.admin-theme {
    background: #1a233e;
}

.page-loader.admin-theme .pl-header { background: #141d36; }
.page-loader.admin-theme .pl-hero   { background: #1c2744; }
.page-loader.admin-theme .pl-block  { background: #243050; }
.pl-block::after,
.pl-line::after,
.pl-hero::after,
.pl-header::after {
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.08) 50%, transparent 100%);
    background-size: 600px 100%;
    animation: shimmer 1.6s ease-in-out infinite;
}

/* Utility Overlay */
.loading-overlay {
    position: relative;
}

.loading-overlay.is-loading::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.85);
    z-index: 10;
}

.loading-overlay.is-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 30px;
    margin: -15px 0 0 -15px;
    border: 3px solid rgba(30, 147, 220, 0.25);
    border-top-color: #1E93DC;
    border-radius: 50%;
    animation: btnSpin 0.8s linear infinite;
    z-index: 11;
}
