/* ── Rooms Listing Page ─────────────────────────────────────── */

.rooms-page {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.rooms-page h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--accent-color), #1ed760);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.rooms-page .rooms-subtitle {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 0.95rem;
}

.rooms-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.rooms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}

.room-card {
    background: var(--surface-color);
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.room-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-color), #1ed760);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.room-card:hover {
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

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

.room-card-name {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.room-card-desc {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.room-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.room-card-meta span {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.room-card-members {
    color: var(--accent-color);
    font-weight: 600;
}

.room-card-dj-badge {
    background: rgba(29, 185, 84, 0.15);
    color: var(--accent-color);
    padding: 0.2rem 0.6rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.rooms-empty {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.rooms-empty h2 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

/* ── Create Room Modal ─────────────────────────────────────── */

.create-room-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.create-room-modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.create-room-modal {
    background: #1e1e1e;
    border: 1px solid #333;
    border-radius: 16px;
    padding: 2rem;
    width: 90%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
}

.create-room-modal h2 {
    font-size: 1.4rem;
    margin-bottom: 1.5rem;
}

.create-room-modal label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
    margin-top: 1rem;
}

.create-room-modal label:first-of-type {
    margin-top: 0;
}

.create-room-modal input[type="text"],
.create-room-modal input[type="number"],
.create-room-modal textarea,
.create-room-modal select {
    width: 100%;
    padding: 0.7rem 0.9rem;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.create-room-modal input:focus,
.create-room-modal textarea:focus,
.create-room-modal select:focus {
    outline: none;
    border-color: var(--accent-color);
}

.create-room-modal textarea {
    min-height: 80px;
    resize: vertical;
}

.create-room-modal .btn-row {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    justify-content: flex-end;
}

/* ── Shared Buttons ────────────────────────────────────────── */

.btn-accent {
    background: var(--accent-color);
    color: #000;
    border: none;
    padding: 0.7rem 1.5rem;
    border-radius: 2rem;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-accent:hover {
    background: #1ed760;
    transform: scale(1.02);
}

.btn-secondary {
    background: transparent;
    color: var(--text-color);
    border: 1px solid #444;
    padding: 0.7rem 1.5rem;
    border-radius: 2rem;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: #666;
}

/* ── Room View — 3-Column Layout ───────────────────────────── */

/* When room view is inside main-content, remove parent padding and overflow */
#main-content:has(.room-view) {
    padding: 0;
    overflow: hidden;
}

.room-view {
    display: flex;
    width: 100%;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
}

/* Left: Chat Panel */
.room-chat-panel {
    width: 300px;
    min-width: 260px;
    max-width: 360px;
    background: #161616;
    border-right: 1px solid #2a2a2a;
    display: flex;
    flex-direction: column;
}

.room-chat-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #2a2a2a;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.room-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.chat-msg {
    padding: 0.4rem 0.6rem;
    border-radius: 8px;
    transition: background 0.15s;
    line-height: 1.4;
    word-break: break-word;
}

.chat-msg:hover {
    background: rgba(255, 255, 255, 0.03);
}

.chat-msg-name {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--accent-color);
    margin-right: 0.4rem;
}

.chat-msg-text {
    font-size: 0.85rem;
    color: var(--text-color);
}

.chat-msg-time {
    font-size: 0.7rem;
    color: #555;
    margin-left: 0.4rem;
}

.chat-msg-system {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-style: italic;
    text-align: center;
    padding: 0.3rem;
}

.room-chat-input {
    padding: 0.75rem;
    border-top: 1px solid #2a2a2a;
    display: flex;
    gap: 0.5rem;
}

.room-chat-input input {
    flex: 1;
    padding: 0.6rem 0.9rem;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 2rem;
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.85rem;
}

.room-chat-input input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.room-chat-input button {
    background: var(--accent-color);
    color: #000;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: transform 0.15s;
}

.room-chat-input button:hover {
    transform: scale(1.1);
}

/* Center: Main Area */
.room-main-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: var(--bg-color);
}

.room-main-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(42,42,42,0.5);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(6px);
}

.room-main-header h1 {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0;
    background: none;
    -webkit-text-fill-color: var(--text-color);
}

.room-main-header .room-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    width: 100%;
}

.room-player-section {
    flex: 1;
    position: relative;
    padding: 0;
    background-image: url('/images/room-stage-bg.png');
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
}

.room-player-container {
    position: absolute;
    top: 18%;
    left: 26%;
    width: 47%;
    height: 36%;
}

.room-player-container #youtube-player,
.room-player-container iframe,
.room-player-container #room-yt-player {
    width: 100% !important;
    height: 100% !important;
    border-radius: 4px;
    background: transparent;
    aspect-ratio: unset;
}

.room-now-playing {
    position: absolute;
    top: 57%;
    left: 30%;
    width: 40%;
    padding: 0.5rem 0.75rem;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(6px);
    border-radius: 0 0 8px 8px;
    border: none;
    margin: 0;
}

