/* ═══════════════════════════════════════════════════════════════ */
/* STICKY COMBINED MEDIA POPUP BOX */
/* ═══════════════════════════════════════════════════════════════ */

.sticky-media-popup {
    position: fixed;
    top: 150px;
    left: 25px;
    width: 380px;
    max-height: 550px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    z-index: 950;
    border: 2px solid rgba(13, 69, 44, 0.15);
    animation: slideInMedia 0.4s ease;
    transition: all 0.3s ease;
    overflow: hidden;
}
.sticky-media-popup:hover{
    cursor: move;
}

@keyframes slideInMedia {
    from {
        transform: translateX(450px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutMedia {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(450px);
        opacity: 0;
    }
}

.sticky-media-popup.minimized {
    max-height: 60px;
    width: 60px;
}

.sticky-media-popup.minimized .media-popup-header {
    border-radius: 16px;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sticky-media-popup.minimized .media-popup-header:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 30px rgba(255, 215, 0, 0.3);
}

.sticky-media-popup.minimized .media-popup-tabs,
.sticky-media-popup.minimized .media-popup-content {
    display: none;
}

.media-popup-header {
    padding: 1.2rem;
    background: linear-gradient(135deg, #0d452c 0%, #1a2e27 100%);
    color: white;
    border-radius: 14px 14px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid rgba(255, 215, 0, 0.2);
    flex-shrink: 0;
}

.media-popup-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.media-popup-header i {
    color: #FFD700;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

.media-popup-controls {
    display: flex;
    gap: 0.5rem;
}

.media-popup-minimize,
.media-popup-close {
    background: rgba(255, 215, 0, 0.2);
    border: none;
    color: #FFD700;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.media-popup-minimize:hover,
.media-popup-close:hover {
    background: rgba(255, 215, 0, 0.3);
    transform: scale(1.05);
}

/* Media Popup Tabs */
.media-popup-tabs {
    display: flex;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    gap: 0;
}

.media-tab-btn {
    flex: 1;
    padding: 0.8rem;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: #666;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border-bottom: 3px solid transparent;
}

.media-tab-btn:hover {
    background: #f0f0f0;
    color: #0d452c;
}

.media-tab-btn.active {
    color: #0d452c;
    border-bottom-color: #FFD700;
    background: white;
}

.media-popup-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: white;
    color:#0d452c;
}

.media-tab-content {
    display: none;
}

.media-tab-content.active {
    display: block;
}

/* Media Popup Display */
.media-popup-display {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.media-popup-item {
    background: #f8f9fa;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.media-popup-item:hover {
    box-shadow: 0 5px 20px rgba(13, 69, 44, 0.15);
    transform: translateY(-2px);
}

.media-popup-thumbnail {
    position: relative;
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, #0d452c 0%, #1a2e27 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
}

.media-popup-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-popup-thumbnail:hover .media-icon {
    transform: scale(1.15);
}

.media-icon {
    position: absolute;
    width: 60px;
    height: 60px;
    background: rgba(255, 215, 0, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #0d452c;
    transition: all 0.3s ease;
    z-index: 10;
}

.media-popup-info {
    padding: 0.8rem;
}

.media-popup-filename {
    font-size: 0.9rem;
    font-weight: 600;
    color: #0d452c;
    margin: 0 0 0.5rem 0;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.media-popup-date {
    font-size: 0.75rem;
    color: #666;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.media-popup-action {
    width: 100%;
    padding: 0.6rem;
    background: linear-gradient(135deg, #0d452c 0%, #1a2e27 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-top: 0.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.media-popup-action:hover {
    background: linear-gradient(135deg, #1a2e27 0%, #0d452c 100%);
    transform: scale(1.02);
}

/* Empty State */
.media-popup-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    color: #999;
    text-align: center;
    gap: 1rem;
}

.media-popup-empty i {
    font-size: 3rem;
    color: rgba(0, 0, 0, 0.1);
}

.media-popup-empty p {
    margin: 0;
    font-size: 0.9rem;
}

/* Scrollbar Styling */
.media-popup-content::-webkit-scrollbar {
    width: 6px;
}

.media-popup-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.media-popup-content::-webkit-scrollbar-thumb {
    background: #0d452c;
    border-radius: 10px;
    opacity: 0.6;
}

.media-popup-content::-webkit-scrollbar-thumb:hover {
    opacity: 1;
}

/* Media Modal */
.media-popup-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.3s ease;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.media-popup-modal.show {
    display: flex !important;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.media-modal-content {
    background: white;
    border-radius: 16px;
    max-width: 90%;
    max-height: 90vh;
    overflow: auto;
    position: relative;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.media-modal-header {
    padding: 1.2rem;
    background: linear-gradient(135deg, #0d452c 0%, #1a2e27 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 16px 16px 0 0;
}

.media-modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
}

.media-modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.media-modal-close:hover {
    transform: scale(1.1);
}

.media-modal-body {
    padding: 1.5rem;
}

.media-player,
.media-viewer {
    width: 100%;
    max-width: 100%;
    border-radius: 12px;
    display: block;
}

.media-info-details {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 12px;
    border-left: 4px solid #0d452c;
}

.media-info-details h4 {
    margin: 0 0 0.5rem 0;
    color: #0d452c;
    font-size: 0.95rem;
    font-weight: 700;
}

.media-info-details p {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
}

/* Post Modal Styles */
.post-modal-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #0d452c;
    margin: 0 0 1rem 0;
    line-height: 1.3;
}

.post-modal-date {
    color: #666;
    font-size: 0.9rem;
    margin: 0 0 1.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.post-modal-date i {
    color: #0d452c;
}

.post-modal-body-content {
    font-size: 1rem;
    line-height: 1.8;
    color: #333;
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Responsive Design */
@media (max-width: 1400px) {
    .sticky-media-popup {
        width: 340px;
        right: 10px;
    }
}

/* cover icon visible when popup is closed */
.sticky-media-cover {
    position: fixed;
    top: 150px;
    left: 25px;
    width: 60px;
    height: 60px;
    cursor: pointer;
    z-index: 9999; /* highest priority */
    background: #0d452c; /* green theme background */
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    pointer-events: auto;
}
.sticky-media-cover img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 12px;
}

/* when popup is minimized we hide all inner controls (used by cover state as well) */
.sticky-media-popup.minimized .media-popup-header,
.sticky-media-popup.minimized .media-popup-tabs,
.sticky-media-popup.minimized .media-popup-content {
    display: none;
}

/* limit modal content size to roughly 30% of viewport */
.media-modal-content {
    width: 40vw;
    min-width: 25vw;
    max-width: 90%;
    /* default height allows full-screen up to 90vh */
    max-height: 90vh;
    overflow: auto;
}

/* restrict video/image modals to smaller height */
.media-modal-content:not(.post-modal) {
    max-height: 65vh;
}

/* posts need much larger modal for full visibility */
.media-modal-content.post-modal {
    width: 60vw; /* wider than standard 30vw */
    min-width: 50vw;
    max-height: 85vh; /* nearly full screen */
    overflow: visible; /* allow content to determine height */
}

/* post modal body should use full available space without scroll */
.post-modal-body-content {
    max-height: none; /* remove height constraint */
    overflow: visible; /* no scrollbar */
    white-space: normal; /* allow text wrapping */
    word-wrap: break-word;
}

/* scale media inside modals */
.media-modal-body img,
.media-modal-body video,
.media-modal-body iframe {
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

@media (max-width: 768px) {
    .sticky-media-popup {
        position: relative;
        right: auto;
        top: auto;
        width: 100%;
        max-height: 400px;
        margin: 1rem 0;
    }
}
