/**
 * Skeleton Loading Styles
 * Provides skeleton screen placeholders for improved UX during content loading
 */

/* Base skeleton styles */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    color: transparent !important;
    pointer-events: none;
    user-select: none;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Text skeleton variations */
.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
    display: inline-block;
    width: 100%;
}

.skeleton-text-short {
    width: 40%;
}

.skeleton-text-medium {
    width: 70%;
}

.skeleton-text-long {
    width: 90%;
}

.skeleton-title {
    height: 1.5em;
    width: 60%;
    margin-bottom: 1em;
    font-weight: bold;
}

.skeleton-paragraph {
    height: 1em;
    margin-bottom: 0.5em;
    width: 100%;
}

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

.skeleton-paragraph-line:nth-child(3) {
    width: 85%;
}

.skeleton-paragraph-line:nth-child(4) {
    width: 90%;
}

/* Heading skeletons */
.skeleton-h1 {
    height: 2.5em;
    width: 50%;
    margin-bottom: 1em;
}

.skeleton-h2 {
    height: 2em;
    width: 60%;
    margin-bottom: 0.8em;
}

.skeleton-h3 {
    height: 1.5em;
    width: 70%;
    margin-bottom: 0.6em;
}

/* Card skeleton */
.skeleton-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.skeleton-card-header {
    height: 24px;
    width: 40%;
    margin-bottom: 15px;
}

.skeleton-card-body {
    min-height: 100px;
}

.skeleton-card-footer {
    height: 40px;
    margin-top: 15px;
}

/* Table skeleton */
.skeleton-table {
    width: 100%;
    border-collapse: collapse;
}

.skeleton-table-header {
    height: 40px;
    margin-bottom: 10px;
}

.skeleton-table-row {
    height: 50px;
    margin-bottom: 8px;
}

.skeleton-table-cell {
    display: inline-block;
    height: 20px;
    margin-right: 15px;
}

.skeleton-table-cell:first-child {
    width: 30%;
}

.skeleton-table-cell:nth-child(2) {
    width: 25%;
}

.skeleton-table-cell:nth-child(3) {
    width: 20%;
}

.skeleton-table-cell:nth-child(4) {
    width: 15%;
}

/* Button skeleton */
.skeleton-button {
    height: 40px;
    width: 120px;
    border-radius: 4px;
    display: inline-block;
}

.skeleton-button-large {
    height: 48px;
    width: 180px;
}

.skeleton-button-small {
    height: 32px;
    width: 90px;
}

/* Avatar skeleton */
.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: inline-block;
}

.skeleton-avatar-large {
    width: 60px;
    height: 60px;
}

.skeleton-avatar-small {
    width: 32px;
    height: 32px;
}

/* Image skeleton */
.skeleton-image {
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 14px;
}

.skeleton-image::before {
    content: 'Loading image...';
}

/* Badge skeleton */
.skeleton-badge {
    height: 24px;
    width: 60px;
    border-radius: 12px;
    display: inline-block;
}

/* Progress bar skeleton */
.skeleton-progress {
    height: 8px;
    width: 100%;
    border-radius: 4px;
    background: #f0f0f0;
    overflow: hidden;
}

.skeleton-progress-bar {
    height: 100%;
    width: 60%;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* Input skeleton */
.skeleton-input {
    height: 40px;
    width: 100%;
    border-radius: 4px;
    margin-bottom: 15px;
}

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

/* List skeleton */
.skeleton-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.skeleton-list-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.skeleton-list-item-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 15px;
    flex-shrink: 0;
}

.skeleton-list-item-content {
    flex: 1;
}

.skeleton-list-item-title {
    height: 20px;
    width: 60%;
    margin-bottom: 8px;
}

.skeleton-list-item-text {
    height: 16px;
    width: 80%;
}

/* Dashboard specific skeletons */
.skeleton-dashboard-widget {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    min-height: 200px;
}

