/**
 * ALUFORCE ERP - Skeleton Loader Styles
 * Provides smooth shimmer-effect loading placeholders
 * @version 2.0.0
 */

/* ========== BASE SKELETON ANIMATION ========== */
@keyframes alu-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes alu-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.8; }
}

/* ========== SKELETON TABLE ========== */
.alu-skeleton-table {
    width: 100%;
    padding: 8px;
}

.alu-skeleton-row {
    display: flex;
    gap: 16px;
    padding: 12px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    animation: alu-pulse 1.5s ease-in-out infinite;
}

.alu-skeleton-row.alu-skeleton-header {
    border-bottom: 2px solid rgba(255, 255, 255, 0.06);
}

.alu-skeleton-row.alu-skeleton-header .alu-skeleton-cell {
    height: 14px;
    opacity: 0.5;
}

.alu-skeleton-cell {
    height: 12px;
    border-radius: 4px;
    background: linear-gradient(90deg,
        rgba(255, 255, 255, 0.06) 25%,
        rgba(255, 255, 255, 0.12) 50%,
        rgba(255, 255, 255, 0.06) 75%);
    background-size: 200% 100%;
    animation: alu-shimmer 1.8s ease-in-out infinite;
    flex-shrink: 0;
}

/* ========== SKELETON CARDS ========== */
.alu-skeleton-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    padding: 8px;
}

.alu-skeleton-card {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    animation: alu-pulse 1.5s ease-in-out infinite;
}

.alu-skeleton-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    margin-bottom: 16px;
    background: linear-gradient(90deg,
        rgba(255, 255, 255, 0.06) 25%,
        rgba(255, 255, 255, 0.12) 50%,
        rgba(255, 255, 255, 0.06) 75%);
    background-size: 200% 100%;
    animation: alu-shimmer 1.8s ease-in-out infinite;
}

.alu-skeleton-card-title {
    width: 60%;
    height: 10px;
    border-radius: 4px;
    margin-bottom: 12px;
    background: linear-gradient(90deg,
        rgba(255, 255, 255, 0.06) 25%,
        rgba(255, 255, 255, 0.10) 50%,
        rgba(255, 255, 255, 0.06) 75%);
    background-size: 200% 100%;
    animation: alu-shimmer 1.8s ease-in-out infinite;
}

.alu-skeleton-card-value {
    width: 80%;
    height: 20px;
    border-radius: 4px;
    margin-bottom: 8px;
    background: linear-gradient(90deg,
        rgba(255, 255, 255, 0.08) 25%,
        rgba(255, 255, 255, 0.14) 50%,
        rgba(255, 255, 255, 0.08) 75%);
    background-size: 200% 100%;
    animation: alu-shimmer 1.8s ease-in-out infinite;
}

.alu-skeleton-card-sub {
    width: 40%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(90deg,
        rgba(255, 255, 255, 0.04) 25%,
        rgba(255, 255, 255, 0.08) 50%,
        rgba(255, 255, 255, 0.04) 75%);
    background-size: 200% 100%;
    animation: alu-shimmer 1.8s ease-in-out infinite;
}

/* ========== SKELETON CHART ========== */
.alu-skeleton-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 200px;
    padding: 20px;
    gap: 12px;
    animation: alu-pulse 1.5s ease-in-out infinite;
}

.alu-skeleton-chart-bar {
    flex: 1;
    max-width: 40px;
    border-radius: 4px 4px 0 0;
    background: linear-gradient(180deg,
        rgba(255, 255, 255, 0.10) 0%,
        rgba(255, 255, 255, 0.04) 100%);
    animation: alu-shimmer 1.8s ease-in-out infinite;
    background-size: 200% 100%;
    background-image: linear-gradient(90deg,
        rgba(255, 255, 255, 0.06) 25%,
        rgba(255, 255, 255, 0.12) 50%,
        rgba(255, 255, 255, 0.06) 75%);
}

/* ========== SKELETON FORM ========== */
.alu-skeleton-form {
    padding: 8px;
}

.alu-skeleton-form-group {
    margin-bottom: 20px;
    animation: alu-pulse 1.5s ease-in-out infinite;
}

.alu-skeleton-label {
    width: 100px;
    height: 10px;
    border-radius: 4px;
    margin-bottom: 8px;
    background: linear-gradient(90deg,
        rgba(255, 255, 255, 0.06) 25%,
        rgba(255, 255, 255, 0.10) 50%,
        rgba(255, 255, 255, 0.06) 75%);
    background-size: 200% 100%;
    animation: alu-shimmer 1.8s ease-in-out infinite;
}

.alu-skeleton-input {
    width: 100%;
    height: 36px;
    border-radius: 6px;
    background: linear-gradient(90deg,
        rgba(255, 255, 255, 0.04) 25%,
        rgba(255, 255, 255, 0.08) 50%,
        rgba(255, 255, 255, 0.04) 75%);
    background-size: 200% 100%;
    animation: alu-shimmer 1.8s ease-in-out infinite;
}

/* ========== BUTTON LOADING STATE ========== */
.alu-btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.85;
}

.alu-btn-loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: alu-spin 0.6s linear infinite;
    top: 50%;
    left: 50%;
    margin-left: -9px;
    margin-top: -9px;
}

@keyframes alu-spin {
    to { transform: rotate(360deg); }
}

/* ========== SMOOTH CONTENT TRANSITION ========== */
.alu-content-loading {
    opacity: 0.5;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.alu-content-loaded {
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* ========== PREVENT LAYOUT SHIFT ========== */
.alu-skeleton-active {
    min-height: 200px;
}

/* ========== INLINE SKELETON FOR DASHBOARD NUMBERS ========== */
.alu-skeleton-inline {
    display: inline-block;
    width: 80px;
    height: 1em;
    border-radius: 4px;
    vertical-align: middle;
    background: linear-gradient(90deg,
        rgba(255, 255, 255, 0.06) 25%,
        rgba(255, 255, 255, 0.12) 50%,
        rgba(255, 255, 255, 0.06) 75%);
    background-size: 200% 100%;
    animation: alu-shimmer 1.8s ease-in-out infinite;
}

/* ========== LIGHT THEME OVERRIDES ========== */
@media (prefers-color-scheme: light) {
    .alu-skeleton-cell,
    .alu-skeleton-card-icon,
    .alu-skeleton-card-title,
    .alu-skeleton-card-value,
    .alu-skeleton-card-sub,
    .alu-skeleton-label,
    .alu-skeleton-input,
    .alu-skeleton-inline {
        background-image: linear-gradient(90deg,
            rgba(0, 0, 0, 0.06) 25%,
            rgba(0, 0, 0, 0.10) 50%,
            rgba(0, 0, 0, 0.06) 75%);
    }

    .alu-skeleton-card {
        background: rgba(0, 0, 0, 0.03);
        border-color: rgba(0, 0, 0, 0.06);
    }

    .alu-skeleton-chart-bar {
        background-image: linear-gradient(90deg,
            rgba(0, 0, 0, 0.06) 25%,
            rgba(0, 0, 0, 0.10) 50%,
            rgba(0, 0, 0, 0.06) 75%);
    }
}
