/* ========== GLOBAL STYLES ========== */
body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Secondary/muted text — passes WCAG AA (5.60:1 on Radzen body bg #f3f4f6) */
.sqv-text-muted {
    color: #596270;
}

/* Radzen link color override — default #3ba5fc fails WCAG AA on body bg #f3f4f6 */
:root {
    --rz-link-color: #2563eb;
}

/* Radzen NavMenu: collapsed items still keyboard-focusable (Radzen upstream bug).
   visibility:hidden removes them from tab order without breaking height animation. */
.rz-expander.rz-state-collapsed {
    visibility: hidden;
}

/* Screen-reader only utility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Force font-display: swap for icon fonts */
@font-face {
    font-family: 'bootstrap-icons';
    font-display: swap;
}

/* Consume the Radzen preload for MaterialSymbolsOutlined.
   RadzenTheme emits a <link rel="preload"> for this font, but in Blazor Server
   the components that use it render only after circuit connect (post window.load),
   causing a browser "preloaded but not used" warning. Declaring the font-face here
   in a static stylesheet claims the preload immediately, before the timeout fires. */
@font-face {
    font-family: 'Material Symbols Outlined';
    font-style: normal;
    font-weight: 100 700;
    font-display: block;
    src: url('/_content/Radzen.Blazor/fonts/MaterialSymbolsOutlined.woff2') format('woff2');
}

/* ========== TEAM LOGOS ========== */
.team-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 4px;
}

