/**
 * Instagram Widget Frontend Styles
 * @package instagram-feed-elementor
 * @since 1.0.0
 */

/* Container */
.igfe-instagram-feed { width: 100%; }

/* Header */
.igfe-ig-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
}

.igfe-ig-header h3 {
    font-size: 24px;
    font-weight: 700;
    color: #121418;
    margin: 0;
}

.igfe-ig-header .igfe-ig-icon {
    font-size: 24px;
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Grid Layout */
.igfe-ig-grid { display: grid; gap: 15px; }
.igfe-ig-cols-2 { grid-template-columns: repeat(2, 1fr); }
.igfe-ig-cols-3 { grid-template-columns: repeat(3, 1fr); }
.igfe-ig-cols-4 { grid-template-columns: repeat(4, 1fr); }
.igfe-ig-cols-5 { grid-template-columns: repeat(5, 1fr); }
.igfe-ig-cols-6 { grid-template-columns: repeat(6, 1fr); }

/* Grid Items */
.igfe-ig-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    aspect-ratio: 1 / 1;
    background: #f5f5f5;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.igfe-ig-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.igfe-ig-item a { display: block; width: 100%; height: 100%; }

.igfe-ig-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.igfe-ig-item:hover img { transform: scale(1.08); }

/* Media Type Icon */
.igfe-ig-type-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #121418;
    z-index: 2;
    backdrop-filter: blur(4px);
}

/* Overlay */
.igfe-ig-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.8) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 15px;
    text-align: center;
}

.igfe-ig-item:hover .igfe-ig-overlay { opacity: 1; }

/* Caption */
.igfe-ig-caption {
    color: #fff;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 10px;
    max-height: 60px;
    overflow: hidden;
}

/* View Button */
.igfe-ig-view {
    width: 40px;
    height: 40px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #E1306C;
    transition: transform 0.3s ease, background 0.3s ease;
}

.igfe-ig-item:hover .igfe-ig-view { transform: scale(1.1); }
.igfe-ig-view:hover { background: #E1306C; color: #fff; }

/* Timestamp */
.igfe-ig-timestamp {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 4px;
    backdrop-filter: blur(4px);
}

/* Notices */
.igfe-ig-notice, .igfe-ig-error, .igfe-ig-empty {
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.igfe-ig-notice { background: #fff3cd; border: 1px solid #ffc107; color: #856404; }
.igfe-ig-notice .button { margin-top: 10px; }
.igfe-ig-error { background: #f8d7da; border: 1px solid #f5c6cb; color: #721c24; }
.igfe-ig-empty { background: #e2e3e5; border: 1px solid #d6d8db; color: #6c757d; }

/* Dark Mode */
[data-theme="dark"] .igfe-ig-header h3,
.dark-mode .igfe-ig-header h3 { color: #fff; }

[data-theme="dark"] .igfe-ig-item,
.dark-mode .igfe-ig-item { background: #1a1d21; }

[data-theme="dark"] .igfe-ig-type-icon,
.dark-mode .igfe-ig-type-icon { background: rgba(30, 33, 38, 0.9); color: #fff; }

/* Masonry Layout */
.igfe-ig-layout-masonry .igfe-ig-grid {
    display: block;
    column-count: 3;
    column-gap: 15px;
}

.igfe-ig-layout-masonry .igfe-ig-item {
    break-inside: avoid;
    margin-bottom: 15px;
    aspect-ratio: auto;
}

.igfe-ig-layout-masonry .igfe-ig-item img { height: auto; }

/* Slider Layout */
.igfe-ig-layout-slider .igfe-ig-grid {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.igfe-ig-layout-slider .igfe-ig-grid::-webkit-scrollbar { display: none; }
.igfe-ig-layout-slider .igfe-ig-item { flex: 0 0 280px; scroll-snap-align: start; }

/* Responsive */
@media (max-width: 1023px) {
    .igfe-ig-cols-5, .igfe-ig-cols-6 { grid-template-columns: repeat(4, 1fr); }
    .igfe-ig-layout-masonry .igfe-ig-grid { column-count: 3; }
}

@media (max-width: 991px) {
    .igfe-ig-cols-4, .igfe-ig-cols-5, .igfe-ig-cols-6 { grid-template-columns: repeat(3, 1fr); }
    .igfe-ig-header h3 { font-size: 22px; }
}

@media (max-width: 767px) {
    .igfe-ig-cols-3, .igfe-ig-cols-4, .igfe-ig-cols-5, .igfe-ig-cols-6 { grid-template-columns: repeat(2, 1fr); }
    .igfe-ig-header h3 { font-size: 20px; }
    .igfe-ig-header { margin-bottom: 20px; }
    .igfe-ig-grid { gap: 10px; }
    .igfe-ig-layout-masonry .igfe-ig-grid { column-count: 2; column-gap: 10px; }
}

@media (max-width: 575px) {
    .igfe-ig-caption { display: none; }
    .igfe-ig-view { width: 35px; height: 35px; font-size: 16px; }
    .igfe-ig-type-icon { width: 24px; height: 24px; font-size: 10px; }
    .igfe-ig-layout-slider .igfe-ig-item { flex: 0 0 200px; }
}

@media (max-width: 430px) {
    .igfe-ig-cols-2 { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .igfe-ig-header h3 { font-size: 18px; }
    .igfe-ig-item { border-radius: 6px; }
    .igfe-ig-layout-masonry .igfe-ig-grid { column-count: 2; column-gap: 8px; }
    .igfe-ig-layout-masonry .igfe-ig-item { margin-bottom: 8px; }
}

/* Animations */
@keyframes igfe-fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.igfe-ig-item { animation: igfe-fade-in 0.5s ease forwards; }
.igfe-ig-item:nth-child(1) { animation-delay: 0.05s; }
.igfe-ig-item:nth-child(2) { animation-delay: 0.1s; }
.igfe-ig-item:nth-child(3) { animation-delay: 0.15s; }
.igfe-ig-item:nth-child(4) { animation-delay: 0.2s; }
.igfe-ig-item:nth-child(5) { animation-delay: 0.25s; }
.igfe-ig-item:nth-child(6) { animation-delay: 0.3s; }

@media (prefers-reduced-motion: reduce) {
    .igfe-ig-item { animation: none; }
    .igfe-ig-item img, .igfe-ig-view, .igfe-ig-overlay { transition: none; }
}

/* Elementor Editor */
.elementor-editor-active .igfe-ig-notice,
.elementor-editor-active .igfe-ig-error,
.elementor-editor-active .igfe-ig-empty { display: block !important; }
