/* ═══════════════════════════════════════════════════════════
   GESTEMAS NAVIGATION PROGRESS BAR (NProgress-inspired)
   Ultra-lightweight top-bar progress indicator.
   ═══════════════════════════════════════════════════════════ */

/* UNIFICATION: Hide any third-party NProgress/Loading bars that might conflict */
#nprogress, 
.nprogress, 
#loading-bar, 
.loading-bar {
    display: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Progress Bar Container */
#gestemas-progress {
    pointer-events: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 999999;
    opacity: 0;
    transition: opacity 0.4s ease;
}

#gestemas-progress.active {
    opacity: 1;
}

/* The Bar */
#gestemas-progress .bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    /* Refined Premium Purple (Amethyst) - No Blue to avoid "Double Bar" confusion */
    background: linear-gradient(90deg, #6366f1, #8b5cf6, #d946ef);
    border-radius: 0 2px 2px 0;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.5), 0 0 5px rgba(139, 92, 246, 0.3);
}

/* Peg — the shining dot at the end */
#gestemas-progress .bar::after {
    content: '';
    position: absolute;
    right: 0;
    top: -2px;
    width: 80px;
    height: 7px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.6);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.5);
    opacity: 1;
}

@keyframes gestemas-progress-spin {
    to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════════════════
   BUTTON LOADING STATES
   Micro-feedback for action buttons.
   ═══════════════════════════════════════════════════════════ */

/* Button in loading state */
.gestemas-btn--loading {
    position: relative !important;
    pointer-events: none !important;
    opacity: 0.85 !important;
    cursor: wait !important;
}

.gestemas-btn--loading > * {
    visibility: hidden !important;
}

.gestemas-btn--loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 18px;
    height: 18px;
    margin-top: -9px;
    margin-left: -9px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: gestemas-progress-spin 0.5s linear infinite;
    visibility: visible !important;
}

/* For outline/ghost buttons, use primary color for spinner */
.gestemas-btn--outline.gestemas-btn--loading::after,
.gestemas-btn--ghost.gestemas-btn--loading::after {
    border-color: rgba(99, 102, 241, 0.2);
    border-top-color: var(--gestemas-primary, #6366f1);
}

/* Success flash after action completes */
@keyframes gestemas-btn-success-flash {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
    70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.gestemas-btn--success-flash {
    animation: gestemas-btn-success-flash 0.6s ease-out;
}

/* ═══════════════════════════════════════════════════════════
   VIEW TRANSITION ENHANCEMENTS
   Smooth fade for content area transitions.
   ═══════════════════════════════════════════════════════════ */

#gestemas-content {
    transition: opacity 0.15s ease-out, transform 0.15s ease-out;
}

#gestemas-content.g-fade-out {
    opacity: 0.3;
    transform: translateY(4px);
}

.g-fade-up {
    animation: g-fade-up-anim 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes g-fade-up-anim {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ═══════════════════════════════════════════════════════════
   STAGGERED ENTRY ANIMATIONS
   Cascading entry for lists and grids.
   ═══════════════════════════════════════════════════════════ */

.g-stagger-container > .g-stagger-item {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.5s cubic-bezier(0.2, 0.8, 0.2, 1), 
                transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
    transition-delay: calc(var(--stagger-index, 0) * 0.05s);
}

.g-stagger-container.animate-stagger > .g-stagger-item {
    opacity: 1;
    transform: translateY(0);
}

/* Glassmorphism Interactivity */
.g-glass-pulse {
    position: relative;
    overflow: hidden;
}

.g-glass-pulse::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: skewX(-25deg);
    transition: none;
}

.g-glass-pulse:hover::after {
    left: 150%;
    transition: left 0.6s ease-in-out;
}

/* Premium Spring Transitions */
.g-spring-in {
    animation: g-spring-in-anim 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes g-spring-in-anim {
    0% { transform: scale(0.9) translateY(10px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* ═══════════════════════════════════════════════════════════
   SKELETON & EMPTY STATES ENHANCEMENTS
   ═══════════════════════════════════════════════════════════ */

.gestemas-skeleton {
    background: linear-gradient(
        90deg,
        rgba(241, 245, 249, 0.4) 25%,
        rgba(241, 245, 249, 0.9) 37%,
        rgba(241, 245, 249, 0.4) 63%
    );
    background-size: 400px 100%;
    animation: g-skeleton-shimmer 1.4s infinite linear;
    border-radius: 12px;
}

@keyframes g-skeleton-shimmer {
    0% { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}

/* Premium Empty States */
.g-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    text-align: center;
    background: var(--glass-v3-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-v3-border);
    border-radius: 24px;
    margin: 20px 0;
}

.g-empty-state i {
    width: 64px;
    height: 64px;
    color: var(--gestemas-primary);
    opacity: 0.2;
    margin-bottom: 24px;
}

.g-empty-state h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 12px;
}

.g-empty-state p {
    color: #64748b;
    max-width: 400px;
    margin: 0 auto 24px;
}

/* Connectivity Indicators */
.g-conn-status {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 10px 20px;
    border-radius: 100px;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 10000;
    transition: transform 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

.g-conn-status--active { transform: translateX(-50%) translateY(0); }
.g-conn-status--offline { background: #fee2e2; color: #ef4444; border: 1px solid #fecaca; }
.g-conn-status--online { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }

.gestemas-skeleton-page {
    min-height: 400px;
}

/* Admin bar position offset */
.admin-bar #gestemas-progress {
    top: 32px;
}

@media (max-width: 782px) {
    .admin-bar #gestemas-progress {
        top: 46px;
    }
}