.skeleton-dashboard-widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.skeleton-dashboard-widget-title {
    height: 24px;
    width: 40%;
}

.skeleton-dashboard-widget-content {
    min-height: 150px;
}

.skeleton-stat-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
}

.skeleton-stat-value {
    height: 48px;
    width: 80%;
    margin: 0 auto 10px;
}

.skeleton-stat-label {
    height: 20px;
    width: 60%;
    margin: 0 auto;
}

/* Chart skeleton */
.skeleton-chart {
    height: 300px;
    width: 100%;
    background: #f0f0f0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.skeleton-chart::before {
    content: 'Loading chart...';
    color: #999;
}

/* Security report skeleton */
.skeleton-security-report {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
}

.skeleton-security-score {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin: 0 auto 20px;
}

.skeleton-security-details {
    margin-top: 20px;
}

.skeleton-security-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.skeleton-security-item-icon {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    margin-right: 15px;
}

.skeleton-security-item-text {
    flex: 1;
}

/* ML prediction skeleton */
.skeleton-ml-prediction {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
}

.skeleton-ml-confidence {
    height: 8px;
    width: 70%;
    border-radius: 4px;
    margin: 15px 0;
}

.skeleton-ml-prediction-text {
    height: 20px;
    width: 80%;
    margin-bottom: 10px;
}

/* Database table skeleton */
.skeleton-db-table {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
}

.skeleton-db-table-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.skeleton-db-table-rows {
    min-height: 200px;
}

