/**
 * atelierlalo Social Feed - Frontend Styles
 * Curator.io inspired design
 *
 * @package AtelierLalo_SocialFeed
 * @since   1.0.0
 */

/* CSS Custom Properties (set via inline styles from PHP) */
.alsf-feed-grid {
    --alsf-columns: 4;
    --alsf-gap: 0px;
}

/* Grid Container - uses CSS Custom Properties for columns/gap */
.alsf-feed-grid {
    display: grid;
    grid-template-columns: repeat(var(--alsf-columns, 4), 1fr);
    gap: var(--alsf-gap, 0px);
    width: 100%;
}

@media (max-width: 900px) {
    .alsf-feed-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .alsf-feed-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Grid Item - 4:5 aspect ratio (portrait) */
.alsf-feed-item {
    position: relative;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    cursor: pointer;
    background: #f0f0f0;
}

.alsf-feed-item img,
.alsf-feed-grid .alsf-feed-item img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: 50% 50% !important;
    transition: transform 0.4s ease;
}

.alsf-feed-item:hover img {
    transform: scale(1.05);
}

.alsf-feed-item:focus {
    outline: 3px solid #007cba;
    outline-offset: -3px;
}

/* White hover effect (10%) */
.alsf-feed-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0);
    transition: background 0.3s ease;
    pointer-events: none;
}

.alsf-feed-item:hover::after {
    background: rgba(255, 255, 255, 0.1);
}

/* Video Play Icon - top right corner */
.alsf-play-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 20px;
    height: 20px;
    color: #fff;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.6));
    z-index: 2;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.alsf-feed-item:hover .alsf-play-icon {
    opacity: 0;
}

.alsf-play-icon svg {
    width: 100%;
    height: 100%;
}

/* Platform Icon - only shown without overlay (optional fallback) */
.alsf-platform-icon {
    position: absolute;
    bottom: 10px;
    left: 10px;
    width: 22px;
    height: 22px;
    z-index: 1;
    color: #fff;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.6));
    opacity: 1;
    transition: opacity 0.3s ease;
}

.alsf-feed-item:hover .alsf-platform-icon {
    opacity: 0;
}

.alsf-platform-icon svg {
    width: 100%;
    height: 100%;
}

/* Carousel/Album indicator - shifts left if play icon present */
.alsf-carousel-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 20px;
    height: 20px;
    color: #fff;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.6));
    z-index: 1;
    transition: opacity 0.3s ease;
}

/* When both play and carousel icons, move carousel left */
.alsf-play-icon + .alsf-carousel-icon,
.alsf-play-icon ~ .alsf-carousel-icon {
    right: 36px;
}

.alsf-feed-item:hover .alsf-carousel-icon {
    opacity: 0;
}

.alsf-carousel-icon svg {
    width: 100%;
    height: 100%;
}

/* Modal Backdrop */
.alsf-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.90);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.alsf-modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* Modal Container */
.alsf-modal {
    background: #fff;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    border-radius: 4px;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.3s ease;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
}

.alsf-modal-backdrop.active .alsf-modal {
    transform: scale(1);
}

/* Modal Media Wrapper - Contains media + nav buttons */
.alsf-modal-media-wrapper {
    flex: 0 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    max-width: calc(100% - 380px);
}

