/* ========== COLOR VARIABLES ========== */
:root {
    --bg-darkest: #0a0912;
    --bg-darker: #11101a;
    --bg-dark: #181525;
    --bg-medium: #1f1c2e;
    
    --accent-primary: #c41e3a; /* Crimson red */
    --accent-primary-rgb: 196, 30, 58;
    --accent-secondary: #8b1a2b; /* Darker red */
    --accent-glow: rgba(196, 30, 58, 0.15);
    
    --text-primary: #f0f0f5;
    --text-secondary: #a9a7b7;
    --text-tertiary: #6e6c7e;
    
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-medium: rgba(255, 255, 255, 0.1);
    --border-accent: rgba(196, 30, 58, 0.3);
    
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.25);
    --shadow-strong: 0 8px 25px rgba(0, 0, 0, 0.35);
    --shadow-accent: 0 0 15px rgba(196, 30, 58, 0.2);
}

/* ========== GLOBAL STYLES ========== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

* {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-darkest);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    margin: 0;
    padding: 0;
}

/* ========== MAIN CONTAINERS ========== */
#w2g-lobby-container, #watch2gether-player-container {
    background: linear-gradient(to bottom, var(--bg-darker) 0%, var(--bg-dark) 100%);
    color: var(--text-primary);
    padding: 30px;
    border-radius: 16px;
    border: 1px solid var(--border-subtle);
    max-width: 1400px;
    margin: 40px auto;
    box-shadow: var(--shadow-strong);
    position: relative;
    overflow: hidden;
}

/* Subtle gradient overlay */
#w2g-lobby-container::before, #watch2gether-player-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 150px;
    background: linear-gradient(to bottom, rgba(196, 30, 58, 0.03) 0%, rgba(0, 0, 0, 0) 100%);
    pointer-events: none;
    z-index: 1;
}

/* ========== LOBBY HEADER ========== */
.lobby-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 1px solid var(--border-subtle);
    position: relative;
    z-index: 2;
}

.lobby-header h1 {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}

/* ========== BUTTONS ========== */
.w2g-btn-primary {
    background: linear-gradient(135deg, var(--accent-secondary) 0%, var(--accent-primary) 100%);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.3px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(196, 30, 58, 0.3);
    position: relative;
    overflow: hidden;
}

.w2g-btn-primary::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 0.5s;
}

.w2g-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(196, 30, 58, 0.4);
}

.w2g-btn-primary:hover::before {
    left: 100%;
}

.w2g-btn-primary:active {
    transform: translateY(0);
}

.w2g-btn-secondary {
    background: var(--bg-medium);
    color: var(--text-primary);
    padding: 10px 20px;
    border: 1px solid var(--border-medium);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 13px;
    transition: all 0.3s ease;
}

.w2g-btn-secondary:hover {
    background: var(--bg-dark);
    border-color: var(--border-accent);
    box-shadow: var(--shadow-accent);
}

/* ========== ROOM LIST ========== */
#w2g-room-list {
    background: var(--bg-darkest);
    border-radius: 12px;
    padding: 20px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.2);
}

#w2g-room-list-header {
    display: grid;
    grid-template-columns: 2fr 3fr 1fr 1fr;
    gap: 20px;
    padding: 15px 20px;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-subtle);
}

.room-item {
    display: grid;
    grid-template-columns: 2fr 3fr 1fr 1fr;
    gap: 20px;
    align-items: center;
    padding: 20px;
    background: var(--bg-dark);
    border-radius: 10px;
    margin-bottom: 12px;
    border: 1px solid var(--border-subtle);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.room-item:hover {
    background: var(--bg-medium);
    border-color: var(--border-accent);
    transform: translateX(5px);
    box-shadow: var(--shadow-soft);
}

.room-item:last-child {
    margin-bottom: 0;
}

/* ========== MODAL ========== */
.w2g-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-content {
    background: linear-gradient(to bottom, var(--bg-darker) 0%, var(--bg-dark) 100%);
    margin: 5% auto;
    padding: 30px;
    border: 1px solid var(--border-medium);
    width: 90%;
    max-width: 700px;
    border-radius: 16px;
    position: relative;
    box-shadow: var(--shadow-strong);
}

.close-modal {
    color: var(--text-secondary);
    position: absolute;
    top: 20px;
    right: 25px;
    font-size: 28px;
    font-weight: 300;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close-modal:hover {
    color: var(--accent-primary);
    background: var(--accent-glow);
    transform: rotate(90deg);
}

#anime-search {
    width: 100%;
    padding: 14px 20px;
    margin-bottom: 20px;
    background-color: var(--bg-darkest);
    border: 1px solid var(--border-medium);
    color: var(--text-primary);
    border-radius: 10px;
    font-size: 14px;
    transition: all 0.3s ease;
}

#anime-search:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

#anime-list-container, #episode-list-container {
    max-height: 450px;
    overflow-y: auto;
    padding-right: 10px;
}

