/**
 * UI Enhancements - IRO WCH
 * Toast notifications, skeleton loaders, animations, and visual improvements
 */

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.2), 0 4px 6px -4px rgb(0 0 0 / 0.2);
    padding: 16px;
    min-width: 320px;
    max-width: 400px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    position: relative;
    overflow: hidden;
    pointer-events: auto;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

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

.toast-hide {
    transform: translateX(400px);
    opacity: 0;
}

.toast-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.toast-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.toast-message {
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

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

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: currentColor;
    opacity: 0.3;
    transform-origin: left;
    animation: toast-progress linear forwards;
}

@keyframes toast-progress {
    from {
        transform: scaleX(1);
    }
    to {
        transform: scaleX(0);
    }
}

/* Toast Types */
.toast-success {
    border-left: 4px solid var(--success-color);
}

.toast-success .toast-icon {
    color: var(--success-color);
}

.toast-success .toast-progress {
    background: var(--success-color);
}

.toast-error {
    border-left: 4px solid var(--error-color);
}

.toast-error .toast-icon {
    color: var(--error-color);
}

.toast-error .toast-progress {
    background: var(--error-color);
}

.toast-warning {
    border-left: 4px solid var(--warning-color);
}

.toast-warning .toast-icon {
    color: var(--warning-color);
}

.toast-warning .toast-progress {
    background: var(--warning-color);
}

.toast-info {
    border-left: 4px solid var(--primary-color);
}

.toast-info .toast-icon {
    color: var(--primary-color);
}

.toast-info .toast-progress {
    background: var(--primary-color);
}

.toast-loading .toast-icon i {
    animation: spin 1s linear infinite;
}

/* ============================================
   SKELETON LOADERS
   ============================================ */

.skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-secondary) 25%,
        var(--bg-hover) 50%,
        var(--bg-secondary) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
}

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

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
    border-radius: var(--radius-sm);
}

.skeleton-text:last-child {
    width: 80%;
}

.skeleton-title {
    height: 1.5rem;
    width: 60%;
    margin-bottom: 1rem;
    border-radius: var(--radius-md);
}

.skeleton-card {
    height: 120px;
    border-radius: var(--radius-lg);
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.skeleton-table-row {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.skeleton-table-cell {
    height: 1rem;
    flex: 1;
    border-radius: var(--radius-sm);
}

/* ============================================
   PODIUM VISUALIZATION
   ============================================ */

.podium-container {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
    margin: 2rem 0;
}

.podium-place {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    animation: podium-rise 0.6s ease-out backwards;
}

.podium-place.first {
    order: 2;
    animation-delay: 0.2s;
}

.podium-place.second {
    order: 1;
    animation-delay: 0.1s;
}

.podium-place.third {
    order: 3;
    animation-delay: 0s;
}

@keyframes podium-rise {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.podium-medal {
    font-size: 3rem;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
    animation: medal-float 3s ease-in-out infinite;
}

.podium-place.first .podium-medal {
    animation-delay: 0s;
}

.podium-place.second .podium-medal {
    animation-delay: 0.5s;
}

.podium-place.third .podium-medal {
    animation-delay: 1s;
}

@keyframes medal-float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-10px) rotate(5deg);
    }
}

.podium-card {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    text-align: center;
    min-width: 200px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.podium-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
}

.podium-place.first .podium-card {
    transform: scale(1.1);
}