/* Modal Media - The actual content area */
.alsf-modal-media {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.alsf-modal-media img {
    max-height: 85vh;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.alsf-modal-media video {
    max-height: 85vh;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.alsf-modal-media iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Modal Info Side */
.alsf-modal-info {
    width: 380px;
    min-width: 380px;
    display: flex;
    flex-direction: column;
    background: #fff;
    overflow: hidden;
}

/* Modal Header */
.alsf-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid #efefef;
}

.alsf-modal-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: #f0f0f0;
}

.alsf-modal-username {
    font-weight: 600;
    font-size: 14px;
    color: #262626;
    flex: 1;
    text-decoration: none;
    transition: color 0.2s;
}

.alsf-modal-username:hover {
    color: #0095f6;
}

.alsf-modal-platform {
    width: 24px;
    height: 24px;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.alsf-modal-platform:hover {
    color: #262626;
}

.alsf-modal-platform svg {
    width: 100%;
    height: 100%;
}

.alsf-modal-platform {
    margin-left: auto;
    width: 20px;
    height: 20px;
    color: #666;
}

.alsf-modal-platform svg {
    width: 100%;
    height: 100%;
}

/* Modal Caption - scrollable if needed */
.alsf-modal-caption {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.7;
    color: #262626;
    word-break: break-word;
    min-height: 0;
}

.alsf-modal-caption:empty::before {
    content: 'Keine Beschreibung';
    color: #8e8e8e;
    font-style: italic;
}

/* Hashtags */
.alsf-hashtag {
    color: #00376b;
    font-weight: 500;
}

/* Modal Footer */
.alsf-modal-footer {
    padding: 16px;
    border-top: 1px solid #efefef;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

/* Carousel Dots */
.alsf-carousel-dots {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex: 1;
}

.alsf-carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #dbdbdb;
    cursor: pointer;
    transition: background 0.2s;
}

.alsf-carousel-dot.active {
    background: #0095f6;
}

.alsf-carousel-dot:hover {
    background: #8e8e8e;
}

.alsf-carousel-dot.active:hover {
    background: #0095f6;
}

.alsf-modal-date {
    color: #8e8e8e;
    font-size: 12px;
    text-transform: uppercase;
}

.alsf-modal-link {
    color: #262626;
    text-decoration: none;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.alsf-modal-link:hover {
    background: #f5f5f5;
}

.alsf-modal-link svg {
    display: block;
}

/* Close Button */
.alsf-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 26px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #262626;
    transition: background 0.2s, transform 0.2s;
}

.alsf-modal-close:hover {
    background: #fff;
    transform: scale(1.08);
}

/* Responsive Modal */
@media (max-width: 900px) {
    .alsf-modal-backdrop {
        padding: 0;
        align-items: flex-start;
    }
    
    .alsf-modal {
        flex-direction: column;
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        border-radius: 0;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
    }
    
    .alsf-modal-media-wrapper {
        width: 100%;
        max-width: 100%;
        flex: 1;
        min-height: 0;
    }
    
    .alsf-modal-media {
        width: 100%;
        height: 100%;
    }
    
    .alsf-modal-media img,
    .alsf-modal-media video {
        width: 100%;
        height: 100%;
        max-height: none;
        object-fit: contain;
    }
    
    .alsf-modal-info {
        width: 100%;
        min-width: 100%;
        height: 200px;
        min-height: 200px;
        max-height: 200px;
        flex: none;
        overflow: hidden;
    }
    
    .alsf-modal-caption {
        max-height: 80px;
        overflow: hidden;
        position: relative;
    }
    
    .alsf-modal-caption.expanded {
        max-height: none;
        overflow-y: auto;
    }
    
    .alsf-modal-info.expanded {
        height: auto;
        max-height: 60vh;
    }
    
    .alsf-modal-info.expanded .alsf-modal-caption {
        max-height: none;
    }
    
    .alsf-modal-close {
        top: 10px;
        right: 10px;
        width: 38px;
        height: 38px;
        font-size: 22px;
    }
}

/* Show More Button (Mobile) */
.alsf-show-more {
    display: none;
    padding: 8px 16px;
    color: #8e8e8e;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    background: none;
}

.alsf-show-more:hover {
    color: #262626;
}

@media (max-width: 900px) {
    .alsf-show-more {
        display: block;
    }
    
    .alsf-modal-info.expanded .alsf-show-more {
        display: none;
    }
}

/* Loading State */
.alsf-modal-media.loading {
    position: relative;
}

.alsf-modal-media.loading::after {
    content: '';
    position: absolute;
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top-color: #333;
    border-radius: 50%;
    animation: alsf-spin 1s linear infinite;
}

@keyframes alsf-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Error State */
.alsf-error {
    color: #dc3545;
    padding: 10px 15px;
    background: #f8d7da;
    border-radius: 4px;
    font-size: 14px;
}

/* Navigation Arrows - At screen edges (inside backdrop) */
.alsf-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.92);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.2s, transform 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.alsf-modal-nav:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.1);
}

.alsf-modal-nav svg {
    color: #333;
}

.alsf-modal-prev {
    left: 20px;
}

.alsf-modal-next {
    right: 20px;
}

/* Carousel indicator - bottom center of media */
.alsf-carousel-indicator {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    z-index: 10;
    pointer-events: none;
    display: none;
}

/* TikTok indicator pill - bottom center of media */
.alsf-tiktok-indicator {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    z-index: 10;
    display: none;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.2s ease;
    white-space: nowrap;
}

.alsf-tiktok-indicator:hover {
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    transform: translateX(-50%) scale(1.05);
}

@media (max-width: 900px) {
    .alsf-modal-nav {
        width: 40px;
        height: 40px;
    }
    
    .alsf-modal-prev {
        left: 8px;
    }
    
    .alsf-modal-next {
        right: 8px;
    }
    
    /* Auto-hide controls on mobile */
    .alsf-modal-nav,
    .alsf-modal-close {
        opacity: 1;
        transition: opacity 0.3s ease;
    }
    
    .alsf-modal-backdrop.controls-hidden .alsf-modal-nav,
    .alsf-modal-backdrop.controls-hidden .alsf-modal-close {
        opacity: 0;
        pointer-events: none;
    }
}

/* ==========================================
   DSGVO Privacy Placeholder
   ========================================== */
.alsf-privacy-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    color: #fff;
    min-height: 300px;
    width: 100%;
    height: 100%;
}

.alsf-privacy-icon {
    margin-bottom: 20px;
    opacity: 0.5;
}

.alsf-privacy-icon svg {
    width: 48px;
    height: 48px;
}

.alsf-privacy-text {
    max-width: 280px;
    margin: 0 0 24px 0;
    font-size: 14px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.8);
}

.alsf-privacy-text strong {
    color: #fff;
}

.alsf-privacy-button {
    padding: 14px 32px;
    background: #fff;
    color: #1a1a1a;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.alsf-privacy-button:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(255, 255, 255, 0.2);
}

.alsf-privacy-button:active {
    transform: scale(0.98);
}

.alsf-privacy-remember {
    margin-top: 16px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.alsf-privacy-remember input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
    accent-color: #fff;
}

.alsf-privacy-remember:hover {
    color: rgba(255, 255, 255, 0.8);
}

@media (max-width: 900px) {
    .alsf-privacy-placeholder {
        padding: 30px 15px;
        min-height: 250px;
    }
    
    .alsf-privacy-icon svg {
        width: 40px;
        height: 40px;
    }
    
    .alsf-privacy-text {
        font-size: 13px;
        max-width: 260px;
    }
    
    .alsf-privacy-button {
        padding: 12px 28px;
        font-size: 13px;
    }
}
