@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&family=Outfit:wght@400;700&display=swap');

:root {
    --bg-dark: #0f172a;
    --primary: #10b981;
    --primary-hover: #059669;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --surface: rgba(30, 41, 59, 0.7);
    --border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
}

body {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.7)),
                url('https://www.minecraft.net/content/dam/games/minecraft/key-art/CavesAndCliffs_KeyArt_1920x1080.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
}

.view {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    flex: 1;
}

/* Join/chat view centers its card vertically */
#view-join {
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.navbar {
    width: 100%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 15px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    margin-bottom: 40px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 15px;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: -0.5px;
}

.nav-logo {
    width: 30px;
    height: auto;
}

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
    padding: 8px 12px;
    border-radius: 8px;
}

.nav-links a:hover, .nav-links a.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.container {
    background: var(--surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 40px;
    width: 420px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transform: translateY(20px);
    opacity: 0;
}

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

.logo {
    max-width: 140px;
    height: auto;
    margin-bottom: 20px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
    animation: float 4s ease-in-out infinite;
}

.logo-small {
    max-width: 80px;
    height: auto;
    margin-bottom: 15px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
    100% { transform: translateY(0px); }
}

h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 30px;
    background: linear-gradient(to right, #10b981, #3b82f6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

h2 {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 30px;
    margin-bottom: 15px;
}

.form-group {
    margin-bottom: 20px;
}

input {
    width: 100%;
    padding: 16px 20px;
    background: rgba(15, 23, 42, 0.6);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

input::placeholder {
    color: var(--text-secondary);
}

button {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 16px 20px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.2);
}

button:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.3);
}

button:active {
    transform: translateY(0);
}

.hidden {
    display: none !important;
}

.controls {
    margin: 20px 0;
    display: flex;
    gap: 15px;
}

#mute-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border);
    color: var(--text-primary);
    box-shadow: none;
}

#mute-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

#leave-btn {
    background: var(--danger);
    box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.2);
}

#leave-btn:hover {
    background: var(--danger-hover);
    box-shadow: 0 10px 15px -3px rgba(239, 68, 68, 0.3);
}

#players-list {
    list-style-type: none;
    padding: 0;
    text-align: left;
    background: rgba(15, 23, 42, 0.4);
    border-radius: 12px;
    border: 1px solid var(--border);
    max-height: 200px;
    overflow-y: auto;
}

#players-list li {
    padding: 10px 16px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
}

#players-list li:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(4px);
}

.player-avatar {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    border: 2px solid var(--border);
    flex-shrink: 0;
    image-rendering: pixelated; /* keeps MC pixel art sharp */
    transition: border-color 0.15s, box-shadow 0.15s;
}

.is-speaking .player-avatar {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
}

.player-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.speaking-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--primary);
    opacity: 0.2;
    transition: all 0.1s;
}

.is-speaking {
    border-color: rgba(16, 185, 129, 0.5) !important;
    background: rgba(16, 185, 129, 0.1) !important;
}

.is-speaking .speaking-indicator {
    opacity: 1;
    box-shadow: 0 0 12px var(--primary);
    transform: scale(1.2);
}

.volume-slider {
    width: 60px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    margin-left: 10px;
    padding: 0;
    border: none;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text-primary);
    cursor: pointer;
    transition: transform 0.1s;
}

.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: var(--primary);
}

/* Rooms Page */
.page-content {
    width: 100%;
    max-width: 860px;
    padding: 0 30px 60px;
    box-sizing: border-box;
}

.page-header {
    margin-bottom: 30px;
}

.page-header h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    margin: 0 0 8px;
}

.subtitle {
    color: var(--text-secondary);
    margin: 0 0 20px;
    font-size: 0.95rem;
}

.btn-secondary {
    width: auto;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 10px 20px;
    font-size: 0.9rem;
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: none;
    box-shadow: none;
}

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

.room-card {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 22px;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all 0.3s ease;
}

.room-card:hover {
    background: rgba(30, 41, 59, 0.85);
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 10px 30px -5px rgba(16, 185, 129, 0.2);
}

.room-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.room-icon {
    font-size: 1.5rem;
}

.room-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-open {
    background: rgba(16, 185, 129, 0.15);
    color: var(--primary);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-locked {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.room-name {
    font-size: 1.15rem;
    font-weight: 700;
    word-break: break-word;
}

.room-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: auto;
}

.join-hint {
    color: var(--primary);
    font-weight: 600;
}

.loading-spinner, .empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    font-size: 1rem;
}

.empty-icon {
    display: block;
    font-size: 3rem;
    margin-bottom: 10px;
}

