/* ==========================================================================
   InstaFeed WP - Instagram Carousel Widget Styles
   ========================================================================== */

/* ==========================================================================
   Base Styles
   ========================================================================== */

.instafeed-carousel-container {
    position: relative;
    width: 100%;
    margin: 0 auto;
}

.instafeed-swiper {
    position: relative;
    overflow: hidden;
    width: 100%;
}

.instafeed-swiper .swiper-wrapper {
    display: flex;
    transition-property: transform;
    box-sizing: content-box;
}

.instafeed-swiper .swiper-slide {
    flex-shrink: 0;
    width: 100%;
    height: 100%;
    position: relative;
    transition-property: transform;
}

/* ==========================================================================
   Media Item Styles
   ========================================================================== */

.instafeed-item {
    position: relative;
    display: block;
    overflow: hidden;
    background: #f8f9fa;
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.instafeed-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.instafeed-link {
    display: block;
    text-decoration: none;
    color: inherit;
    width: 100%;
    height: 100%;
}

.instafeed-image-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    background: #f0f0f0;
}

.instafeed-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
    display: block;
}

.instafeed-image:hover {
    transform: scale(1.05);
}

/* Video indicator */
.instafeed-video-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
}

/* Caption */
.instafeed-caption {
    padding: 12px 15px;
    font-size: 14px;
    line-height: 1.4;
    color: #333;
    background: white;
    border-top: 1px solid #eee;
}

/* ==========================================================================
   Hover Effects
   ========================================================================== */

.instafeed-item--zoom .instafeed-image {
    transition: transform 0.3s ease;
}

.instafeed-item--zoom:hover .instafeed-image {
    transform: scale(1.1);
}

.instafeed-item--fade {
    overflow: hidden;
}

.instafeed-item--fade::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.instafeed-item--fade:hover::before {
    opacity: 1;
}

/* ==========================================================================
   Swiper Navigation
   ========================================================================== */

.instafeed-swiper .swiper-button-prev,
.instafeed-swiper .swiper-button-next {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    color: #333;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    margin-top: -22px;
}

.instafeed-swiper .swiper-button-prev:hover,
.instafeed-swiper .swiper-button-next:hover {
    background: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transform: scale(1.1);
}

.instafeed-swiper .swiper-button-prev {
    left: 10px;
}

.instafeed-swiper .swiper-button-next {
    right: 10px;
}

.instafeed-swiper .swiper-button-prev::after,
.instafeed-swiper .swiper-button-next::after {
    font-size: 16px;
    font-weight: bold;
}

/* ==========================================================================
   Swiper Pagination
   ========================================================================== */

.instafeed-swiper .swiper-pagination {
    position: relative;
    margin-top: 20px;
}

.instafeed-swiper .swiper-pagination-bullet {
    width: 12px;
    height: 12px;
    background: #ccc;
    opacity: 1;
    transition: all 0.3s ease;
}

.instafeed-swiper .swiper-pagination-bullet-active {
    background: #007cba;
    transform: scale(1.2);
}

/* ==========================================================================
   Modal Styles
   ========================================================================== */

.instafeed-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.instafeed-modal.is-active {
    display: flex;
}

.instafeed-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    cursor: pointer;
}

.instafeed-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    animation: modalFadeIn 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.instafeed-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.instafeed-modal-close:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.instafeed-modal-image {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    background: #f8f9fa;
}

.instafeed-modal-image img {
    max-width: 100%;
    max-height: 70vh;
    width: auto;
    height: auto;
    object-fit: contain;
}

.instafeed-modal-info {
    padding: 20px;
    border-top: 1px solid #e1e5e9;
    background: white;
}

