/* SquidChops - Custom Styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Squid Game-inspired color palette */
    --deep-black: #0E0E10;
    --anthracite: #1C1C20;
    --off-white: #F2F2F2;
    --accent-pink: #E91E63;
    --game-green: #116D5E;
    --light-neon: #00F0FF;
    --danger-red: #DC2626;
    --warning-orange: #F59E0B;
    
    /* Shadows and effects */
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-hover: 0 10px 25px -3px rgba(233, 30, 99, 0.3), 0 4px 6px -2px rgba(233, 30, 99, 0.15);
    --glow-pink: 0 0 20px rgba(233, 30, 99, 0.4);
    --glow-neon: 0 0 15px rgba(0, 240, 255, 0.3);
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: 
        radial-gradient(circle at 20% 50%, rgba(233, 30, 99, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(17, 109, 94, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(0, 240, 255, 0.1) 0%, transparent 50%),
        linear-gradient(135deg, #0E0E10 0%, #1C1C20 25%, #0E0E10 50%, #1C1C20 75%, #0E0E10 100%);
    color: var(--off-white);
    min-height: 100vh;
    line-height: 1.6;
    position: relative;
}

/* Custom utility classes */
.bg-deep-black { background-color: var(--deep-black); }
.bg-anthracite { background-color: var(--anthracite); }
.bg-accent-pink { background-color: var(--accent-pink); }
.bg-game-green { background-color: var(--game-green); }
.bg-light-neon { background-color: var(--light-neon); }

.text-deep-black { color: var(--deep-black); }
.text-anthracite { color: var(--anthracite); }
.text-off-white { color: var(--off-white); }
.text-accent-pink { color: var(--accent-pink); }
.text-game-green { color: var(--game-green); }
.text-light-neon { color: var(--light-neon); }

.border-accent-pink { border-color: var(--accent-pink); }
.border-game-green { border-color: var(--game-green); }
.border-light-neon { border-color: var(--light-neon); }

/* Card components */
.card {
    background: rgba(28, 28, 32, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(242, 242, 242, 0.1);
    border-radius: 1rem;
    box-shadow: var(--shadow-soft);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-hover);
    border-color: var(--accent-pink);
    transform: translateY(-2px);
}

.card-glass {
    background: rgba(28, 28, 32, 0.6);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(233, 30, 99, 0.2);
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    text-decoration: none;
}

.btn:focus {
    outline: 2px solid var(--accent-pink);
    outline-offset: 2px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-pink) 0%, #C2185B 100%);
    color: white;
    box-shadow: var(--shadow-soft);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--glow-pink);
}

.btn-secondary {
    background: rgba(17, 109, 94, 0.8);
    color: var(--off-white);
    border: 1px solid var(--game-green);
}

.btn-secondary:hover {
    background: var(--game-green);
    box-shadow: var(--glow-neon);
}

.btn-danger {
    background: rgba(220, 38, 38, 0.8);
    color: white;
    border: 1px solid var(--danger-red);
}

.btn-danger:hover {
    background: var(--danger-red);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--off-white);
    border: 1px solid rgba(242, 242, 242, 0.3);
}

.btn-ghost:hover {
    background: rgba(242, 242, 242, 0.1);
    border-color: var(--accent-pink);
}

/* Form inputs */
.input {
    background: rgba(28, 28, 32, 0.8);
    border: 1px solid rgba(242, 242, 242, 0.2);
    border-radius: 0.5rem;
    color: var(--off-white);
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
    min-height: 44px;
}

.input:focus {
    outline: none;
    border-color: var(--accent-pink);
    box-shadow: 0 0 0 3px rgba(233, 30, 99, 0.1);
}

.input::placeholder {
    color: rgba(242, 242, 242, 0.5);
}

/* Participant card specific styles */
.participant-card {
    position: relative;
    overflow: visible; /* Changed to visible to prevent skull cropping */
}

.participant-card.eliminated {
    background: linear-gradient(135deg, rgba(40, 20, 20, 0.8) 0%, rgba(20, 10, 10, 0.8) 100%);
    border: 1px solid rgba(220, 38, 38, 0.3);
    filter: saturate(0.7) brightness(0.8);
    transform: scale(0.98);
    transition: all 0.3s ease;
}

.participant-card.eliminated:hover {
    transform: scale(0.98);
    border-color: rgba(220, 38, 38, 0.5);
    box-shadow: 0 0 20px rgba(220, 38, 38, 0.2);
}

/* Eliminated overlay with skull */
.eliminated-overlay {
    position: absolute;
    top: 5px;
    right: 5px;
    z-index: 10;
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.9) 0%, rgba(153, 27, 27, 0.9) 100%);
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.4);
    animation: pulseRed 3s ease-in-out infinite;
    border: 2px solid rgba(220, 38, 38, 0.8);
}

.skull-icon {
    font-size: 1.25rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
    line-height: 1;
}

@keyframes pulseRed {
    0%, 100% {
        box-shadow: 0 4px 15px rgba(220, 38, 38, 0.4);
    }
    50% {
        box-shadow: 0 4px 25px rgba(220, 38, 38, 0.7);
    }
}

