/* ==================== LIVESTREAM STYLES ==================== */
/* NIP-53 Live Activities UI */

/* ==================== LIVE TAB STYLING ==================== */

.feed-tab[data-feed="live"] {
    position: relative;
}

/* Pulse animation when there are live streams */
.feed-tab[data-feed="live"].has-live::after {
    content: '';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: #ff4444;
    border-radius: 50%;
    animation: live-pulse 2s infinite;
}

@keyframes live-pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.2);
    }
}

/* ==================== FEED LAYOUT ==================== */

.livestream-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.livestream-section:last-child {
    border-bottom: none;
}

.livestream-section .section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    padding: 0 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.livestream-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
    padding: 0 0.75rem;
}

/* ==================== STREAM CARD ==================== */

.livestream-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.livestream-card:hover {
    transform: translateY(-1px);
    border-color: var(--monero-orange);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.livestream-card.is-live {
    border-color: #ff4444;
    box-shadow: 0 0 0 1px rgba(255, 68, 68, 0.3);
}

.livestream-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
}

.livestream-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.livestream-info {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    flex: 1;
    min-width: 0;
}

.livestream-author {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.live-badge {
    background: #ff4444;
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
    text-transform: uppercase;
    animation: pulse-live 2s infinite;
}

@keyframes pulse-live {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.ended-badge {
    background: var(--text-secondary);
    color: var(--darker-bg);
    font-size: 0.6rem;
    font-weight: 600;
    padding: 1px 4px;
    border-radius: 3px;
    text-transform: uppercase;
}

.viewer-count {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.livestream-thumbnail {
    position: relative;
    aspect-ratio: 16 / 9;
    background: var(--darker-bg);
    overflow: hidden;
    max-height: 120px;
}

.livestream-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.no-thumbnail {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.2s;
}

.livestream-card:hover .play-overlay {
    opacity: 1;
}

.livestream-title {
    font-weight: 600;
    color: var(--text-primary);
    padding: 0.5rem;
    padding-bottom: 0.25rem;
    font-size: 0.8rem;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.livestream-summary {
    color: var(--text-secondary);
    font-size: 0.75rem;
    padding: 0 0.5rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.livestream-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.5rem;
    padding-top: 0.25rem;
}

.livestream-tag {
    font-size: 0.65rem;
    color: var(--monero-orange);
    background: rgba(139, 92, 246, 0.1);
    padding: 1px 5px;
    border-radius: 3px;
}

/* ==================== STREAM VIEW (RIGHT PANEL / MODAL) ==================== */

.stream-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100vh;
    background: var(--darker-bg);
    overflow: hidden;
}

.stream-view-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--card-bg);
    flex-shrink: 0;
}

.stream-view-header .back-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
}

.stream-view-header .back-btn:hover {
    color: var(--monero-orange);
}

.stream-view-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stream-player-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    flex-shrink: 0;
}

.stream-player {
    width: 100%;
    height: 100%;
    max-width: 100%;
    object-fit: contain;
}

.stream-offline {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stream-offline img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.5;
}

.offline-overlay {
    position: absolute;
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.stream-error {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 150px;
    color: #ff6666;
    font-size: 0.9rem;
    text-align: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.8);
}

/* Play button overlay for autoplay-blocked videos */
.play-button-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10;
}

.play-button-overlay .play-btn {
    background: linear-gradient(135deg, #FF6600, #FF8533);
    border: none;
    color: white;
    padding: 16px 32px;
    border-radius: 12px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(255, 102, 0, 0.4);
    transition: transform 0.2s;
}

.play-button-overlay .play-btn:active {
    transform: scale(0.95);
}

.stream-info-panel {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--card-bg);
    flex-shrink: 0;
}