.empty-cta {
    display: inline-block;
    margin-top: 15px;
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

/* Settings Page */
.settings-card {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 30px;
    margin-bottom: 20px;
    text-align: left;
}

.settings-card h2 {
    margin: 0 0 6px;
    font-size: 1.1rem;
}

.setting-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0 0 20px;
}

.settings-card label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

select {
    width: 100%;
    padding: 14px 18px;
    background: rgba(15, 23, 42, 0.6);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    box-sizing: border-box;
    transition: all 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

select option {
    background: #0f172a;
}

.perm-warning {
    margin-top: 12px;
    padding: 12px 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 10px;
    color: var(--danger);
    font-size: 0.9rem;
}

.status-msg {
    margin-top: 12px;
    color: var(--primary);
    font-weight: 600;
    font-size: 1rem;
}

.hidden {
    display: none !important;
}

#players-list li:last-child {
    border-bottom: none;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* =====================================================
   INVITE LINK ROW
   ===================================================== */
.invite-row {
    display: flex;
    gap: 10px;
    margin: 12px 0 6px;
    align-items: center;
}

.invite-row input {
    flex: 1;
    font-size: 0.78rem;
    padding: 10px 14px;
    color: var(--text-secondary);
    cursor: text;
}

.invite-row button {
    width: auto;
    flex-shrink: 0;
    padding: 10px 14px;
    font-size: 0.82rem;
    border-radius: 10px;
    background: rgba(255,255,255,0.1);
    border: 1px solid var(--border);
    color: var(--text-primary);
    box-shadow: none;
}

.invite-row button:hover {
    background: rgba(255,255,255,0.18);
    transform: none;
    box-shadow: none;
}

/* =====================================================
   RULES PAGE
   ===================================================== */
.rules-card {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 28px 32px;
    margin-bottom: 20px;
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
}

.rules-card:nth-child(2) { animation-delay: 0.05s; }
.rules-card:nth-child(3) { animation-delay: 0.1s; }
.rules-card:nth-child(4) { animation-delay: 0.15s; }

.rules-card h2 {
    margin: 0 0 20px;
    font-size: 1.15rem;
    font-weight: 700;
}

/* Server Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.info-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.info-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.info-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.selectable {
    user-select: all;
    cursor: text;
}

.info-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
}

.info-link:hover {
    text-decoration: underline;
}

/* Steps List */
.steps-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.steps-list li {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: #000;
    font-weight: 800;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Rules List */
.rules-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rules-list li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 0.95rem;
    line-height: 1.5;
    padding: 10px 14px;
    background: rgba(255,255,255,0.03);
    border-radius: 10px;
    border: 1px solid var(--border);
}

.rule-icon {
    font-size: 1rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.rules-footer {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 10px;
}

/* =====================================================
   DISCORD LOGIN
   ===================================================== */
#discord-login-section {
    text-align: center;
    margin: 20px 0;
}

.discord-btn {
    display: inline-block;
    background-color: #5865F2; /* Blurple */
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.2s, transform 0.2s;
    box-shadow: 0 4px 6px -1px rgba(88, 101, 242, 0.4);
}

.discord-btn:hover {
    background-color: #4752C4;
    transform: translateY(-2px);
    box-shadow: 0 8px 12px -2px rgba(88, 101, 242, 0.5);
}

.whitelist-note {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 10px;
}

#discord-profile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

#profile-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

#profile-username {
    font-weight: 600;
    font-size: 1.05rem;
}

.logout-link {
    color: var(--danger);
    font-size: 0.85rem;
    text-decoration: none;
    font-weight: 600;
}

.logout-link:hover {
    text-decoration: underline;
}

/* =====================================================
   MOBILE RESPONSIVE
   ===================================================== */
@media (max-width: 600px) {

    .navbar {
        padding: 12px 16px;
        flex-direction: column;
        gap: 12px;
    }

    .nav-links {
        gap: 4px;
        width: 100%;
        justify-content: center;
    }

    .nav-links a {
        font-size: 0.8rem;
        padding: 6px 10px;
    }

    .container {
        width: 100%;
        max-width: 100%;
        border-radius: 16px;
        padding: 24px 18px;
        box-sizing: border-box;
    }

    #view-join {
        padding: 12px;
    }

    h1 {
        font-size: 1.6rem;
    }

    .controls {
        flex-direction: column;
        gap: 10px;
    }

    .invite-row {
        flex-direction: column;
    }

    .invite-row button {
        width: 100%;
    }

    .page-content {
        padding: 0 16px 40px;
    }

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

    .settings-card {
        padding: 20px 16px;
    }

    #players-list li {
        flex-wrap: wrap;
        gap: 8px;
    }

    .volume-slider {
        width: 100%;
        margin-left: 0;
        margin-top: 4px;
    }
}