/* Avatar styling for eliminated players */
.avatar-eliminated {
    filter: grayscale(100%) contrast(0.8) brightness(0.7);
    border-color: rgba(220, 38, 38, 0.5) !important;
    position: relative;
}

.avatar-eliminated::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(220, 38, 38, 0.2);
    border-radius: 50%;
    pointer-events: none;
}

.avatar-placeholder.avatar-eliminated {
    background: linear-gradient(135deg, rgba(60, 20, 20, 1) 0%, rgba(40, 15, 15, 1) 100%);
    color: rgba(220, 38, 38, 0.8);
    border-color: rgba(220, 38, 38, 0.5) !important;
}

/* Eliminated player name */
.participant-handle.eliminated {
    text-decoration: line-through;
    text-decoration-color: var(--danger-red);
    text-decoration-thickness: 2px;
    color: rgba(242, 242, 242, 0.6) !important;
    filter: brightness(0.7);
}

/* New eliminated badge */
.eliminated-badge-new {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.8) 0%, rgba(153, 27, 27, 0.8) 100%);
    color: white;
    border: 1px solid rgba(220, 38, 38, 0.6);
    font-size: 0.625rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
    animation: fadeRedGlow 4s ease-in-out infinite;
}

@keyframes fadeRedGlow {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
    }
    50% {
        box-shadow: 0 2px 15px rgba(220, 38, 38, 0.6);
    }
}


/* Old eliminated badge - keeping for compatibility */
.eliminated-badge {
    background: transparent;
    color: var(--accent-pink);
    border: 1px solid var(--accent-pink);
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Avatar styles */
.avatar {
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(242, 242, 242, 0.2);
    transition: all 0.3s ease;
}

.avatar:hover {
    border-color: var(--accent-pink);
    box-shadow: var(--glow-pink);
}

.avatar-placeholder {
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--anthracite) 0%, var(--deep-black) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.5rem;
    color: var(--accent-pink);
    border: 2px solid rgba(242, 242, 242, 0.2);
}

/* Stats display */
.stat-item {
    text-align: center;
    padding: 1rem;
    border-radius: 0.75rem;
    background: rgba(17, 109, 94, 0.1);
    border: 1px solid rgba(17, 109, 94, 0.3);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--light-neon);
    display: block;
}

.stat-label {
    font-size: 0.875rem;
    color: rgba(242, 242, 242, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Filter and sort controls */
.filter-btn {
    padding: 0.5rem 1rem;
    border: 1px solid rgba(242, 242, 242, 0.3);
    background: transparent;
    color: var(--off-white);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 40px;
}

.filter-btn.active {
    background: var(--accent-pink);
    border-color: var(--accent-pink);
    color: white;
}

.filter-btn:hover:not(.active) {
    border-color: var(--accent-pink);
    background: rgba(233, 30, 99, 0.1);
}

/* Loading states */
.loading {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

/* Error states */
.error-message {
    background: rgba(220, 38, 38, 0.1);
    border: 1px solid rgba(220, 38, 38, 0.3);
    color: #FCA5A5;
    padding: 1rem;
    border-radius: 0.5rem;
    text-align: center;
}

/* Success states */
.success-message {
    background: rgba(17, 109, 94, 0.1);
    border: 1px solid rgba(17, 109, 94, 0.3);
    color: var(--game-green);
    padding: 1rem;
    border-radius: 0.5rem;
    text-align: center;
}

/* Admin specific styles */
.admin-sidebar {
    background: rgba(14, 14, 16, 0.9);
    backdrop-filter: blur(10px);
    border-right: 1px solid rgba(242, 242, 242, 0.1);
}

.admin-nav-item {
    display: block;
    padding: 0.75rem 1rem;
    color: rgba(242, 242, 242, 0.8);
    text-decoration: none;
    border-radius: 0.5rem;
    margin: 0.25rem 0;
    transition: all 0.3s ease;
}

.admin-nav-item:hover,
.admin-nav-item.active {
    background: rgba(233, 30, 99, 0.1);
    color: var(--accent-pink);
}

.table {
    width: 100%;
    background: rgba(28, 28, 32, 0.6);
    border-radius: 0.75rem;
    overflow: hidden;
    border: 1px solid rgba(242, 242, 242, 0.1);
}

.table th {
    background: rgba(14, 14, 16, 0.8);
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--off-white);
    border-bottom: 1px solid rgba(242, 242, 242, 0.1);
}

.table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(242, 242, 242, 0.05);
}

.table tr:hover {
    background: rgba(233, 30, 99, 0.05);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    body {
        background: 
            radial-gradient(circle at 30% 40%, rgba(233, 30, 99, 0.2) 0%, transparent 60%),
            radial-gradient(circle at 70% 60%, rgba(17, 109, 94, 0.15) 0%, transparent 60%),
            linear-gradient(135deg, #0E0E10 0%, #1C1C20 50%, #0E0E10 100%);
    }
    
    .participant-card {
        flex-direction: column;
        text-align: center;
    }
    
    .avatar,
    .avatar-placeholder {
        margin: 0 auto 1rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .btn {
        width: 100%;
        margin: 0.25rem 0;
    }
}

/* Animations */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

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

.slide-up {
    animation: slideUp 0.3s ease-out;
}

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

/* Focus indicators for accessibility */
button:focus,
a:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--accent-pink);
    outline-offset: 2px;
}

/* Pagination styles */
.pagination-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid rgba(242, 242, 242, 0.3);
    background: rgba(28, 28, 32, 0.8);
    color: var(--off-white);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    min-height: 40px;
}