.anime-item, .episode-item {
    padding: 16px 20px;
    background: var(--bg-darkest);
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.anime-item:hover, .episode-item:hover {
    background: var(--bg-medium);
    border-color: var(--border-accent);
    transform: translateX(5px);
    box-shadow: var(--shadow-accent);
}

/* ========== PLAYER PAGE ========== */
.player-header {
    margin-bottom: 30px;
    text-align: center;
    position: relative;
    z-index: 2;
}

.player-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 10px 0;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.player-header p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
}

/* ========== VIDEO CONTAINER ========== */
#video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    background-color: #000;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 25px;
    box-shadow: var(--shadow-strong);
}

#w2g-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#w2g-player-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    background-color: rgba(0, 0, 0, 0.7);
    display: none;
    cursor: not-allowed;
    color: var(--text-primary);
    font-size: 16px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

/* ========== PLAYER CONTROLS ========== */
#w2g-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: var(--bg-darkest);
    border-radius: 12px;
    margin-bottom: 25px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.2);
}

#w2g-play-pause-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

#w2g-play-pause-btn.playing {
    background: linear-gradient(135deg, var(--accent-secondary) 0%, var(--accent-primary) 100%);
    box-shadow: 0 4px 15px rgba(196, 30, 58, 0.3);
}

#w2g-play-pause-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

#w2g-play-pause-btn.playing:hover {
    box-shadow: 0 6px 20px rgba(196, 30, 58, 0.4);
}

#w2g-play-pause-btn:disabled {
    background: var(--bg-medium);
    color: var(--text-tertiary);
    cursor: not-allowed;
    box-shadow: none;
}

.time-display {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

#w2g-add-to-queue-btn {
    margin-left: auto;
}

/* ========== MAIN CONTENT LAYOUT ========== */
.w2g-flex-container {
    display: grid;
    grid-template-columns: 280px 1fr 320px;
    gap: 25px;
    align-items: stretch;
}

/* ========== PANEL STYLES ========== */
#w2g-users-container, #w2g-chat-container, #w2g-queue-container {
    background: linear-gradient(to bottom, var(--bg-dark) 0%, var(--bg-darker) 100%);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
}

h3 {
    margin: 0 0 20px 0;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-subtle);
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

h3::before {
    content: '';
    width: 4px;
    height: 20px;
    background: linear-gradient(to bottom, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    border-radius: 2px;
    box-shadow: 0 0 10px var(--accent-glow);
}

/* ========== USER LIST ========== */
#w2g-user-list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

#w2g-user-list li {
    padding: 12px 15px;
    background: var(--bg-darkest);
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

#w2g-user-list li:last-child {
    margin-bottom: 0;
}

#w2g-user-list li:hover {
    background: var(--bg-medium);
    border-color: var(--border-accent);
    transform: translateX(5px);
}

#w2g-user-list li .username {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.user-actions {
    display: flex;
    gap: 8px;
}

.kick-btn, .ban-btn {
    background: transparent;
    border: 1px solid var(--border-medium);
    color: var(--text-secondary);
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.kick-btn:hover {
    background-color: #ffc107;
    border-color: #ffc107;
    color: var(--bg-darkest);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(255, 193, 7, 0.3);
}

.ban-btn:hover {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(196, 30, 58, 0.3);
}

/* ========== CHAT CONTAINER ========== */
#w2g-chat-container {
    height: 400px;
}

#w2g-chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    margin-bottom: 15px;
    padding-right: 10px;
    max-height: 280px;
}

#w2g-chat-messages p {
    margin: 0 0 12px 0;
    padding: 12px 15px;
    background: var(--bg-darkest);
    border-radius: 8px;
    animation: messageSlide 0.3s ease-out;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
}

#w2g-chat-messages p:hover {
    border-left-color: var(--accent-primary);
    background: var(--bg-medium);
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#w2g-chat-messages strong {
    color: var(--accent-primary);
    font-weight: 600;
    margin-right: 8px;
}

