/**
 * SyncStream Lite - Main Stylesheet
 * Glassmorphism design with gradient overlays
 */

/* ===== CSS Variables ===== */
:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --secondary-color: #64748b;
    --danger-color: #ef4444;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    
    --bg-gradient-start: #0f0c29;
    --bg-gradient-mid: #302b63;
    --bg-gradient-end: #24243e;
    
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    
    --border-radius: 16px;
    --border-radius-sm: 8px;
    --transition: all 0.3s ease;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-mid), var(--bg-gradient-end));
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-hover);
}

/* ===== Glass Card ===== */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    box-shadow: var(--glass-shadow);
    padding: 2rem;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--glass-bg);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-full {
    width: 100%;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== Form Elements ===== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===== Messages ===== */
.error-message {
    color: var(--danger-color);
    background: rgba(239, 68, 68, 0.1);
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius-sm);
    margin-bottom: 1rem;
}

.success-message {
    color: var(--success-color);
    background: rgba(34, 197, 94, 0.1);
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius-sm);
    margin-bottom: 1rem;
}

.hidden {
    display: none !important;
}

/* ===== Header ===== */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.logo .lite {
    color: var(--primary-color);
}

.logo a {
    color: inherit;
    text-decoration: none;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-link {
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--glass-bg);
}

.user-greeting {
    color: var(--text-secondary);
}


/* ===== Auth Section ===== */
.auth-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 80px);
    padding: 2rem;
}

.auth-card {
    width: 100%;
    max-width: 400px;
}

.auth-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.tab-btn {
    flex: 1;
    padding: 0.75rem;
    background: transparent;
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.tab-btn:hover:not(.active) {
    background: var(--glass-bg);
}

/* ===== Lobby Section ===== */
.lobby-section {
    padding: 2rem;
}

.lobby-content {
    max-width: 800px;
    margin: 0 auto;
}

.lobby-intro {
    text-align: center;
    margin-bottom: 2rem;
}

.lobby-intro h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.lobby-intro p {
    color: var(--text-secondary);
}

/* ===== Tag Cloud ===== */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    padding: 2rem;
}

.tag-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}

.tag-btn:hover {
    background: rgba(99, 102, 241, 0.3);
    border-color: var(--primary-color);
    transform: translateY(-4px);
}

.tag-btn.size-sm {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
}

.tag-btn.size-md {
    padding: 1rem 1.5rem;
    font-size: 1rem;
}

.tag-btn.size-lg {
    padding: 1.25rem 2rem;
    font-size: 1.125rem;
}

.tag-name {
    font-weight: 600;
}

.tag-count {
    font-size: 0.75em;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* ===== Matchmaking Status ===== */
.matchmaking-status {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100;
}

.status-card {
    text-align: center;
    max-width: 400px;
}

.status-content {
    margin-bottom: 1.5rem;
}

.status-content h3 {
    margin: 1rem 0 0.5rem;
}

.waiting-count {
    color: var(--text-secondary);
}

.status-timer {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-top: 1rem;
}

.status-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* ===== Spinner ===== */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-spinner {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

/* ===== Room Page ===== */
.room-container {
    display: grid;
    grid-template-columns: 1fr 350px;
    height: 100vh;
}

@media (max-width: 900px) {
    .room-container {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
    }
}

/* ===== Video Section ===== */
.video-section {
    display: flex;
    flex-direction: column;
    background: #000;
    position: relative;
}

.participants-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
}

.participants-list {
    display: flex;
    gap: 0.5rem;
}

.participant-avatar {
    position: relative;
    width: 40px;
    height: 40px;
}

.participant-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--glass-border);
}

.participant-avatar.disconnected img {
    opacity: 0.5;
}

.participant-avatar.host img {
    border-color: var(--warning-color);
}

.participant-avatar.self img {
    border-color: var(--primary-color);
}

.host-badge {
    position: absolute;
    bottom: -4px;
    right: -4px;
    font-size: 0.75rem;
}

.room-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.room-mode {
    padding: 0.25rem 0.75rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    background: var(--glass-bg);
}

.room-mode.dj-mode {
    background: rgba(245, 158, 11, 0.3);
    color: var(--warning-color);
}

/* ===== Video Player ===== */
.video-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.video-gradient-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.3) 0%,
        transparent 20%,
        transparent 80%,
        rgba(0, 0, 0, 0.5) 100%
    );
    pointer-events: none;
    z-index: 1;
}

#video-player {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.video-info-overlay {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    z-index: 2;
}

.video-info-overlay h3 {
    font-size: 1.25rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}


/* ===== Reaction Container ===== */
.reaction-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 10;
}

.floating-reaction {
    position: absolute;
    bottom: 20%;
    font-size: 2.5rem;
    opacity: 0;
    transform: translateY(0);
    transition: none;
}

.floating-reaction.animating {
    animation: floatUp 2s ease-out forwards;
}

@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    50% {
        opacity: 1;
        transform: translateY(-100px) scale(1.2) translateX(var(--drift, 0));
    }
    100% {
        opacity: 0;
        transform: translateY(-200px) scale(0.8) translateX(var(--drift, 0));
    }
}

.skip-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.5);
    z-index: 20;
}

