/**
 * InstaPosts Premium Modal & Carousel Styles
 * Advanced video player + image carousel
 */

:root {
    --ip-primary: #2F5189;
    --ip-primary-hover: #24406b;
    --ip-dark-overlay: rgba(0, 0, 0, 0.75);
    --ip-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ====================================
   MODAL - PREMIUM WRAPPER
   ==================================== */

.ip-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.ip-modal.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.ip-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--ip-dark-overlay);
    z-index: -1;
    backdrop-filter: blur(2px);
}

.ip-modal-content {
    position: relative;
    background: #fff;
    width: 95%;
    max-width: 1200px;
    height: 90vh;
    max-height: 90vh;
    display: flex;
    border-radius: 12px;
    overflow: hidden;
    z-index: 1000;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: scale(0.95) translateY(20px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* ====================================
   MODAL - IMAGE & VIDEO AREA
   ==================================== */

.ip-modal-body {
    display: flex;
    width: 100%;
    height: 100%;
}

.ip-modal-image {
    flex: 1.5;
    background: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    height: 100%;
    overflow: hidden;
}

.ip-modal-image img,
.ip-modal-image video {
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* Video Controls - Premium Styling */
.ip-modal-image video {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
}

.ip-modal-image video::-webkit-media-controls-panel {
    background-color: rgba(0, 0, 0, 0.7);
}

.ip-modal-image video::-webkit-media-controls-current-time-display {
    color: #fff;
}

.ip-modal-image video::-webkit-media-controls-time-remaining-display {
    color: #fff;
}

/* ====================================
   CAROUSEL CONTROLS - PREMIUM
   ==================================== */

.ip-carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 50;
    transition: var(--ip-transition);
    color: #333;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.ip-carousel-btn:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.ip-carousel-btn svg {
    width: 24px;
    height: 24px;
    stroke-width: 2;
}

.ip-carousel-prev {
    left: 20px;
}

.ip-carousel-next {
    right: 20px;
}

/* Carousel Dots */
.ip-carousel-dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 50;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.ip-carousel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: var(--ip-transition);
    border: 2px solid transparent;
}

.ip-carousel-dot:hover {
    background: rgba(255, 255, 255, 0.8);
}

.ip-carousel-dot.active {
    background: #fff;
    width: 28px;
    border-radius: 5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ====================================
   MODAL - DETAILS SIDEBAR
   ==================================== */

.ip-modal-details {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fff;
    border-left: 1px solid #f0f0f0;
    overflow: hidden;
}

.ip-modal-header {
    padding: 20px 16px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.ip-modal-user {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.ip-modal-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.ip-modal-username {
    font-weight: 600;
    font-size: 14px;
    color: var(--ip-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Caption Area */
.ip-modal-caption-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
}

.ip-caption-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ip-modal-text {
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    word-break: break-word;
}

.ip-modal-time {
    font-size: 12px;
    color: #999;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
}

/* ====================================
   MODAL - CLOSE BUTTON (PREMIUM)
   ==================================== */

.ip-modal-close {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1001;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: var(--ip-transition);
    color: #333;
    padding: 0;
}

.ip-modal-close:hover {
    background: #fff;
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    color: #000;
}

.ip-modal-close svg {
    width: 24px;
    height: 24px;
    display: block;
    stroke: currentColor;
    stroke-width: 2;
}

/* ====================================
   NAVIGATION ARROWS (POSTS)
   ==================================== */

.ip-nav-btn {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: var(--ip-transition);
    color: #333;
    padding: 0;
}

.ip-nav-btn:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    color: var(--ip-primary);
}

.ip-nav-btn svg {
    width: 24px;
    height: 24px;
    display: block;
}

.ip-prev {
    left: 20px;
}

.ip-next {
    right: 20px;
}

/* ====================================
   MOBILE RESPONSIVE FIXES
   ==================================== */

@media (max-width: 768px) {
    .ip-modal-content {
        width: 98%;
        height: 95vh;
        flex-direction: column;
    }

    .ip-modal-body {
        flex-direction: column;
    }

    .ip-modal-image {
        flex: 1;
        height: 60%;
    }

    .ip-modal-details {
        flex: 1;
        height: 40%;
        min-width: unset;
        border-left: none;
        border-top: 1px solid #f0f0f0;
    }

    .ip-modal-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
    }

    .ip-modal-close svg {
        width: 20px;
        height: 20px;
    }

    .ip-nav-btn {
        width: 40px;
        height: 40px;
    }

    .ip-nav-btn svg {
        width: 20px;
        height: 20px;
    }

    .ip-prev {
        left: 10px;
    }

    .ip-next {
        right: 10px;
    }

    .ip-carousel-btn {
        width: 40px;
        height: 40px;
    }

    .ip-carousel-btn svg {
        width: 20px;
        height: 20px;
    }

    .ip-carousel-prev {
        left: 10px;
    }

    .ip-carousel-next {
        right: 10px;
    }

    .ip-carousel-dots {
        bottom: 10px;
        gap: 6px;
        padding: 8px 12px;
    }

    .ip-carousel-dot {
        width: 8px;
        height: 8px;
    }

    .ip-carousel-dot.active {
        width: 24px;
    }
}

/* Hide scrollbar but keep functionality */
.ip-modal-details::-webkit-scrollbar {
    width: 6px;
}

.ip-modal-details::-webkit-scrollbar-track {
    background: #f0f0f0;
}

.ip-modal-details::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.ip-modal-details::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Firefox scrollbar */
.ip-modal-details {
    scrollbar-width: thin;
    scrollbar-color: #ccc #f0f0f0;
}