#w2g-chat-messages .timestamp {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-left: 8px;
}

#w2g-chat-input-container {
    display: flex;
    gap: 10px;
}

#w2g-chat-input {
    flex-grow: 1;
    background-color: var(--bg-darkest);
    border: 1px solid var(--border-medium);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
}

#w2g-chat-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

#w2g-chat-send {
    background: linear-gradient(135deg, var(--accent-secondary) 0%, var(--accent-primary) 100%);
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(196, 30, 58, 0.3);
}

#w2g-chat-send:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(196, 30, 58, 0.4);
}

/* ========== QUEUE CONTAINER ========== */
#w2g-queue-container {
    height: 400px;
}

#w2g-queue-list {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    flex-grow: 1;
    max-height: 320px;
}

#w2g-queue-list li {
    padding: 14px 16px;
    background: var(--bg-darkest);
    border-radius: 8px;
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-size: 14px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

#w2g-queue-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--bg-medium);
    transition: all 0.3s ease;
}

#w2g-queue-list li:hover {
    background: var(--bg-medium);
    border-color: var(--border-accent);
    transform: translateX(5px);
}

#w2g-queue-list li:hover::before {
    width: 5px;
    background: var(--accent-primary);
}

/* First item in queue (up next) */
#w2g-queue-list li:first-child {
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-medium) 100%);
    border-color: var(--border-accent);
    color: var(--text-primary);
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(196, 30, 58, 0.1);
}

#w2g-queue-list li:first-child::before {
    width: 4px;
    background: linear-gradient(to bottom, var(--accent-primary) 0%, var(--accent-secondary) 100%);
}

#w2g-queue-list li:first-child::after {
    content: 'UP NEXT';
    position: absolute;
    top: 5px;
    right: 10px;
    font-size: 10px;
    font-weight: 700;
    color: var(--accent-primary);
    letter-spacing: 0.5px;
}

#w2g-queue-list li:last-child {
    margin-bottom: 0;
}

/* Empty queue message */
#w2g-queue-list li.no-queue {
    background: transparent;
    color: var(--text-tertiary);
    font-style: italic;
    text-align: center;
    padding: 40px 20px;
    border: 2px dashed var(--border-subtle);
}

#w2g-queue-list li.no-queue:hover {
    background: transparent;
    transform: none;
    border-color: var(--border-subtle);
}

/* ========== LOADING & ERROR STATES ========== */
.no-rooms, .loading-rooms, .w2g-loading, .w2g-error {
    text-align: center;
    padding: 60px 40px;
    color: var(--text-tertiary);
    font-size: 14px;
}

.w2g-loading::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-medium);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.w2g-error {
    color: var(--accent-primary);
    background: var(--accent-glow);
    border-radius: 8px;
    border: 1px solid var(--border-accent);
}

/* ========== SCROLLBAR STYLING ========== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-darkest);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: var(--bg-medium);
    border-radius: 5px;
    border: 2px solid var(--bg-darkest);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* ========== ANIMATIONS ========== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== RESPONSIVE DESIGN ========== */
@media (max-width: 1200px) {
    .w2g-flex-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    #w2g-users-container, #w2g-queue-container {
        display: none;
    }
    
    #w2g-chat-container {
        height: 300px;
    }
}

@media (max-width: 768px) {
    #w2g-lobby-container, #watch2gether-player-container {
        padding: 20px;
        margin: 20px 10px;
    }
    
    .lobby-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    #w2g-room-list-header, .room-item {
        grid-template-columns: 1fr;
        gap: 10px;
        text-align: center;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 20px;
    }
}

/* ========== HOVER EFFECTS ========== */
.w2g-btn-primary, .w2g-btn-secondary, .kick-btn, .ban-btn, #w2g-chat-send {
    position: relative;
    overflow: hidden;
}

.w2g-btn-primary::after, .w2g-btn-secondary::after, .kick-btn::after, .ban-btn::after, #w2g-chat-send::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.w2g-btn-primary:active::after, .w2g-btn-secondary:active::after, .kick-btn:active::after, .ban-btn:active::after, #w2g-chat-send:active::after {
    width: 300px;
    height: 300px;
}

/* ========== FOCUS STATES ========== */
button:focus, input:focus, textarea:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ========== UTILITY CLASSES ========== */
.hidden {
    display: none !important;
}

.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.text-center {
    text-align: center;
}