.stream-host {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.host-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.host-info {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.host-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.live-indicator {
    font-size: 0.7rem;
    color: #ff4444;
}

.stream-actions {
    display: flex;
    gap: 0.25rem;
    flex-shrink: 0;
}

.tip-xmr-btn {
    background: linear-gradient(135deg, #FF6600, #FF8533);
    border: none;
    color: white;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.75rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.tip-xmr-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(255, 102, 0, 0.4);
}

.stream-description {
    margin-top: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.75rem;
    line-height: 1.4;
}

/* ==================== LIVE CHAT ==================== */

.stream-chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 150px;
    max-height: 300px;
    background: var(--card-bg);
    overflow: hidden;
}

.chat-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    margin: 0;
    flex-shrink: 0;
}

.stream-chat {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.chat-loading {
    color: var(--text-secondary);
    text-align: center;
    padding: 1rem;
    font-size: 0.8rem;
}

.chat-message {
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem;
    font-size: 0.75rem;
    line-height: 1.3;
    animation: fadeInMessage 0.3s ease;
}

@keyframes fadeInMessage {
    from { opacity: 0; transform: translateY(3px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-message.own-message {
    background: rgba(139, 92, 246, 0.1);
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    margin: 0 -0.35rem;
}

.chat-author {
    font-weight: 600;
    font-size: 0.75rem;
}

.chat-content {
    color: var(--text-primary);
    word-break: break-word;
    font-size: 0.75rem;
}

.chat-input-container {
    display: flex;
    gap: 0.35rem;
    padding: 0.5rem 0.75rem;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.chat-input {
    flex: 1;
    background: var(--darker-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.35rem 0.5rem;
    color: var(--text-primary);
    font-size: 0.75rem;
}

.chat-input:focus {
    outline: none;
    border-color: var(--monero-orange);
}

.chat-send-btn {
    background: var(--purple);
    border: none;
    color: white;
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.7rem;
    cursor: pointer;
    transition: background 0.2s;
}

.chat-send-btn:hover {
    background: #7B3FA6;
}

.chat-login-prompt {
    padding: 0.5rem 0.75rem;
    text-align: center;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
    flex-shrink: 0;
}

.chat-login-prompt a {
    color: var(--monero-orange);
    text-decoration: none;
}

.chat-login-prompt a:hover {
    text-decoration: underline;
}

/* ==================== STREAM MODAL (MOBILE) ==================== */

.stream-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.stream-modal-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--darker-bg);
    overflow: hidden;
}

.stream-modal-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
}

.stream-modal-header .close-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.stream-modal-header .modal-title {
    flex: 1;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ==================== EMPTY STATE ==================== */

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.empty-state h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* ==================== TIP MODAL ==================== */

.livestream-tip-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.tip-modal-content {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 100%;
    max-width: 380px;
    overflow: hidden;
    animation: tipModalIn 0.2s ease;
}

@keyframes tipModalIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.tip-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--darker-bg);
}

.tip-modal-header h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-primary);
}

.tip-modal-header .close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.tip-modal-header .close-btn:hover {
    color: var(--text-primary);
}

.tip-modal-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tip-amount-section,
.tip-message-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.tip-amount-section label,
.tip-message-section label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.tip-amount-input {
    background: var(--darker-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
}

.tip-amount-input:focus {
    outline: none;
    border-color: var(--monero-orange);
}

.quick-amounts {
    display: flex;
    gap: 0.5rem;
}

.quick-amounts button {
    flex: 1;
    background: var(--darker-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.4rem 0.5rem;
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-amounts button:hover {
    border-color: var(--monero-orange);
    color: var(--monero-orange);
}

.tip-message-input {
    background: var(--darker-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.6rem;
    color: var(--text-primary);
    font-size: 0.85rem;
}

.tip-message-input:focus {
    outline: none;
    border-color: var(--monero-orange);
}

.char-count {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-align: right;
}

.tip-options {
    padding: 0.5rem 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--monero-orange);
}

.wallet-balance {
    background: rgba(0, 255, 0, 0.1);
    border: 1px solid rgba(0, 255, 0, 0.3);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    color: #66ff66;
    text-align: center;
}

.wallet-warning {
    background: rgba(255, 165, 0, 0.1);
    border: 1px solid rgba(255, 165, 0, 0.3);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    color: var(--monero-orange);
    text-align: center;
}

.wallet-warning a {
    color: var(--monero-orange);
    text-decoration: underline;
}

.tip-modal-footer {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    background: var(--darker-bg);
}

.cancel-btn {
    flex: 1;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.6rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.cancel-btn:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.send-tip-btn {
    flex: 2;
    background: linear-gradient(135deg, #FF6600, #FF8533);
    border: none;
    border-radius: 8px;
    padding: 0.6rem;
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.send-tip-btn:hover:not(:disabled) {
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(255, 102, 0, 0.4);
}

.send-tip-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.tip-status {
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    text-align: center;
}

.tip-status.pending {
    background: rgba(139, 92, 246, 0.1);
    color: var(--purple);
}

.tip-status.success {
    background: rgba(0, 255, 0, 0.1);
    color: #66ff66;
}

.tip-status.error {
    background: rgba(255, 68, 68, 0.1);
    color: #ff6666;
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 768px) {
    .livestream-grid {
        grid-template-columns: 1fr;
    }

    .stream-info-panel {
        padding: 0.75rem;
    }

    .stream-host {
        flex-wrap: wrap;
    }

    .stream-actions {
        width: 100%;
        margin-top: 0.75rem;
    }

    .tip-xmr-btn {
        flex: 1;
    }
}
