/**
 * DeSo.Club — Styles
 */
:root {
    --dc-primary: #6366f1;
    --dc-primary-hover: #4f46e5;
    --dc-bg: #0f0f14;
    --dc-bg-card: #1a1a24;
    --dc-border: #2a2a3a;
    --dc-text: #e2e2e8;
    --dc-text-muted: #8b8b9e;
}

* {
    box-sizing: border-box;
}

body.desoclub-body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--dc-bg);
    color: var(--dc-text);
    min-height: 100vh;
}

.desoclub-app {
    max-width: 900px;
    margin: 0 auto;
    padding: 1rem;
}

.desoclub-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid var(--dc-border);
}

.desoclub-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.desoclub-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--dc-text);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.25rem;
}

.desoclub-logo:hover {
    color: var(--dc-primary);
}

.desoclub-logo i {
    color: var(--dc-primary);
}

.desoclub-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.desoclub-logged-in-nav {
    display: flex;
    align-items: center;
}

/* Avatar | Create Room | username | logout */
.desoclub-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.btn-create-room {
    flex-shrink: 0;
    white-space: nowrap;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.user-name {
    font-size: 0.9rem;
    color: var(--dc-text-muted);
}

.btn-primary, .btn-secondary, .btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    text-decoration: none;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-primary {
    background: var(--dc-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--dc-primary-hover);
}

.btn-secondary {
    background: var(--dc-bg-card);
    color: var(--dc-text);
    border: 1px solid var(--dc-border);
}

.btn-secondary:hover {
    background: var(--dc-border);
}

.btn-icon {
    background: transparent;
    color: var(--dc-text-muted);
    padding: 0.4rem;
}

.btn-icon:hover {
    color: var(--dc-text);
}

.btn-large {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.85rem;
}

/* Hero */
.desoclub-hero {
    text-align: center;
    padding: 2.5rem 1rem;
}

.desoclub-hero h1 {
    font-size: 2rem;
    margin: 0 0 0.5rem 0;
}

.desoclub-hero p {
    color: var(--dc-text-muted);
    margin: 0;
}

/* Rooms section */
.desoclub-rooms-section {
    margin-top: 2rem;
}

.desoclub-rooms-section h2 {
    font-size: 1.25rem;
    margin: 0 0 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rooms-list {
    display: grid;
    gap: 1rem;
}

.rooms-list.desoclub-loading {
    text-align: center;
    padding: 2rem;
    color: var(--dc-text-muted);
}

.rooms-list .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--dc-border);
    border-top-color: var(--dc-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.rooms-empty, .rooms-error {
    text-align: center;
    padding: 2rem;
    color: var(--dc-text-muted);
}

.room-card {
    background: var(--dc-bg-card);
    border: 1px solid var(--dc-border);
    border-radius: 12px;
    padding: 1.25rem;
}

.room-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.room-type-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
}

.room-type-audio {
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
}

.room-type-video {
    background: rgba(34, 197, 94, 0.2);
    color: #86efac;
}

.room-name {
    margin: 0;
    font-size: 1.1rem;
}

.room-card-creator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--dc-text-muted);
}

.room-card-creator .creator-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.room-card-actions a {
    text-decoration: none;
}

/* Create page */
.desoclub-create-section {
    max-width: 480px;
    margin: 2rem auto;
}

.desoclub-create-section h1 {
    margin: 0 0 0.5rem 0;
}

.create-hint {
    color: var(--dc-text-muted);
    margin-bottom: 1.5rem;
}

.create-room-form .form-group {
    margin-bottom: 1.25rem;
}

.create-room-form label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

.create-room-form input[type="text"] {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--dc-border);
    border-radius: 8px;
    background: var(--dc-bg-card);
    color: var(--dc-text);
    font-size: 1rem;
}

.room-type-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.room-type-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.create-room-form input[type="color"] {
    width: 60px;
    height: 36px;
    padding: 2px;
    border: 1px solid var(--dc-border);
    border-radius: 6px;
    cursor: pointer;
}

.form-actions {
    margin-top: 1.5rem;
}

/* Room page */
.desoclub-header-room {
    flex-wrap: wrap;
    gap: 1rem;
}

.room-title {
    font-size: 1.1rem;
    margin: 0;
}

.desoclub-room-main {
    padding: 2rem 0;
}

.room-lobby, .room-info {
    text-align: center;
    padding: 1rem;
}

.room-detail h3 {
    margin: 0.5rem 0 1rem 0;
}

.room-creator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--dc-text-muted);
    margin-bottom: 1rem;
}

.room-join-hint {
    color: var(--dc-text-muted);
    font-size: 0.9rem;
}

.btn-delete-room {
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.45);
}

.btn-delete-room:hover {
    background: rgba(248, 113, 113, 0.12);
    color: #fca5a5;
    border-color: #f87171;
}

.live-placeholder, .livekit-placeholder {
    text-align: center;
    padding: 2rem;
    color: var(--dc-text-muted);
}

.live-placeholder i {
    font-size: 3rem;
    color: var(--dc-primary);
    margin-bottom: 1rem;
}

/* LiveKit session */
.desoclub-app.desoclub-live-active {
    max-width: min(1100px, 100%);
}

.room-live {
    width: 100%;
    margin-top: 1rem;
}

.live-session {
    background: var(--dc-bg-card);
    border: 1px solid var(--dc-border);
    border-radius: 12px;
    padding: 1rem;
    min-height: 280px;
}

.live-participants {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
    min-height: 180px;
    align-content: start;
}

.live-tile {
    background: #12121a;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--dc-border);
}

.live-tile-local {
    outline: 2px solid var(--dc-primary);
    outline-offset: 2px;
}

.live-tile-media {
    aspect-ratio: 4 / 3;
    background: #0a0a0f;
    display: flex;
    align-items: center;
    justify-content: center;
}

.live-tile-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.live-tile-media audio {
    width: 90%;
}

.live-tile-name {
    display: block;
    padding: 0.35rem 0.5rem;
    font-size: 0.75rem;
    color: var(--dc-text-muted);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.live-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.live-tb-btn.is-off {
    opacity: 0.45;
    color: #f87171;
}

.live-status {
    text-align: center;
    font-size: 0.85rem;
    color: var(--dc-text-muted);
    margin: 0.75rem 0 0 0;
    min-height: 1.25em;
}

/* Login standalone */
.desoclub-login-standalone {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.login-content {
    text-align: center;
    padding: 2rem;
}

.login-back {
    position: absolute;
    top: 1rem;
    left: 1rem;
    color: var(--dc-text-muted);
    text-decoration: none;
}

.login-content h1 {
    margin: 0 0 0.5rem 0;
}

.login-content p {
    color: var(--dc-text-muted);
    margin-bottom: 1.5rem;
}

.desoclub-success-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.success-content {
    text-align: center;
}

.success-icon {
    font-size: 4rem;
    color: #22c55e;
    margin-bottom: 1rem;
}

/* Loading overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay .spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--dc-border);
    border-top-color: var(--dc-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-overlay p {
    margin-top: 1rem;
    color: var(--dc-text-muted);
}

/* Toast */
#toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background: var(--dc-bg-card);
    border: 1px solid var(--dc-border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.toast-success {
    border-color: #22c55e;
}

.toast-error {
    border-color: #ef4444;
}