/* ========== SCROLLBAR STYLING ========== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-darkest);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: var(--bg-medium);
    border-radius: 5px;
    border: 2px solid var(--bg-darkest);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* Specific styles for the empty queue state */
#w2g-queue-list.no-queue::-webkit-scrollbar-thumb {
    background: var(--text-tertiary); /* Change to a more neutral color */
}

#w2g-queue-list.no-queue::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary); /* Keep hover effect for visibility */
}



.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}


/* ========== MODERN SCROLLBAR STYLING ========== */

/* Base scrollbar styles */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
    margin: 5px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    border: none;
    transition: all 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Active scrolling state */
::-webkit-scrollbar-thumb:active {
    background: rgba(196, 30, 58, 0.3);
}

/* Corner where scrollbars meet */
::-webkit-scrollbar-corner {
    background: transparent;
}

/* Specific container scrollbar styles */
#w2g-chat-messages::-webkit-scrollbar-track,
#w2g-queue-list::-webkit-scrollbar-track,
#anime-list-container::-webkit-scrollbar-track,
#episode-list-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
}

#w2g-chat-messages::-webkit-scrollbar-thumb,
#w2g-queue-list::-webkit-scrollbar-thumb,
#anime-list-container::-webkit-scrollbar-thumb,
#episode-list-container::-webkit-scrollbar-thumb {
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0.05) 100%
    );
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

#w2g-chat-messages::-webkit-scrollbar-thumb:hover,
#w2g-queue-list::-webkit-scrollbar-thumb:hover,
#anime-list-container::-webkit-scrollbar-thumb:hover,
#episode-list-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(
        to bottom,
        rgba(196, 30, 58, 0.2) 0%,
        rgba(196, 30, 58, 0.1) 100%
    );
    box-shadow: inset 0 0 0 1px rgba(196, 30, 58, 0.2);
}

/* Firefox scrollbar support */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
}

/* Hover state for Firefox */
*:hover {
    scrollbar-color: rgba(255, 255, 255, 0.15) rgba(255, 255, 255, 0.02);
}

/* Hide scrollbar until hover on container */
.scrollbar-hidden {
    scrollbar-width: none;
}

.scrollbar-hidden::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.scrollbar-hidden:hover {
    scrollbar-width: thin;
}

.scrollbar-hidden:hover::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

/* Smooth scrollbar appearance animation */
@keyframes scrollbarFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Apply smooth scroll behavior */
#w2g-chat-messages,
#w2g-queue-list,
#anime-list-container,
#episode-list-container,
.comments-list-horizontal {
    scroll-behavior: smooth;
    position: relative;
}

/* Custom overlay scrollbar indicator */
.scroll-indicator {
    position: absolute;
    right: 2px;
    top: 2px;
    bottom: 2px;
    width: 4px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.scroll-indicator::after {
    content: '';
    position: absolute;
    right: 0;
    width: 4px;
    height: 50px;
    background: linear-gradient(
        to bottom,
        var(--accent-primary) 0%,
        transparent 100%
    );
    border-radius: 2px;
    opacity: 0.5;
    animation: scrollIndicatorPulse 2s ease-in-out infinite;
}

@keyframes scrollIndicatorPulse {
    0%, 100% {
        transform: translateY(0);
        opacity: 0.3;
    }
    50% {
        transform: translateY(10px);
        opacity: 0.6;
    }
}

/* Show indicator on hover */
*:hover > .scroll-indicator {
    opacity: 1;
}

/* Special styling for empty queue scrollbar */
#w2g-queue-list:empty::-webkit-scrollbar,
#w2g-queue-list:has(.no-queue)::-webkit-scrollbar {
    display: none;
}

/* Minimal scrollbar for room list */
.comments-list-horizontal::-webkit-scrollbar {
    height: 4px;
}

.comments-list-horizontal::-webkit-scrollbar-track {
    background: transparent;
    margin: 0 20px;
}

.comments-list-horizontal::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
}

.comments-list-horizontal::-webkit-scrollbar-thumb:hover {
    background: rgba(196, 30, 58, 0.2);
}

/* macOS-style scrollbar bounce effect */
@supports (overflow: overlay) {
    #w2g-chat-messages,
    #w2g-queue-list,
    #anime-list-container,
    #episode-list-container {
        overflow: overlay;
    }
}

/* Custom scrollbar for different themes/states */
.dark-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.3);
}

.dark-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.5);
}

.light-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
}

.light-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}
