/* ============================================
   COMMON STYLES
   Shared utility classes used across multiple pages
   ============================================ */

/* ============================================
   LOADING STATES
   ============================================ */

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 40px;
    gap: 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e2e8f0;
    border-top-color: #4299e1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-container p {
    font-size: 18px;
    color: #718096;
}

/* ============================================
   ERROR STATES
   ============================================ */

.error-message {
    background: #fed7d7;
    border: 1px solid #fc8181;
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.error-message svg {
    width: 24px;
    height: 24px;
    color: #c53030;
    flex-shrink: 0;
}

.error-message p {
    color: #742a2a;
    margin: 0 0 8px 0;
    font-size: 16px;
}

.error-message div {
    flex: 1;
}

/* ============================================
   PAGE LAYOUT
   ============================================ */

.page-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* ============================================
   BUTTONS
   ============================================ */

.btn-back {
    margin-top: 16px;
    padding: 10px 20px;
    background: #4299e1;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-back:hover {
    background: #2b6cb0;
}

/* Shared title row for gradient headers (TournamentHeader, TournamentPlayerHeader) */
.header-title-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .header-title-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.625rem;
        margin-bottom: 0.625rem;
    }
}

/* Glass-morphism action button - used for Compare and Register actions on gradient headers */
.btn-action-header {
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(10px);
    white-space: nowrap;
}

.btn-action-header:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-action-header svg {
    flex-shrink: 0;
}

.btn-back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: #4299e1;
    font-size: 16px;
    cursor: pointer;
    padding: 8px 0;
    transition: color 0.2s;
}

.btn-back-link:hover {
    color: #2b6cb0;
}

.btn-back-link svg {
    width: 20px;
    height: 20px;
}

/* ============================================
   ANIMATED GRADIENT HEADER
   Reusable animated pattern background for gradient headers
   ============================================ */

.animated-gradient-header {
    position: relative;
    overflow: hidden;
}

.animated-gradient-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 1;
    animation: animated-pattern 20s linear infinite;
    z-index: 0;
}

@keyframes animated-pattern {
    0% { background-position: 0 0; }
    100% { background-position: 60px 60px; }
}

.animated-gradient-header > * {
    position: relative;
    z-index: 1;
}

/* ============================================
   EMPTY STATES
   ============================================ */

.empty-state {
    background: #edf2f7;
    border-radius: 12px;
    padding: 60px 40px;
    text-align: center;
}

.empty-state p {
    font-size: 16px;
    color: #718096;
    margin: 0;
}

.empty-state svg {
    width: 48px;
    height: 48px;
    color: #cbd5e0;
    margin-bottom: 16px;
}

/* ============================================
   STAT BADGES
   Unified stat badge component for headers across the app
   ============================================ */

.stats-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.stats-badges .stat-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.stats-badges .stat-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.stats-badges .stat-badge svg {
    flex-shrink: 0;
    stroke: white;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.stats-badges .stat-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: white;
    line-height: 1;
}

.stats-badges .stat-label {
    font-size: 0.875rem;
    color: white;
    opacity: 0.9;
    font-weight: 500;
}

/* Colored Badge Variants */
.stats-badges .stat-badge.primary {
    background: rgba(255, 193, 7, 0.25);
}

.stats-badges .stat-badge.primary:hover {
    background: rgba(255, 193, 7, 0.35);
}

.stats-badges .stat-badge.success {
    background: rgba(76, 175, 80, 0.25);
}

.stats-badges .stat-badge.success:hover {
    background: rgba(76, 175, 80, 0.35);
}

.stats-badges .stat-badge.danger {
    background: rgba(244, 67, 54, 0.25);
}

.stats-badges .stat-badge.danger:hover {
    background: rgba(244, 67, 54, 0.35);
}

.stats-badges .stat-badge.neutral {
    background: rgba(158, 158, 158, 0.25);
}

.stats-badges .stat-badge.neutral:hover {
    background: rgba(158, 158, 158, 0.35);
}

.stats-badges .stat-badge.info {
    background: rgba(33, 150, 243, 0.25);
}

.stats-badges .stat-badge.info:hover {
    background: rgba(33, 150, 243, 0.35);
}

.stats-badges .stat-badge.warning {
    background: rgba(237, 137, 54, 0.25);
}

.stats-badges .stat-badge.warning:hover {
    background: rgba(237, 137, 54, 0.35);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .stats-badges .stat-badge {
        padding: 0.4rem 0.75rem;
    }

    .stats-badges .stat-value {
        font-size: 1rem;
    }

    .stats-badges .stat-label {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .stats-badges {
        gap: 0.4rem;
        margin-top: 0.625rem;
    }

    .stats-badges .stat-badge {
        padding: 0.3rem 0.5rem;
        border-radius: 8px;
        gap: 0.3rem;
    }

    .stats-badges .stat-badge svg {
        width: 14px;
        height: 14px;
    }

    .stats-badges .stat-value {
        font-size: 0.8125rem;
    }

    .stats-badges .stat-label {
        font-size: 0.6875rem;
    }

    .btn-action-header {
        padding: 0.375rem 0.625rem;
        font-size: 0.75rem;
        gap: 0.375rem;
    }

    .btn-action-header svg {
        width: 14px;
        height: 14px;
    }
}

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

@media (max-width: 768px) {
    .page-container {
        padding: 20px 16px;
    }
}
