/* FilmFrei24 Engagement System Styles */

:root {
    --bg: #0b0b0f;
    --card: #15151c;
    --text: #e9e9ee;
    --muted: #9aa0a6;
    --accent: #ff6b35;
    --like-color: #ff4458;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.4);
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Performance optimizations */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Reduce repaints and reflows */
.like-btn *,
.hero-like-btn *,
.continue-like-btn *,
.comment-fab * {
    pointer-events: none;
}

/* Like Containers */
.like-container {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.hero-like-container {
    display: inline-block;
    margin-left: 15px;
}

.continue-like-container {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
}

/* Loading animation for likes */
@keyframes pulse {
    0%, 100% {
        opacity: 0.4;
    }
    50% {
        opacity: 1;
    }
}

/* Comment loading state */
.comment-loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
    font-size: 14px;
    animation: pulse 1.5s ease-in-out infinite;
}

/* Like Buttons - Performance Optimized */
.like-btn,
.hero-like-btn,
.continue-like-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease;
    backdrop-filter: blur(10px);
    outline: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    will-change: transform;
}

.hero-like-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    font-size: 16px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 50px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    color: white;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-left: 15px;
}

.hero-like-btn:hover {
    background: rgba(255, 68, 88, 0.2);
    border-color: var(--like-color);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 68, 88, 0.3);
}

.continue-like-btn {
    padding: 6px 12px;
    font-size: 12px;
    background: rgba(0, 0, 0, 0.7);
}

.like-btn:hover,
.hero-like-btn:hover,
.continue-like-btn:hover {
    background: rgba(255, 68, 88, 0.2);
    border-color: var(--like-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 68, 88, 0.3);
}

.like-btn:active,
.hero-like-btn:active,
.continue-like-btn:active {
    transform: translateY(0);
}

.like-btn svg,
.hero-like-btn svg,
.continue-like-btn svg {
    transition: all 0.3s ease;
}

.like-btn.liked svg,
.hero-like-btn.liked svg,
.continue-like-btn.liked svg {
    fill: var(--like-color);
    stroke: var(--like-color);
    animation: heartBeat 0.6s ease;
}

.like-btn.liking,
.hero-like-btn.liking,
.continue-like-btn.liking {
    pointer-events: none;
    opacity: 0.7;
}

@keyframes heartBeat {
    0% { transform: scale(1); }
    25% { transform: scale(1.3); }
    50% { transform: scale(1); }
    75% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.like-count,
.hero-like-count,
.continue-like-count {
    font-weight: 600;
    color: var(--text);
    min-width: 20px;
    text-align: center;
}

/* Floating Action Button - Optimized */
.comment-fab {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeInUp 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    will-change: transform;
}

.comment-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
}

.comment-fab:active {
    transform: scale(0.95);
}

.comment-fab svg {
    width: 28px;
    height: 28px;
    pointer-events: none;
}

.comment-fab:active {
    transform: translateY(-2px) scale(1.05);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Comment Panel - Mobile Optimized */
.comment-panel {
    position: fixed;
    right: -100%;
    top: 0;
    width: 100%;
    max-width: 400px;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile */
    background: var(--card);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(100%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    -webkit-overflow-scrolling: touch;
}

.comment-panel.active {
    transform: translateX(0);
}

@media (min-width: 401px) {
    .comment-panel {
        right: -400px;
        transform: none;
    }
    
    .comment-panel.active {
        right: 0;
        transform: none;
    }
}

@media (max-width: 768px) {
    .comment-panel {
        width: 100%;
        right: -100%;
    }
}

/* Comment Header */
.comment-header {
    padding: 20px;
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    font-family: var(--font-main);
}

.comment-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.comment-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.comment-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Comment List - Optimized Scrolling */
.comment-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    background: var(--bg);
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
}

.comment-list::-webkit-scrollbar {
    width: 6px;
}

.comment-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.comment-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.comment-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.comment-loading,
.comment-empty,
.comment-error {
    text-align: center;
    color: var(--muted);
    padding: 40px 20px;
    font-size: 14px;
}

/* Comment Items */
.comment-item {
    background: var(--card);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    animation: fadeIn 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s ease;
}

.comment-item:hover {
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateX(-4px);
}

.comment-item.new-comment {
    animation: slideInRight 0.5s ease;
    border-color: var(--accent);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.comment-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.comment-author-name {
    font-weight: 600;
    color: var(--accent);
    font-size: 14px;
}

.comment-time {
    font-size: 12px;
    color: var(--muted);
}

.comment-content {
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

/* Comment Form - Mobile Keyboard Friendly */
.comment-form {
    padding: 20px;
    padding-bottom: env(safe-area-inset-bottom, 20px); /* iOS safe area */
    background: var(--card);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.comment-author,
.comment-text {
    width: 100%;
    background: var(--bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text);
    padding: 12px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
    outline: none;
}

.comment-author {
    margin-bottom: 12px;
}

.comment-text {
    min-height: 80px;
    max-height: 150px;
    resize: none; /* Disable resize on mobile */
    margin-bottom: 12px;
    -webkit-appearance: none;
}

.comment-author:focus,
.comment-text:focus {
    border-color: var(--accent);
    background: rgba(62, 166, 255, 0.05);
}

.comment-author::placeholder,
.comment-text::placeholder {
    color: var(--muted);
}

.comment-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.comment-chars {
    font-size: 12px;
    color: var(--muted);
}

.comment-submit {
    padding: 10px 24px;
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-main);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.comment-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(62, 166, 255, 0.4);
}

.comment-submit:active {
    transform: translateY(0);
}

.comment-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Toast Messages */
.engage-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--card);
    color: var(--text);
    padding: 16px 24px;
    border-radius: 50px;
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    font-weight: 500;
    z-index: 3000;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.engage-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    /* Prevent body scroll when panel is open */
    body.panel-open {
        overflow: hidden;
        position: fixed;
        width: 100%;
    }
    
    .hero-like-container {
        bottom: 70px;
        right: 20px;
    }
    
    .like-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
    
    .hero-like-btn {
        padding: 8px 16px;
        font-size: 14px;
    }
}

/* Dark mode optimization */
@media (prefers-color-scheme: dark) {
    .comment-panel {
        background: #0f0f13;
    }
    
    .comment-item {
        background: #1a1a20;
    }
    
    .comment-form {
        background: #15151b;
    }
}