.podium-place.first .podium-card::before {
    background: linear-gradient(90deg, #FFD700, #FFA500);
}

.podium-place.second .podium-card::before {
    background: linear-gradient(90deg, #C0C0C0, #A8A8A8);
}

.podium-place.third .podium-card::before {
    background: linear-gradient(90deg, #CD7F32, #B8732D);
}

.podium-card:hover {
    transform: scale(1.05);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.2);
}

.podium-place.first .podium-card:hover {
    transform: scale(1.15);
}

.podium-rank {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.podium-competitor {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.podium-dog {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 1rem;
}

.podium-country {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.podium-team {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.podium-score {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.podium-score-detail {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

/* ============================================
   PROGRESS BARS
   ============================================ */

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

.score-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #8b5cf6);
    border-radius: 999px;
    transition: width 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
}

.score-progress-bar::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: progress-shine 2s ease-in-out infinite;
}

@keyframes progress-shine {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.score-progress.excellent .score-progress-bar {
    background: linear-gradient(90deg, #059669, #10b981);
}

.score-progress.good .score-progress-bar {
    background: linear-gradient(90deg, #2563eb, #3b82f6);
}

.score-progress.fair .score-progress-bar {
    background: linear-gradient(90deg, #d97706, #f59e0b);
}

.score-progress.poor .score-progress-bar {
    background: linear-gradient(90deg, #dc2626, #ef4444);
}

.score-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.score-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.score-value {
    font-weight: 600;
    color: var(--text-primary);
}

/* ============================================
   ENHANCED HOVER EFFECTS
   ============================================ */

.nav-card {
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
}

.nav-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent, rgba(37, 99, 235, 0.05));
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: var(--radius-xl);
    pointer-events: none;
}

.nav-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.15), 0 10px 10px -5px rgb(0 0 0 / 0.08);
}

.nav-card:hover::before {
    opacity: 1;
}

.nav-card:active {
    transform: translateY(-2px) scale(1.01);
}

/* Stat Cards Animation */
.stat-card {
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.stat-number {
    transition: all 0.3s ease;
}

.stat-card:hover .stat-number {
    transform: scale(1.1);
}

/* Button Loading State */
.btn {
    position: relative;
    transition: all 0.2s ease;
}

.btn.loading {
    color: transparent;
    pointer-events: none;
}

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

.btn-secondary.loading::after {
    color: var(--text-primary);
}

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

/* Pulse Animation for Live Updates */
.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

.pulse-ring {
    position: relative;
}

.pulse-ring::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--primary-color);
    opacity: 0.4;
    transform: translate(-50%, -50%) scale(1);
    animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse-ring {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.4;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0;
    }
}

/* ============================================
   CATEGORY COLOR CODING
   ============================================ */

:root {
    --category-rubble: #059669;
    --category-rubble-light: #10b981;
    --category-area: #2563eb;
    --category-area-light: #3b82f6;
    --category-trace: #d97706;
    --category-trace-light: #f59e0b;
}

.category-indicator {
    width: 4px;
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.category-rubble .category-indicator {
    background: linear-gradient(180deg, var(--category-rubble), var(--category-rubble-light));
}

.category-area .category-indicator {
    background: linear-gradient(180deg, var(--category-area), var(--category-area-light));
}

.category-trace .category-indicator {
    background: linear-gradient(180deg, var(--category-trace), var(--category-trace-light));
}

/* Category Badges Enhanced */
.category-badge {
    position: relative;
    overflow: hidden;
}

.category-badge::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s ease;
}

.category-badge:hover::before {
    left: 100%;
}

/* ============================================
   IMPROVED TYPOGRAPHY & SPACING
   ============================================ */

.hero-card {
    padding: 2.5rem;
}

.competition-info h2 {
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    background: linear-gradient(135deg, var(--text-primary), var(--primary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-header h2 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

/* Better Focus States */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Smooth Page Transitions */
.fade-in {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   MOBILE OPTIMIZATIONS
   ============================================ */

@media (max-width: 768px) {
    .toast-container {
        left: 10px;
        right: 10px;
    }

    .toast {
        min-width: 0;
        max-width: 100%;
    }

    .podium-container {
        flex-direction: column;
        align-items: center;
        gap: 1.5rem;
    }

    .podium-place {
        order: unset !important;
        width: 100%;
        max-width: 300px;
    }

    .podium-card {
        min-width: 0;
        width: 100%;
    }

    .podium-place.first .podium-card {
        transform: scale(1);
    }
}

/* ============================================
   DARK THEME ADJUSTMENTS
   ============================================ */

[data-theme="dark"] .skeleton {
    background: linear-gradient(
        90deg,
        var(--bg-secondary) 25%,
        rgba(255, 255, 255, 0.05) 50%,
        var(--bg-secondary) 75%
    );
    background-size: 200% 100%;
}

[data-theme="dark"] .toast {
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5);
}

[data-theme="dark"] .podium-card {
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.4);
}