.room-now-playing h3 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.room-now-playing p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 0;
}



/* ── Audience Avatars ──────────────────────────────────────── */

.room-audience {
    position: absolute;
    bottom: 2%;
    left: 5%;
    right: 5%;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    z-index: 4;
    pointer-events: none;
}

.audience-seat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    pointer-events: auto;
}

.audience-hat {
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-bottom: 10px solid currentColor;
    position: relative;
    top: 4px;
    z-index: 2;
    border-bottom-color: inherit;
}

.audience-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.3);
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

.audience-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.audience-avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
}

.audience-name {
    font-size: 0.6rem;
    color: rgba(255,255,255,0.7);
    text-align: center;
    max-width: 50px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 2px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

/* DJ Section */
.room-dj-section {
    padding: 0 1.5rem 1.5rem;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    position: relative;
    z-index: 1;
}

.room-dj-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(18,18,18,0.75);
    backdrop-filter: blur(6px);
    border-radius: 10px;
    border: 1px solid rgba(42,42,42,0.5);
    margin-bottom: 1rem;
}

.room-dj-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-color);
}

.room-dj-avatar-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-color), #1ed760);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 700;
    color: #000;
    flex-shrink: 0;
}

.room-dj-details {
    flex: 1;
}

.room-dj-label {
    font-size: 0.75rem;
    color: var(--accent-color);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.room-dj-name {
    font-size: 1.1rem;
    font-weight: 600;
}

.room-dj-controls {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.room-dj-controls button {
    padding: 0.5rem 1rem;
    border-radius: 2rem;
    font-size: 0.8rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.room-dj-queue {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 1rem;
}

.room-dj-queue-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
    margin-right: 0.25rem;
}

.dj-queue-chip {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: #2a2a2a;
    padding: 0.3rem 0.7rem;
    border-radius: 2rem;
    font-size: 0.8rem;
}

.dj-queue-chip img {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

/* Right: Playlist Panel */
.room-playlist-panel {
    width: 320px;
    min-width: 280px;
    max-width: 400px;
    background: #161616;
    border-left: 1px solid #2a2a2a;
    display: flex;
    flex-direction: column;
}

.room-playlist-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #2a2a2a;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.room-playlist-items {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.room-playlist-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    cursor: default;
    transition: background 0.15s;
}

.room-playlist-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.room-playlist-item.active {
    background: rgba(29, 185, 84, 0.1);
    border: 1px solid rgba(29, 185, 84, 0.2);
}

.room-playlist-item-index {
    font-size: 0.8rem;
    color: #555;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.room-playlist-item.active .room-playlist-item-index {
    color: var(--accent-color);
}

.room-playlist-item-info {
    flex: 1;
    overflow: hidden;
}

.room-playlist-item-title {
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.room-playlist-item-artist {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.room-playlist-item-remove {
    background: none;
    border: none;
    color: #555;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.2rem;
    border-radius: 4px;
    transition: color 0.15s;
    opacity: 0;
    flex-shrink: 0;
}

.room-playlist-item:hover .room-playlist-item-remove {
    opacity: 1;
}

.room-playlist-item-remove:hover {
    color: #e74c3c;
}

.room-playlist-empty {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* DJ Add Song Area */
.room-dj-add-song {
    padding: 0.75rem;
    border-top: 1px solid #2a2a2a;
}

.room-dj-add-song input {
    width: 100%;
    padding: 0.6rem 0.9rem;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 2rem;
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.85rem;
}

.room-dj-add-song input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.room-dj-search-results {
    max-height: 350px;
    overflow-y: auto;
    margin-top: 0.5rem;
}

.room-dj-search-result {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 0.8rem;
}

.room-dj-search-result:hover {
    background: rgba(29, 185, 84, 0.12);
}

.room-dj-search-result-info {
    flex: 1;
    overflow: hidden;
}

.room-dj-search-result-title {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.room-dj-search-result-artist {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.dj-search-section-label {
    padding: 0.4rem 0.5rem 0.2rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.dj-search-back {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 400;
    text-transform: none;
}
.dj-search-back:hover { color: var(--text-color); }

/* Members sidebar collapsed */
.room-members-count {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ── Responsive ────────────────────────────────────────────── */

@media (max-width: 900px) {
    .room-view {
        flex-direction: column;
    }

    .room-chat-panel {
        width: 100%;
        max-width: none;
        min-width: 0;
        height: 250px;
        border-right: none;
        border-bottom: 1px solid #2a2a2a;
    }

    .room-playlist-panel {
        width: 100%;
        max-width: none;
        min-width: 0;
        height: 300px;
        border-left: none;
        border-top: 1px solid #2a2a2a;
    }

    .rooms-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .rooms-page {
        padding: 1rem;
    }

    .rooms-page h1 {
        font-size: 1.5rem;
    }

    .room-main-header h1 {
        font-size: 1.1rem;
    }
}