.skeleton-db-table-row {
    display: flex;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.skeleton-db-table-cell {
    flex: 1;
    height: 20px;
    margin-right: 15px;
}

.skeleton-db-table-cell:last-child {
    margin-right: 0;
}

/* WordPress admin specific skeletons */
.skeleton-wp-admin-bar {
    height: 32px;
    width: 100%;
    background: #f0f0f0;
    margin-bottom: 20px;
}

.skeleton-wp-sidebar {
    width: 200px;
    height: 100%;
    background: #f0f0f0;
    position: fixed;
    left: 0;
    top: 32px;
}

.skeleton-wp-sidebar-item {
    height: 40px;
    margin: 10px;
    border-radius: 4px;
}

.skeleton-wp-post-list {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
}

.skeleton-wp-post-item {
    display: flex;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
}

.skeleton-wp-post-checkbox {
    width: 20px;
    height: 20px;
    border-radius: 2px;
    margin-right: 15px;
}

.skeleton-wp-post-title {
    flex: 1;
    height: 20px;
    width: 60%;
}

.skeleton-wp-post-meta {
    height: 16px;
    width: 30%;
    margin-left: 15px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .skeleton-card {
        padding: 15px;
    }

    .skeleton-dashboard-widget {
        padding: 15px;
        min-height: 150px;
    }

    .skeleton-chart {
        height: 200px;
    }

    .skeleton-security-score {
        width: 80px;
        height: 80px;
    }

    .skeleton-wp-sidebar {
        display: none;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .skeleton {
        background: linear-gradient(90deg, #2d2d2d 25%, #3d3d3d 50%, #2d2d2d 75%);
    }

    .skeleton-card,
    .skeleton-dashboard-widget,
    .skeleton-stat-card,
    .skeleton-security-report,
    .skeleton-ml-prediction,
    .skeleton-db-table,
    .skeleton-wp-post-list {
        background: #1e1e1e;
        border-color: #404040;
    }

    .skeleton-list-item {
        border-bottom-color: #404040;
    }

    .skeleton-security-item {
        border-bottom-color: #404040;
    }

    .skeleton-db-table-row {
        border-bottom-color: #404040;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .skeleton,
    .skeleton-progress-bar {
        animation: none;
        background: #f0f0f0;
    }

    @media (prefers-color-scheme: dark) {
        .skeleton,
        .skeleton-progress-bar {
            background: #2d2d2d;
        }
    }
}

/* Loading state management */
.skeleton-wrapper {
    position: relative;
}

.skeleton-wrapper.loading .skeleton {
    display: block;
}

.skeleton-wrapper.loaded .skeleton {
    display: none;
}

.skeleton-wrapper .actual-content {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.skeleton-wrapper.loaded .actual-content {
    opacity: 1;
}

/* Fade transition for content replacement */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.skeleton-fade-in {
    animation: fadeIn 0.3s ease-in;
}

/* Utility classes */
.skeleton-pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.skeleton-hidden {
    display: none !important;
}

.skeleton-visible {
    display: block !important;
}

/* WordPress-specific skeleton enhancements */

/* WordPress Admin Bar skeleton */
.skeleton-wp-admin-bar {
    height: 32px;
    background: #1d2327;
    display: flex;
    align-items: center;
    padding: 0 20px;
}

.skeleton-wp-admin-bar-logo {
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 2px;
    margin-right: 15px;
}

.skeleton-wp-admin-bar-item {
    height: 16px;
    width: 80px;
    background: rgba(255,255,255,0.2);
    border-radius: 2px;
    margin-right: 20px;
}

/* WordPress Sidebar Menu skeleton */
.skeleton-wp-sidebar {
    width: 160px;
    background: #1d2327;
    min-height: 400px;
    padding: 10px;
}

.skeleton-wp-sidebar-menu-item {
    height: 36px;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    margin-bottom: 8px;
}

.skeleton-wp-sidebar-submenu {
    height: 28px;
    background: rgba(255,255,255,0.05);
    border-radius: 4px;
    margin-left: 20px;
    margin-bottom: 6px;
}

/* WordPress Post List skeleton */
.skeleton-wp-post-list {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 20px;
}

.skeleton-wp-post-row {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.skeleton-wp-post-row:last-child {
    border-bottom: none;
}

.skeleton-wp-post-checkbox {
    width: 20px;
    height: 20px;
    border-radius: 2px;
    margin-right: 15px;
}

.skeleton-wp-post-title {
    flex: 1;
    height: 20px;
    width: 40%;
    margin-right: 20px;
}

.skeleton-wp-post-author {
    height: 16px;
    width: 15%;
    margin-right: 15px;
}

.skeleton-wp-post-categories {
    height: 16px;
    width: 20%;
    margin-right: 15px;
}

.skeleton-wp-post-date {
    height: 16px;
    width: 10%;
}

/* WordPress Settings Page skeleton */
.skeleton-wp-settings {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 30px;
}

.skeleton-wp-settings-header {
    height: 32px;
    width: 40%;
    margin-bottom: 25px;
}

.skeleton-wp-settings-section {
    margin-bottom: 30px;
}

.skeleton-wp-settings-section-title {
    height: 24px;
    width: 30%;
    margin-bottom: 15px;
}

.skeleton-wp-settings-field {
    margin-bottom: 20px;
}

.skeleton-wp-settings-label {
    height: 20px;
    width: 25%;
    margin-bottom: 8px;
}

.skeleton-wp-settings-input {
    height: 40px;
    width: 60%;
}

.skeleton-wp-settings-description {
    height: 16px;
    width: 50%;
    margin-top: 8px;
}

/* WordPress Plugin Page skeleton */
.skeleton-wp-plugin-list {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 20px;
}

.skeleton-wp-plugin-card {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start;
}

.skeleton-wp-plugin-icon {
    width: 64px;
    height: 64px;
    border-radius: 4px;
    margin-right: 20px;
}

.skeleton-wp-plugin-info {
    flex: 1;
}

.skeleton-wp-plugin-name {
    height: 24px;
    width: 40%;
    margin-bottom: 8px;
}

.skeleton-wp-plugin-description {
    height: 16px;
    width: 80%;
    margin-bottom: 12px;
}

.skeleton-wp-plugin-meta {
    height: 16px;
    width: 30%;
}

/* WordPress Theme Page skeleton */
.skeleton-wp-theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.skeleton-wp-theme-card {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    overflow: hidden;
}

.skeleton-wp-theme-screenshot {
    height: 200px;
    width: 100%;
    background: #f0f0f0;
}

.skeleton-wp-theme-info {
    padding: 20px;
}

.skeleton-wp-theme-name {
    height: 24px;
    width: 60%;
    margin-bottom: 8px;
}

.skeleton-wp-theme-author {
    height: 16px;
    width: 40%;
    margin-bottom: 12px;
}

.skeleton-wp-theme-description {
    height: 16px;
    width: 80%;
}

/* WordPress Media Library skeleton */
.skeleton-wp-media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.skeleton-wp-media-item {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    overflow: hidden;
}

.skeleton-wp-media-thumbnail {
    height: 120px;
    width: 100%;
    background: #f0f0f0;
}

.skeleton-wp-media-info {
    padding: 12px;
}

.skeleton-wp-media-title {
    height: 16px;
    width: 80%;
    margin-bottom: 6px;
}

.skeleton-wp-media-meta {
    height: 14px;
    width: 60%;
}

/* WordPress Comments skeleton */
.skeleton-wp-comments {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 20px;
}

.skeleton-wp-comment-item {
    display: flex;
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
}

.skeleton-wp-comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 15px;
}

.skeleton-wp-comment-content {
    flex: 1;
}

.skeleton-wp-comment-author {
    height: 18px;
    width: 30%;
    margin-bottom: 6px;
}

.skeleton-wp-comment-text {
    height: 16px;
    width: 90%;
    margin-bottom: 8px;
}

.skeleton-wp-comment-meta {
    height: 14px;
    width: 40%;
}

/* WordPress User Table skeleton */
.skeleton-wp-user-table {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 20px;
}

.skeleton-wp-user-row {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.skeleton-wp-user-checkbox {
    width: 20px;
    height: 20px;
    border-radius: 2px;
    margin-right: 15px;
}

.skeleton-wp-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin-right: 15px;
}

.skeleton-wp-user-username {
    flex: 1;
    height: 18px;
    width: 25%;
    margin-right: 20px;
}

.skeleton-wp-user-email {
    height: 16px;
    width: 30%;
    margin-right: 15px;
}

.skeleton-wp-user-role {
    height: 16px;
    width: 15%;
}

/* WordPress Widget Area skeleton */
.skeleton-wp-widget-area {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 20px;
    min-height: 200px;
}

.skeleton-wp-widget {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 15px;
}

.skeleton-wp-widget-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.skeleton-wp-widget-title {
    height: 20px;
    width: 40%;
}

.skeleton-wp-widget-content {
    min-height: 80px;
}

/* WordPress Menu Editor skeleton */
.skeleton-wp-menu-editor {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 20px;
}

.skeleton-wp-menu-item {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

.skeleton-wp-menu-handle {
    width: 20px;
    height: 20px;
    margin-right: 15px;
}

.skeleton-wp-menu-title {
    flex: 1;
    height: 18px;
    width: 40%;
}

.skeleton-wp-menu-actions {
    height: 30px;
    width: 80px;
}

/* Customizer skeleton */
.skeleton-wp-customizer {
    display: flex;
    height: 100vh;
}

.skeleton-wp-customizer-sidebar {
    width: 300px;
    background: #fff;
    border-right: 1px solid #c3c4c7;
    padding: 20px;
}

.skeleton-wp-customizer-preview {
    flex: 1;
    background: #f0f0f0;
}

.skeleton-wp-customizer-section {
    margin-bottom: 20px;
}

.skeleton-wp-customizer-section-title {
    height: 24px;
    width: 50%;
    margin-bottom: 15px;
}

.skeleton-wp-customizer-control {
    height: 40px;
    width: 100%;
    margin-bottom: 10px;
}