/**
 * DFX Feed for Telegram Channels - Frontend Styles
 */

/* Feed Container */
.dfxfftc-layout,
.dfxfftc-browser-layout {
    max-width: 800px;
    margin: 0 auto;
}

/* Remove max-width on small screens for full mobile width */
@media (max-width: 768px) {
    .dfxfftc-layout,
    .dfxfftc-browser-layout {
        max-width: 100%;
    }
}

/* Individual Message */
.dfxfftc-message {
    background: #ffffff;
    border: 1px solid #e1e8ed;
    border-radius: 12px;
    margin-bottom: 20px;
    padding: 16px;
    transition: box-shadow 0.2s ease;
}

.dfxfftc-message:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.dfxfftc-message:last-child {
    margin-bottom: 0;
}

/* Media - Images appear BEFORE text */
.dfxfftc-media {
    margin-bottom: 12px;
    line-height: 0;
}

.dfxfftc-media img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
}

/* Feed-specific: Miniaturized/constrained images */
.dfxfftc .dfxfftc-media {
    max-height: 200px;
    overflow: hidden;
    position: relative;
}

.dfxfftc .dfxfftc-media img {
    max-height: 200px;
    width: auto;
    max-width: 100%;
    object-fit: cover;
    margin: 0 auto;
}

/* Browser-specific: Full-size images */
.dfxfftc-browser .dfxfftc-media-browser {
    max-height: none;
}

.dfxfftc-browser .dfxfftc-media-browser img {
    max-height: none;
}

/* Meta Information */
.dfxfftc-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    font-size: 13px;
    color: #657786;
}

.dfxfftc-date {
    font-weight: 500;
}

.dfxfftc-edited {
    margin-left: 6px;
    color: #8899a6;
    font-size: 0.85em;
    font-style: italic;
    cursor: help;
}

.dfxfftc-id {
    color: #8899a6;
    font-family: monospace;
}

/* Author Information */
.dfxfftc-author {
    margin-bottom: 10px;
    font-size: 14px;
    color: #14171a;
    font-weight: 600;
}

.dfxfftc-username {
    color: #1da1f2;
    font-weight: 400;
}

/* Media appears after date and author */
.dfxfftc-media {
    margin-bottom: 12px;
    line-height: 0;
}
.dfxfftc-text {
    color: #14171a;
    font-size: 15px;
    line-height: 1.5;
    word-wrap: break-word;
}

/* Browser Specific Styles */
.dfxfftc-browser .dfxfftc-message-browser {
    border-left: 4px solid #1da1f2;
}

/* Sticker Styles */
.dfxfftc-sticker .dfxfftc-media-sticker {
    max-height: none;
    text-align: center;
}

.dfxfftc-sticker .dfxfftc-media-sticker img {
    max-width: 150px;
    max-height: 150px;
    object-fit: contain;
}

.dfxfftc-emoji-overlay {
    position: absolute;
    bottom: 5px;
    right: 5px;
    font-size: 24px;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
}

/* Text Formatting */
.dfxfftc-text code {
    background: #f6f8fa;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    color: #24292e;
}

.dfxfftc-text pre {
    background: #f6f8fa;
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 10px 0;
}

.dfxfftc-text pre code {
    background: transparent;
    padding: 0;
    font-size: 13px;
    line-height: 1.5;
}

.dfxfftc-text blockquote {
    border-left: 4px solid #dfe2e5;
    padding-left: 16px;
    margin: 10px 0;
    color: #6a737d;
    font-style: italic;
}

.dfxfftc-text a {
    color: #1da1f2;
    text-decoration: none;
}

.dfxfftc-text a:hover {
    text-decoration: underline;
}

.dfxfftc-text .dfxfftc-mention,
.dfxfftc-text .dfxfftc-hashtag {
    color: #1da1f2;
    font-weight: 500;
}

.dfxfftc-text .dfxfftc-bot_command {
    color: #0366d6;
    font-family: monospace;
}

/* Error and Info Messages */
.dfxfftc-error {
    padding: 15px;
    background: #f8d7da;
    border: 1px solid #f5c2c7;
    border-radius: 8px;
    color: #842029;
    margin: 16px 0;
}

.dfxfftc-error strong {
    font-weight: 600;
}

.dfxfftc-info {
    padding: 15px;
    background: #cfe2ff;
    border: 1px solid #b6d4fe;
    border-radius: 8px;
    color: #084298;
    margin: 16px 0;
}

.dfxfftc-info strong {
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .dfxfftc-message {
        padding: 12px;
        margin-bottom: 16px;
    }
    
    .dfxfftc-text {
        font-size: 14px;
    }
    
    .dfxfftc .dfxfftc-media {
        max-height: 150px;
    }
    
    .dfxfftc .dfxfftc-media img {
        max-height: 150px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .dfxfftc-message {
        background: #15202b;
        border-color: #38444d;
    }
    
    .dfxfftc-message:hover {
        box-shadow: 0 2px 8px rgba(255, 255, 255, 0.1);
    }
    
    .dfxfftc-text {
        color: #ffffff;
    }
    
    .dfxfftc-meta {
        color: #8899a6;
    }
}

/* Sticker Containers */
.dfxfftc-sticker-container {
    max-width: 150px;
    max-height: 150px;
    margin: 0 auto;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dfxfftc-sticker-container.dfxfftc-sticker-browser {
    max-width: 256px;
    max-height: 256px;
}

@media (max-width: 768px) {
    .dfxfftc-sticker-container {
        max-width: 120px;
        max-height: 120px;
    }
}

/* Video Stickers */
.dfxfftc-sticker-video {
    max-width: 150px;
    max-height: 150px;
    display: block;
    margin: 0 auto;
    border-radius: 0; /* Stickers don't have rounded corners */
}

.dfxfftc-sticker-video.dfxfftc-sticker-browser {
    max-width: 256px;
    max-height: 256px;
}

@media (max-width: 768px) {
    .dfxfftc-sticker-video {
        max-width: 120px;
        max-height: 120px;
    }
}

/* Lottie player canvas */
.dfxfftc-sticker-container canvas {
    max-width: 100% !important;
    max-height: 100% !important;
    width: auto !important;
    height: auto !important;
}

/* Lightbox Styles */
.dfxfftc-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

.dfxfftc-lightbox-active {
    display: block;
}

.dfxfftc-lightbox-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    cursor: pointer;
}

.dfxfftc-lightbox-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dfxfftc-lightbox-image {
    max-width: 95vw;
    max-height: 95vh;
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
    transition: transform 0.2s ease;
    user-select: none;
}

.dfxfftc-lightbox-controls {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 10000;
}

.dfxfftc-lightbox-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    padding: 0;
}

.dfxfftc-lightbox-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.dfxfftc-lightbox-btn:active {
    background: rgba(255, 255, 255, 0.35);
}

.dfxfftc-lightbox-btn svg {
    width: 20px;
    height: 20px;
}

/* Responsive adjustments for lightbox */
@media (max-width: 768px) {
    .dfxfftc-lightbox-controls {
        top: 10px;
        right: 10px;
        gap: 8px;
    }
    
    .dfxfftc-lightbox-btn {
        width: 40px;
        height: 40px;
    }
    
    .dfxfftc-lightbox-btn svg {
        width: 18px;
        height: 18px;
    }
    
    .dfxfftc-lightbox-image {
        max-width: 100vw;
        max-height: 100vh;
    }
    
    .dfxfftc-lightbox-content {
        max-width: 100vw;
        max-height: 100vh;
    }
}