.team-logo-sm {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.team-logo-lg {
    width: 64px;
    height: 64px;
    object-fit: contain;
}

.team-logo-xl {
    width: 100px;
    height: 100px;
    object-fit: contain;
}

/* ========== LEADERBOARD & GAMIFICATION ========== */
.podium-card {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
}

    .podium-card:hover {
        transform: translateY(-8px);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    }

.podium-first {
    background: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
    transform: scale(1.05);
    z-index: 10;
}

.podium-second {
    background: linear-gradient(135deg, #e0e0e0 0%, #c9c9c9 100%);
}

.podium-third {
    background: linear-gradient(135deg, #cd7f32 0%, #b87333 100%);
}

.podium-rank {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 1rem;
}

.podium-first .podium-rank {
    color: #fff;
}

.podium-points {
    font-size: 1.5rem;
    font-weight: bold;
    margin-top: 0.5rem;
}

.player-avatar-sm {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.player-avatar-lg {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
}

.player-avatar-xl {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 3rem;
}

.podium-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    margin: 1rem auto;
    color: white;
}

.avatar-gold {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
}

.avatar-silver {
    background: linear-gradient(135deg, #C0C0C0 0%, #A8A8A8 100%);
    box-shadow: 0 4px 12px rgba(192, 192, 192, 0.4);
}

.avatar-bronze {
    background: linear-gradient(135deg, #CD7F32 0%, #B87333 100%);
    box-shadow: 0 4px 12px rgba(205, 127, 50, 0.4);
}

.leaderboard-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: bold;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.avatar-ring-legendary {
    box-shadow: 0 0 0 3px #ff6b6b;
}

.avatar-ring-epic {
    box-shadow: 0 0 0 3px #a855f7;
}

.avatar-ring-rare {
    box-shadow: 0 0 0 3px #3b82f6;
}

.rank-badge {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
    background: #6c757d;
    color: white;
}

.rank-gold {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
}

.rank-silver {
    background: linear-gradient(135deg, #C0C0C0 0%, #A8A8A8 100%);
}

.rank-bronze {
    background: linear-gradient(135deg, #CD7F32 0%, #B87333 100%);
}

.rarity-stack-bar {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    width: 100%;
}

.rarity-segment {
    transition: width 0.3s;
}

.rarity-legendary {
    background: #ff6b6b;
}

.rarity-epic {
    background: #a855f7;
}

.rarity-rare {
    background: #3b82f6;
}

.rarity-common {
    background: #6c757d;
}

.podium-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    align-items: end;
}

@media (max-width: 768px) {
    .podium-container {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

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

    .podium-second {
        order: 2;
    }

    .podium-third {
        order: 3;
    }

    .team-logo-xl {
        width: 60px;
        height: 60px;
    }
}

/* ========== ANIMATIONS ========== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in,
.animate-fadeInUp {
    animation: fadeIn 0.5s ease-out;
}

.stagger-children > * {
    animation-delay: calc(var(--stagger-index, 0) * 0.1s);
}

/* ========== PWA & MOBILE OPTIMIZATIONS ========== */

/* Safe Area Support (for notched devices like iPhone X+) */
:root {
    --safe-area-inset-top: env(safe-area-inset-top, 0);
    --safe-area-inset-right: env(safe-area-inset-right, 0);
    --safe-area-inset-bottom: env(safe-area-inset-bottom, 0);
    --safe-area-inset-left: env(safe-area-inset-left, 0);
}

body {
    padding-top: var(--safe-area-inset-top);
    padding-right: var(--safe-area-inset-right);
    padding-bottom: var(--safe-area-inset-bottom);
    padding-left: var(--safe-area-inset-left);
}

/* Touch Interactions */
* {
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Touch-friendly elements */
.rz-button,
.nav-link,
button {
    user-select: none;
    -webkit-user-select: none;
}

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

/* Extra Small Devices (Phones, < 576px) */
@media (max-width: 575.98px) {
    /* Touch-friendly buttons */
    .rz-button {
        min-height: 44px;
        min-width: 44px;
        padding: 12px 20px;
        font-size: 16px; /* Prevents iOS zoom on focus */
    }

    /* Hide numeric spinner up/down buttons on mobile — users type directly.
       Frees up full input width and avoids cramped arrows in narrow inputs. */
    .rz-numeric .rz-numeric-button,
    .rz-numeric .rz-numeric-up,
    .rz-numeric .rz-numeric-down,
    .rz-spinner-button {
        display: none !important;
    }

    /* Numeric wrapper: flex so inner input is vertically centered;
       remove padding from wrapper (it's meant for the inner input) */
    .rz-numeric {
        display: flex !important;
        align-items: center !important;
        padding: 0 !important;
    }

    /* Let the input fill the full wrapper width when spinners are hidden */
    .rz-numeric .rz-inputtext {
        width: 100% !important;
        height: 100% !important;
        min-height: 44px !important;
        padding: 0 12px !important;
        border-radius: var(--rz-border-radius) !important;
        text-align: center;
        border: none !important;
        box-shadow: none !important;
        background: transparent !important;
    }

    /* Show focus ring on wrapper only, not on the inner input */
    .rz-numeric:focus-within {
        border-color: var(--rz-primary) !important;
        box-shadow: 0 0 0 3px rgba(var(--sqv-primary-rgb, 22, 163, 74), 0.12) !important;
    }

    /* Touch-friendly form inputs */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    input[type="date"],
    input[type="time"],
    select,
    textarea,
    .rz-textbox,
    .rz-dropdown,
    .rz-numeric,
    .rz-datepicker-input {
        min-height: 44px;
        font-size: 16px; /* Prevents zoom */
        padding: 10px 12px;
    }

    /* Touch-friendly checkboxes and radios */
    input[type="checkbox"],
    input[type="radio"] {
        min-width: 24px;
        min-height: 24px;
        transform: scale(1.2);
    }

    /* Mobile spacing */
    .container-fluid {
        padding-left: 12px;
        padding-right: 12px;
    }

    /* Mobile tables - enable horizontal scroll */
    .table-responsive,
    .rz-datatable-scrollable-body {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 1rem;
    }

    /* Mobile cards */
    .rz-card {
        margin-bottom: 12px;
    }

    /* Reduce padding on mobile */
    .rz-card-content {
        padding: 16px;
    }

    /* Radzen grid on mobile */
    .rz-datatable {
        font-size: 0.875rem;
    }

    /* Radzen dialog on mobile */
    .rz-dialog {
        margin: 0.5rem;
        max-width: calc(100vw - 1rem);
    }

    .rz-dialog-content {
        padding: 16px;
    }

    /* Radzen dropdown menu on mobile */
    .rz-dropdown-panel {
        max-height: 60vh;
        overflow-y: auto;
    }

    /* Mobile grid: card row padding */
    .rz-data-grid .rz-datatable-data td {
        padding: 0.75rem 0.5rem;
    }

    /* Mobile pager: kompaktniji, lakši za dodir */
    .rz-pager {
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.5rem;
    }

    .rz-pager .rz-pager-page-numbers {
        display: none;
    }

    .rz-pager .rz-button {
        min-width: 44px;
        min-height: 44px;
    }

    /* Mobile filter card - vertical stack */
    .rz-card .rz-stack[style*="flex-direction: row"],
    .rz-card .rz-stack[style*="flex-wrap: wrap"] {
        flex-direction: column !important;
    }
}

/* ========== PWA-SPECIFIC STYLES ========== */

/* Standalone mode (when installed as PWA) */
@media all and (display-mode: standalone) {
    body {
        padding-top: calc(env(safe-area-inset-top) + 10px);
    }
}

/* ========== ACCESSIBILITY IMPROVEMENTS ========== */

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--rz-primary);
    outline-offset: 2px;
}

/* Better contrast for disabled elements */
.rz-button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ========== PRINT STYLES ========== */

@media print {
    .rz-sidebar,
    .rz-header,
    .rz-button,
    .notification-bell,
    .rz-paginator {
        display: none !important;
    }

    body {
        padding: 0;
    }

    .rz-card {
        page-break-inside: avoid;
    }

    a[href]:after {
        content: none;
    }
}

/* ========== RADZEN COMPONENT OVERRIDES ========== */

/* Prevent horizontal scrollbar on sidebar expand */
.rz-layout {
    overflow-x: hidden !important;
}

.rz-body {
    overflow-x: hidden !important;
    width: 100%;
}

/* Ensure smooth sidebar transitions without overflow */
.rz-sidebar {
    transition: all 0.3s ease;
}

/* Fix profile menu styling */
.rz-profile-menu {
    background-color: transparent !important;
}

.rz-profile-menu:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.rz-profile-menu-content {
    background-color: white !important;
    border: 1px solid #dee2e6 !important;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
    z-index: 10000 !important;
}

.rz-profile-menu-item:hover {
    background-color: #f8f9fa !important;
}

/* ===== Footer ===== */
.app-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--rz-border-color);
    margin-top: 48px;
    background: var(--rz-base-50, #f9fafb);
}
.app-footer .rz-link {
    font-size: 12px;
    color: var(--rz-text-secondary-color);
    text-decoration: none;
    transition: color .2s;
}
.app-footer .rz-link:hover {
    color: var(--rz-primary);
    text-decoration: underline;
}

/* ===== Brand text (fallback if @supports off) ===== */
@supports not (-webkit-background-clip: text) {
    .app-brand-text {
        background: none !important;
        -webkit-text-fill-color: initial !important;
        color: var(--rz-primary) !important;
    }
}

/* ===== Header icon buttons (ChatBell / AnnouncementBell / NotificationBell) ===== */
.chat-bell,
.announcement-bell,
.notification-bell {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s ease;
    flex-shrink: 0;
}
.chat-bell:hover,
.announcement-bell:hover,
.notification-bell:hover {
    background: var(--rz-base-100, #f3f4f6);
}
.chat-bell .rz-link,
.announcement-bell .rz-link,
.notification-bell .rz-link {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--rz-text-color, #374151) !important;
    text-decoration: none !important;
}

/* ===== Club switcher u headeru ===== */
/* Na malim ekranima smanji da ne zbija ostale akcije */
@media (max-width: 575.98px) {
    .sqv-club-switcher .rz-dropdown {
        width: 120px !important;
        max-width: 120px !important;
        font-size: 13px;
    }
}

/* ===== Header separator ===== */
.header-divider {
    width: 1px;
    height: 28px;
    background: var(--rz-border-color, #e5e7eb);
    flex-shrink: 0;
}

/* ===== Header user chip ===== */
.header-user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 10px 4px 4px;
    border-radius: 999px;
    cursor: pointer;
    transition: background .2s ease;
}
.header-user-chip:hover {
    background: var(--rz-base-100, #f3f4f6);
}
.header-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--sqv-brand-gradient, linear-gradient(135deg, #1E88E5, #E53935));
    color: #fff;
    font-weight: 700;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-shadow: 0 1px 2px rgba(0,0,0,.15);
    letter-spacing: .3px;
}
.header-user-info { line-height: 1.25; }
.header-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--rz-text-color, #1f2937);
    white-space: nowrap;
}
.header-user-role {
    font-size: 11px;
    color: var(--rz-text-secondary-color, #6b7280);
    white-space: nowrap;
}

/* Strip RadzenProfileMenu button chrome so our chip shows cleanly */
.user-menu .rz-profile-menu-button {
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    height: auto !important;
}
/* ============================================================
   Performance: GPU-compositing hints for Radzen animations
   Prevents CLS from non-composited SVG animations
   ============================================================ */

/* Force GPU layer for circular progress bar rotation */
.rz-progress-bar-circular,
.rz-progressbar-circular {
    will-change: transform;
    contain: layout;
}

/* SVG stroke animations can't be composited — isolate them */
.rz-progress-bar-circular circle,
.rz-progressbar-circular circle {
    will-change: stroke-dashoffset;
}