.pagination-btn:hover:not(.pagination-btn-disabled) {
    border-color: var(--accent-pink);
    background: rgba(233, 30, 99, 0.1);
    color: var(--accent-pink);
}

.pagination-btn-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid rgba(242, 242, 242, 0.3);
    background: rgba(28, 28, 32, 0.8);
    color: var(--off-white);
    border-radius: 0.5rem;
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 500;
}

.pagination-number:hover:not(.pagination-number-active) {
    border-color: var(--accent-pink);
    background: rgba(233, 30, 99, 0.1);
    color: var(--accent-pink);
}

.pagination-number-active {
    background: var(--accent-pink);
    border-color: var(--accent-pink);
    color: white;
}

.pagination-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    color: rgba(242, 242, 242, 0.5);
}

/* Mobile pagination styles */
.pagination-btn-mobile {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid rgba(242, 242, 242, 0.3);
    background: rgba(28, 28, 32, 0.8);
    color: var(--off-white);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    min-height: 40px;
    font-size: 0.875rem;
    font-weight: 500;
}

.pagination-btn-mobile:hover:not(.pagination-btn-disabled) {
    border-color: var(--accent-pink);
    background: rgba(233, 30, 99, 0.1);
    color: var(--accent-pink);
}

.pagination-number-small {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 1px solid rgba(242, 242, 242, 0.3);
    background: rgba(28, 28, 32, 0.8);
    color: var(--off-white);
    border-radius: 0.375rem;
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.75rem;
}

.pagination-number-small:hover:not(.pagination-number-active) {
    border-color: var(--accent-pink);
    background: rgba(233, 30, 99, 0.1);
    color: var(--accent-pink);
}

.pagination-number-small.pagination-number-active {
    background: var(--accent-pink);
    border-color: var(--accent-pink);
    color: white;
}

/* Desktop pagination improvements */
@media (min-width: 640px) {
    .pagination-number {
        min-width: 2.5rem;
        flex-shrink: 0;
    }
    
    /* Horizontal scroll for many pages */
    .pagination-nav-desktop {
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    
    .pagination-nav-desktop::-webkit-scrollbar {
        display: none;
    }
}


/* Music Control Button */
#music-toggle {
    min-width: 52px;
    min-height: 52px;
    touch-action: manipulation;
    /* Safe positioning for all mobile browsers */
    bottom: max(1.5rem, env(safe-area-inset-bottom, 1.5rem));
    right: max(1.5rem, env(safe-area-inset-right, 1.5rem));
}

#music-toggle:active {
    transform: scale(0.95);
}

/* Mobile optimizations for music button */
@media (max-width: 640px) {
    #music-toggle {
        /* Android-specific positioning */
        bottom: max(1rem, env(safe-area-inset-bottom, 1rem));
        right: max(1rem, env(safe-area-inset-right, 1rem));
        min-width: 48px;
        min-height: 48px;
        padding: 0.75rem;
        /* Ensure it's above Android navigation */
        z-index: 9999;
    }
    
    #music-toggle svg {
        width: 1.25rem;
        height: 1.25rem;
    }
}

/* Android Chrome specific fixes */
@media (max-width: 640px) and (min-height: 500px) {
    #music-toggle {
        /* Additional space for Android gesture navigation */
        bottom: max(1.25rem, calc(env(safe-area-inset-bottom, 0px) + 1rem));
    }
}

/* Very small screens and landscape orientation */
@media (max-width: 375px), (max-height: 500px) and (orientation: landscape) {
    #music-toggle {
        bottom: max(0.75rem, env(safe-area-inset-bottom, 0.75rem));
        right: max(0.75rem, env(safe-area-inset-right, 0.75rem));
        min-width: 44px;
        min-height: 44px;
        padding: 0.625rem;
    }
    
    #music-toggle svg {
        width: 1rem;
        height: 1rem;
    }
}

/* Samsung Internet and other Android browsers */
@media (max-width: 640px) {
    body {
        /* Ensure safe area for full-screen modes */
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    
    #music-toggle {
        /* Avoid overlapping with Android UI elements */
        margin-bottom: env(safe-area-inset-bottom, 0px);
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --deep-black: #000000;
        --off-white: #FFFFFF;
        --accent-pink: #FF1493;
    }
    
    .card {
        border: 2px solid var(--off-white);
    }
    
    #music-toggle {
        border: 2px solid var(--off-white);
    }
}