/* =================================================================
   PREMIUM UI COMPONENTS - MODERN COMPONENT LIBRARY FOR 2025
   Glass morphism design system and premium interactive elements
   Created: 2025-01-25
   ================================================================= */

/* =================================================================
   GLASS MORPHISM DESIGN SYSTEM
   ================================================================= */

.glass-panel {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    box-shadow: var(--shadow-moderate);
    transition: all var(--animation-duration-medium) var(--animation-easing-smooth);
}

.glass-panel:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: var(--shadow-strong);
    transform: translateY(-2px);
}

.glass-panel-strong {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.glass-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    opacity: 0;
    transition: opacity var(--animation-duration-medium) var(--animation-easing-smooth);
}

.glass-overlay.active {
    opacity: 1;
}

/* =================================================================
   PREMIUM BUTTON COMPONENTS
   ================================================================= */

.btn-premium {
    position: relative;
    padding: 12px 24px;
    font-family: var(--font-primary);
    font-weight: var(--font-weight-semibold);
    font-size: var(--text-base);
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--animation-duration-medium) var(--animation-easing-spring);
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    will-change: transform;
}

.btn-premium::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left var(--animation-duration-medium) var(--animation-easing-smooth);
}

.btn-premium:hover::before {
    left: 100%;
}

.btn-premium:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: var(--shadow-strong);
}

.btn-premium:active {
    transform: translateY(0) scale(0.98);
    transition-duration: var(--animation-duration-fast);
}

/* Primary Button with Gradient */
.btn-primary {
    background: var(--gradient-premium-gold);
    color: var(--battle-bg-primary);
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
}

.btn-primary:hover {
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.4), var(--shadow-strong);
}

/* Secondary Button with Glass Effect */
.btn-secondary {
    background: var(--glass-bg);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Danger Button */
.btn-danger {
    background: linear-gradient(135deg, var(--opponent-primary) 0%, var(--opponent-secondary) 100%);
    color: var(--text-primary);
    box-shadow: 0 4px 15px rgba(255, 23, 68, 0.3);
}

.btn-danger:hover {
    box-shadow: 0 8px 25px rgba(255, 23, 68, 0.4), var(--shadow-strong);
}

/* Success Button */
.btn-success {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: var(--text-primary);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.btn-success:hover {
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.4), var(--shadow-strong);
}

/* Loading State */
.btn-loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* =================================================================
   MODERN MODAL AND OVERLAY SYSTEMS
   ================================================================= */

.modal-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all var(--animation-duration-medium) var(--animation-easing-smooth);
}

.modal-container.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-2xl);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-dramatic);
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.8) translateY(50px);
    transition: all var(--animation-duration-medium) var(--animation-easing-spring);
}

.modal-container.active .modal-content {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: var(--font-weight-bold);
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: var(--text-xl);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-md);
    transition: all var(--animation-duration-fast) var(--animation-easing-smooth);
}

.modal-close:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.modal-body {
    padding: 24px;
    color: var(--text-secondary);
}

.modal-footer {
    padding: 16px 24px 24px;
    border-top: 1px solid var(--glass-border);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* =================================================================
   NOTIFICATION AND TOAST SYSTEMS
   ================================================================= */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
}

.toast {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-left: 4px solid var(--player-primary);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    padding: 16px;
    box-shadow: var(--shadow-strong);
    transform: translateX(100%);
    opacity: 0;
    transition: all var(--animation-duration-medium) var(--animation-easing-spring);
    cursor: pointer;
}

.toast.active {
    transform: translateX(0);
    opacity: 1;
}

.toast.success {
    border-left-color: #4CAF50;
}

.toast.warning {
    border-left-color: #FF9800;
}

.toast.error {
    border-left-color: var(--opponent-primary);
}

.toast.info {
    border-left-color: var(--player-primary);
}

.toast-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.toast-title {
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    font-size: var(--text-sm);
    margin: 0;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: color var(--animation-duration-fast) var(--animation-easing-smooth);
}

.toast-close:hover {
    color: var(--text-primary);
}

.toast-message {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    line-height: 1.4;
    margin: 0;
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: var(--player-primary);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    transition: width linear;
}

/* =================================================================
   LOADING AND SKELETON STATES
   ================================================================= */

.skeleton {
    background: linear-gradient(90deg, var(--glass-bg) 25%, rgba(255, 255, 255, 0.1) 50%, var(--glass-bg) 75%);
    background-size: 200px 100%;
    animation: shimmerLoading 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

@keyframes shimmerLoading {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.skeleton-text {
    height: 1em;
    margin: 0.5em 0;
}

.skeleton-text.large {
    height: 1.5em;
}

.skeleton-text.small {
    height: 0.8em;
    width: 60%;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
}

.skeleton-card {
    width: 100%;
    height: 200px;
    border-radius: var(--radius-xl);
}

/* Progressive Image Loading */
.progressive-image {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
}

.progressive-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all var(--animation-duration-medium) var(--animation-easing-smooth);
}

.progressive-image .placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--glass-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity var(--animation-duration-medium) var(--animation-easing-smooth);
}

.progressive-image.loaded .placeholder {
    opacity: 0;
}

/* =================================================================
   FORM CONTROLS AND INPUTS
   ================================================================= */

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
    font-size: var(--text-sm);
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: var(--text-base);
    font-family: var(--font-primary);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    transition: all var(--animation-duration-fast) var(--animation-easing-smooth);
}

.form-input:focus {
    outline: none;
    border-color: var(--player-primary);
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.2);
    background: rgba(255, 255, 255, 0.1);
}

.form-input::placeholder {
    color: var(--text-muted);
}

/* =================================================================
   PROGRESS INDICATORS
   ================================================================= */

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--glass-bg);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-premium-gold);
    border-radius: inherit;
    transition: width var(--animation-duration-medium) var(--animation-easing-smooth);
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmerLoading 2s ease-in-out infinite;
}

.progress-circular {
    width: 40px;
    height: 40px;
    border: 3px solid var(--glass-bg);
    border-top: 3px solid var(--player-primary);
    border-radius: var(--radius-full);
    animation: spin 1s linear infinite;
}

/* =================================================================
   RESPONSIVE DESIGN
   ================================================================= */

@media (max-width: 768px) {
    .modal-content {
        margin: 0;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        max-height: 80vh;
    }
    
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .toast {
        border-radius: var(--radius-lg);
    }
    
    .btn-premium {
        padding: 14px 20px;
        font-size: var(--text-base);
    }
}

/* =================================================================
   ACCESSIBILITY ENHANCEMENTS
   ================================================================= */

@media (prefers-reduced-motion: reduce) {
    .skeleton,
    .progress-fill::after,
    .btn-premium::before {
        animation: none;
    }
    
    .modal-content {
        transition: opacity var(--animation-duration-medium) var(--animation-easing-smooth);
    }
    
    .toast {
        transition: opacity var(--animation-duration-medium) var(--animation-easing-smooth);
    }
}

/* Focus styles for keyboard navigation */
.btn-premium:focus-visible,
.modal-close:focus-visible,
.toast-close:focus-visible,
.form-input:focus-visible {
    outline: 2px solid var(--player-primary);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .glass-panel,
    .btn-secondary,
    .form-input {
        background: var(--bg-high-contrast);
        border-color: var(--text-high-contrast);
        color: var(--text-high-contrast);
    }
    
    .btn-premium::before,
    .skeleton {
        display: none;
    }
}