.instafeed-modal-caption {
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    margin-bottom: 15px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.instafeed-modal-link {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    background: #E4405F;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.3s ease;
}

.instafeed-modal-link:hover {
    background: #d73652;
    color: white;
}

/* ==========================================================================
   Error States
   ========================================================================== */

.instafeed-error {
    padding: 20px;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    text-align: center;
}

.instafeed-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.instafeed-empty-icon {
    margin-bottom: 15px;
    opacity: 0.5;
}

.instafeed-empty-message {
    font-size: 16px;
    margin: 0;
}

/* ==========================================================================
   Loading States
   ========================================================================== */

.instafeed-loading {
    text-align: center;
    padding: 40px 20px;
}

.instafeed-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.instafeed-link:focus,
.instafeed-modal-close:focus,
.instafeed-modal-link:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.instafeed-swiper .swiper-button-prev:focus,
.instafeed-swiper .swiper-button-next:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .instafeed-swiper .swiper-button-prev,
    .instafeed-swiper .swiper-button-next {
        display: none;
    }
    
    .instafeed-image {
        height: 200px;
    }
    
    .instafeed-caption {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .instafeed-modal-content {
        max-width: 95vw;
        max-height: 95vh;
        margin: 10px;
    }
    
    .instafeed-modal-info {
        padding: 15px;
    }
    
    .instafeed-modal-image img {
        max-height: 60vh;
    }
}

@media (max-width: 480px) {
    .instafeed-image {
        height: 180px;
    }
    
    .instafeed-modal-close {
        top: 10px;
        right: 10px;
        width: 36px;
        height: 36px;
    }
    
    .instafeed-modal-info {
        padding: 12px;
    }
    
    .instafeed-modal-caption {
        font-size: 13px;
        margin-bottom: 12px;
    }
    
    .instafeed-modal-link {
        padding: 6px 12px;
        font-size: 13px;
    }
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .instafeed-item {
        background: #2a2a2a;
        color: #e0e0e0;
        border-top-color: #404040;
    }
    
    .instafeed-modal-content {
        background: #2a2a2a;
    }
    
    .instafeed-modal-info {
        background: #2a2a2a;
        border-top-color: #404040;
    }
    
    .instafeed-modal-caption {
        color: #e0e0e0;
    }
    
    .instafeed-empty-state {
        color: #a0a0a0;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .instafeed-modal,
    .instafeed-swiper .swiper-button-prev,
    .instafeed-swiper .swiper-button-next,
    .instafeed-swiper .swiper-pagination {
        display: none !important;
    }
}

/* ==========================================================================
   High Contrast Mode
   ========================================================================== */

@media (prefers-contrast: high) {
    .instafeed-item {
        border: 2px solid;
    }
    
    .instafeed-modal-close {
        border: 2px solid white;
    }
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .instafeed-item,
    .instafeed-image,
    .instafeed-modal-content,
    .instafeed-modal-close {
        transition: none;
        animation: none;
    }
    
    .instafeed-item:hover {
        transform: none;
    }
    
    .instafeed-item--zoom:hover .instafeed-image {
        transform: none;
    }
}

/* ==========================================================================
   Admin Settings Page Styles
   ========================================================================== */

/* Tab Content */
.tab-content {
    margin-top: 20px;
}

/* Grid Layout */
.grid {
    display: grid;
}
.grid-cols-1 {
    grid-template-columns: repeat(1, minmax(0, 1fr));
}
.xl\:grid-cols-12 {
    grid-template-columns: repeat(12, minmax(0, 1fr));
}
.gap-6 {
    gap: 1.5rem;
}
.space-y-6 > * + * {
    margin-top: 1.5rem;
}

/* Column Spans */
.xl\:col-span-12 {
    grid-column: span 12 / span 12;
}
.xl\:col-span-8 {
    grid-column: span 8 / span 8;
}
.xl\:col-span-4 {
    grid-column: span 4 / span 4;
}

/* Card Styles */
.instafeed-connection-status-card {
    background: #fff;
    border-radius: 1rem;
    border: 1px solid #e5e7eb;
    overflow: hidden;
}

.instafeed-overview-card {
    background: #fff;
    border-radius: 1rem;
    border: 1px solid #e5e7eb;
    padding: 1.5rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.instafeed-overview-card h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: #124170;
    font-size: 1.125rem;
    font-weight: 600;
}

/* Gradient Background */
.bg-gradient-to-r {
    background-image: linear-gradient(to right, var(--tw-gradient-stops));
}
.from-gray-50 {
    --tw-gradient-from: #f9fafb;
    --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgba(249, 250, 251, 0));
}
.to-white {
    --tw-gradient-to: #ffffff;
}

/* Padding and Spacing */
.px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
}
.py-3 {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}
.p-6 {
    padding: 1.5rem;
}

/* Border Colors */
.border-gray-200 {
    border-color: #e5e7eb;
}

/* Stats */
.instafeed-stats {
    display: flex;
    justify-content: space-between;
    margin: 1rem 0;
}
.instafeed-stat-item {
    text-align: center;
}
.instafeed-stat-number {
    font-size: 1.5rem;
    font-weight: bold;
    color: #124170;
}
.instafeed-stat-label {
    font-size: 0.75rem;
    color: #6b7280;
}

/* Hashtag List */
.instafeed-hashtag-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #d1d5db;
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 0.5rem;
}
.instafeed-hashtag-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e5e7eb;
}
.instafeed-hashtag-item:last-child {
    border-bottom: none;
}

/* Collection Settings */
.instafeed-collection-settings {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
.instafeed-collection-form {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    padding: 1.5rem;
}
.instafeed-collection-status {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    padding: 1.5rem;
}

/* Status Indicator */
.instafeed-status-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
}
.instafeed-status-active {
    background-color: #10b981;
}
.instafeed-status-inactive {
    background-color: #ef4444;
}

/* Export/Import */
.instafeed-export-import {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1.5rem;
}
.instafeed-export-section, .instafeed-import-section {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    padding: 1.5rem;
}

/* Flexbox Utilities */
.flex {
    display: flex;
}
.items-center {
    align-items: center;
}
.justify-between {
    justify-content: space-between;
}
.space-x-3 > * + * {
    margin-left: 0.75rem;
}
.space-y-3 > * + * {
    margin-top: 0.75rem;
}

/* Text Utilities */
.text-lg {
    font-size: 1.125rem;
    line-height: 1.75rem;
}
.text-sm {
    font-size: 0.875rem;
    line-height: 1.25rem;
}
.font-semibold {
    font-weight: 600;
}
.font-medium {
    font-weight: 500;
}
.text-gray-900 {
    color: #111827;
}
.text-gray-500 {
    color: #6b7280;
}
.text-center {
    text-align: center;
}

/* Width Utilities */
.w-full {
    width: 100%;
}

/* Block Display */
.block {
    display: block;
}

/* Border Bottom */
.border-b {
    border-bottom-width: 1px;
}

/* Padding Utilities */
.py-4 {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

/* Responsive Design */
@media (min-width: 1280px) {
    .xl\:grid-cols-12 {
        grid-template-columns: repeat(12, minmax(0, 1fr));
    }
    .xl\:col-span-12 {
        grid-column: span 12 / span 12;
    }
    .xl\:col-span-8 {
        grid-column: span 8 / span 8;
    }
    .xl\:col-span-4 {
        grid-column: span 4 / span 4;
    }
}