.skip-overlay span {
    font-size: 3rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}

.skip-overlay.fade-out {
    animation: fadeOut 0.5s ease-out forwards;
}

@keyframes fadeOut {
    to { opacity: 0; }
}

/* ===== Sentiment Section ===== */
.sentiment-section {
    padding: 0.75rem 1rem;
    background: var(--glass-bg);
}

.sentiment-meter {
    max-width: 400px;
    margin: 0 auto;
}

.sentiment-bar {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
}

.fire-bar {
    background: linear-gradient(90deg, #f97316, #ef4444);
    transition: width 0.3s ease;
}

.trash-bar {
    background: linear-gradient(90deg, #64748b, #475569);
    transition: width 0.3s ease;
}

.sentiment-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.875rem;
}

.fire-label {
    color: #f97316;
}

.trash-label {
    color: var(--text-secondary);
}

/* ===== Reaction Buttons ===== */
.reaction-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--glass-bg);
}

.reaction-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 2px solid var(--glass-border);
    background: var(--glass-bg);
    font-size: 1.75rem;
    cursor: pointer;
    transition: var(--transition);
}

.reaction-btn:hover {
    transform: scale(1.1);
}

.reaction-btn:active {
    transform: scale(0.95);
}

.reaction-btn.fire-btn:hover {
    border-color: #f97316;
    background: rgba(249, 115, 22, 0.2);
}

.reaction-btn.heart-btn:hover {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.2);
}

.reaction-btn.trash-btn:hover {
    border-color: var(--secondary-color);
    background: rgba(100, 116, 139, 0.2);
}

.reaction-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ===== Chat Section ===== */
.chat-section {
    display: flex;
    flex-direction: column;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border-left: 1px solid var(--glass-border);
}

.chat-header {
    padding: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.chat-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.chat-message {
    display: flex;
    gap: 0.75rem;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.fading {
    animation: fadeOut 1s ease-out forwards;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.message-content {
    flex: 1;
    min-width: 0;
}

.message-header {
    display: flex;
    gap: 0.5rem;
    align-items: baseline;
    margin-bottom: 0.25rem;
}

.message-handle {
    font-weight: 600;
    font-size: 0.875rem;
}

.message-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.message-text {
    font-size: 0.9375rem;
    word-wrap: break-word;
}

/* ===== Chat Form ===== */
.chat-form {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    border-top: 1px solid var(--glass-border);
}

.chat-form input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.chat-form input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.chat-form .btn {
    padding: 0.75rem 1rem;
}


/* ===== Profile Page ===== */
.profile-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

@media (max-width: 900px) {
    .profile-content {
        grid-template-columns: 1fr;
    }
}

.profile-section {
    grid-column: 1;
}

.videos-section {
    grid-column: 2;
    grid-row: 1 / 3;
}

.friends-section {
    grid-column: 1;
}

@media (max-width: 900px) {
    .profile-section,
    .videos-section,
    .friends-section {
        grid-column: 1;
        grid-row: auto;
    }
}

/* ===== Profile Card ===== */
.profile-card h2 {
    margin-bottom: 1.5rem;
}

.profile-avatar-section {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.avatar-preview {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--primary-color);
}

.avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.char-count {
    font-weight: normal;
    color: var(--text-muted);
}

/* ===== Section Header ===== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    margin: 0;
}

/* ===== Upload Form ===== */
.upload-form-container {
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--border-radius-sm);
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.upload-progress {
    margin-bottom: 1rem;
}

.progress-bar {
    height: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    width: 0%;
    animation: progressPulse 1.5s ease-in-out infinite;
}

@keyframes progressPulse {
    0%, 100% { width: 30%; }
    50% { width: 70%; }
}

.progress-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ===== Videos List ===== */
.videos-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.video-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--border-radius-sm);
}

.video-thumbnail {
    width: 120px;
    height: 80px;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.3);
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.no-thumbnail {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.video-info {
    flex: 1;
    min-width: 0;
}

.video-info h4 {
    margin-bottom: 0.25rem;
    font-size: 1rem;
}

.video-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-status {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-pending {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning-color);
}

.status-approved {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success-color);
}

.status-rejected {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger-color);
}

.rejection-reason {
    font-size: 0.75rem;
    color: var(--danger-color);
    margin-top: 0.25rem;
}

.video-actions {
    display: flex;
    align-items: flex-start;
}

/* ===== Friends Section ===== */
.pending-requests {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.pending-requests h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 1rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    background: var(--primary-color);
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

.pending-list,
.friends-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.pending-item,
.friend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--border-radius-sm);
}

.pending-avatar,
.friend-avatar {
    position: relative;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.pending-avatar img,
.friend-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.friend-avatar .status-indicator {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--bg-gradient-mid);
    background: var(--secondary-color);
}

.friend-avatar.online .status-indicator {
    background: var(--success-color);
}

.pending-info,
.friend-info {
    flex: 1;
    min-width: 0;
}

.pending-handle,
.friend-handle {
    display: block;
    font-weight: 600;
}

.pending-vibe,
.friend-vibe {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.pending-actions,
.friend-actions {
    display: flex;
    gap: 0.5rem;
}

.empty-message {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
}

/* ===== Default Avatar ===== */
.default-avatar {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}
