/* loading-spinner.css - Estilos de loading */

/* Spinner animado */
.spinner {
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--accent-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Loading inline */
.loading-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

.loading-inline .spinner {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(13, 17, 23, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 9998;
    backdrop-filter: blur(4px);
}

.loading-overlay .spinner {
    width: 60px;
    height: 60px;
    border-width: 4px;
}

.loading-overlay-text {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 500;
}

/* ═══════════════════════════════════════════
   SKELETON LOADING SYSTEM
   ═══════════════════════════════════════════ */

/* Base shimmer */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-tertiary) 0%,
        var(--bg-hover) 40%,
        var(--bg-tertiary) 80%
    );
    background-size: 300% 100%;
    animation: skeleton-shimmer 1.8s ease-in-out infinite;
    border-radius: 6px;
    position: relative;
    overflow: hidden;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Text lines */
.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
    border-radius: 4px;
}
.skeleton-text:last-child { width: 60%; }
.skeleton-text-sm { height: 11px; }
.skeleton-text-lg { height: 20px; }
.skeleton-text-xl { height: 28px; width: 40%; }

/* Shapes */
.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    flex-shrink: 0;
}
.skeleton-avatar-lg {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    flex-shrink: 0;
}
.skeleton-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
}
.skeleton-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    flex-shrink: 0;
}
.skeleton-badge {
    width: 60px;
    height: 22px;
    border-radius: 11px;
}
.skeleton-btn {
    width: 90px;
    height: 32px;
    border-radius: 6px;
}

/* Cards */
.skeleton-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ── Skeleton: Stat Card ── */
.skeleton-stat-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 88px;
}
.skeleton-stat-card .skeleton-stat-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ── Skeleton: Server Card (servers page) ── */
.skeleton-srv-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.skeleton-srv-card .skeleton-srv-top {
    display: flex;
    align-items: center;
    gap: 12px;
}
.skeleton-srv-card .skeleton-srv-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.skeleton-srv-card .skeleton-srv-bars {
    display: flex;
    gap: 8px;
}
.skeleton-srv-card .skeleton-srv-bars > div {
    flex: 1;
    height: 6px;
    border-radius: 3px;
}
.skeleton-srv-card .skeleton-srv-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

/* ── Skeleton: Server Row (dashboard home) ── */
.skeleton-server-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}
.skeleton-server-row:last-child { border-bottom: none; }
.skeleton-server-row .skeleton-server-row-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* ── Skeleton: Activity Item ── */
.skeleton-activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
}
.skeleton-activity-item .skeleton-activity-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* ── Skeleton: Resource Bar ── */
.skeleton-resource-bar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 4px 0;
}
.skeleton-resource-bar .skeleton-bar-header {
    display: flex;
    justify-content: space-between;
}
.skeleton-resource-bar .skeleton-bar-track {
    height: 8px;
    border-radius: 4px;
    background: var(--bg-tertiary);
    overflow: hidden;
}
.skeleton-resource-bar .skeleton-bar-fill {
    height: 100%;
    border-radius: 4px;
    width: 45%;
}

/* ── Skeleton: Table Row ── */
.skeleton-table-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}
.skeleton-table-row:last-child { border-bottom: none; }

/* ── Skeleton: File Row ── */
.skeleton-file-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-color);
}
.skeleton-file-row:last-child { border-bottom: none; }
.skeleton-file-row .skeleton-file-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* ── Skeleton: System Status Row ── */
.skeleton-sys-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
}
.skeleton-sys-row .skeleton-sys-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* ── Skeleton wrapper (fades out when content loads) ── */
.skeleton-wrap {
    transition: opacity 0.3s ease;
}
.skeleton-wrap.loaded {
    opacity: 0;
    pointer-events: none;
    position: absolute;
}

/* ── Utility: inline flex row ── */
.skeleton-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ── Skeleton: Backup/Database/Schedule card ── */
.skeleton-list-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 8px;
}
.skeleton-list-card .skeleton-list-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Pulsing dot */
.loading-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-primary);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

/* Loading state para botões */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
