/**
 * Frontend Styles
 *
 * @package DataLakeIntegration
 * @since 2.0.0
 */

/* Container */
.datalake-feeds-container {
    margin: 20px 0;
}

.datalake-feeds-content {
    position: relative;
}

/* Loading State */
.datalake-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.datalake-loading::after {
    content: "...";
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: ""; }
    40% { content: "."; }
    60% { content: ".."; }
    80%, 100% { content: "..."; }
}

/* Feed Layouts */
.datalake-feeds {
    display: grid;
    gap: 20px;
}

/* Card Layout (Default) */
.datalake-feeds.template-card {
    grid-template-columns: 1fr;
}

.feed-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    transition: box-shadow 0.3s;
}

.feed-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.feed-card .feed-title {
    margin: 0 0 10px;
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.3;
}

.feed-card .feed-title a {
    color: #2271b1;
    text-decoration: none;
}

.feed-card .feed-title a:hover {
    text-decoration: underline;
}

.feed-card .feed-meta {
    font-size: 0.875rem;
    color: #646970;
    margin-bottom: 15px;
}

.feed-card .feed-meta > * {
    margin-right: 10px;
}

.feed-card .feed-teaser,
.feed-card .feed-description {
    margin-bottom: 15px;
    line-height: 1.6;
}

.feed-card .feed-tags {
    margin-bottom: 15px;
}

.feed-card .feed-tag {
    display: inline-block;
    padding: 4px 8px;
    background: #f0f0f1;
    border-radius: 4px;
    font-size: 0.75rem;
    margin-right: 5px;
    margin-bottom: 5px;
}

.feed-card .feed-tag.tag-urgency {
    background: #dc3232;
    color: #fff;
}

.feed-card .feed-tag.tag-language {
    background: #00a32a;
    color: #fff;
}

.feed-card .feed-link {
    color: #2271b1;
    text-decoration: none;
    font-weight: 500;
}

.feed-card .feed-link:hover {
    text-decoration: underline;
}

/* List Layout */
.datalake-feeds.template-list {
    grid-template-columns: 1fr;
    gap: 0;
}

.feed-list {
    padding: 15px 0;
    border-bottom: 1px solid #ddd;
}

.feed-list:last-child {
    border-bottom: none;
}

.feed-list .feed-title {
    margin: 0 0 8px;
    font-size: 1.2rem;
    font-weight: 600;
}

.feed-list .feed-title a {
    color: #2271b1;
    text-decoration: none;
}

.feed-list .feed-title a:hover {
    text-decoration: underline;
}

.feed-list .feed-teaser {
    margin: 0 0 8px;
    color: #646970;
}

.feed-list .feed-meta {
    font-size: 0.875rem;
    color: #646970;
}

.feed-list .feed-meta > * {
    margin-right: 10px;
}

/* Grid Layout */
.datalake-feeds.template-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.feed-grid {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    transition: transform 0.2s;
}

.feed-grid:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.feed-grid .feed-title {
    margin: 0 0 10px;
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.3;
}

.feed-grid .feed-title a {
    color: #2271b1;
    text-decoration: none;
}

.feed-grid .feed-teaser {
    font-size: 0.875rem;
    color: #646970;
    margin-bottom: 10px;
}

.feed-grid .feed-meta {
    font-size: 0.75rem;
    color: #646970;
}

/* Minimal Layout */
.datalake-feeds.template-minimal {
    grid-template-columns: 1fr;
    gap: 8px;
}

.feed-minimal {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f1;
    display: flex;
    justify-content: space-between;
}

.feed-minimal a {
    color: #2271b1;
    text-decoration: none;
    flex: 1;
}

.feed-minimal a:hover {
    text-decoration: underline;
}

.feed-minimal .feed-date {
    font-size: 0.875rem;
    color: #646970;
    margin-left: 10px;
}

/* Empty & Error States */
.datalake-empty,
.datalake-error {
    text-align: center;
    padding: 40px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.datalake-error {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

/* Filter Panel */
.datalake-filters {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.filter-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 0.875rem;
}

.filter-field select,
.filter-field input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Sort field styling */
.filter-field .datalake-sort-select {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: border-color 0.2s;
}

.filter-field .datalake-sort-select:hover {
    border-color: #2271b1;
}

.filter-field .datalake-sort-select:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

.filter-actions {
    text-align: right;
}

.filter-actions .button {
    margin-left: 10px;
}

/* ============================================================
   IMAGE STYLES
   ============================================================ */

/* Base Image Styles */
.feed-image-figure {
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.feed-image {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
    background-color: #f0f0f0; /* Loading state */
}

/* Image Size Classes */
.feed-image-small {
    max-width: 80px;
    max-height: 80px;
}

.feed-image-medium {
    max-width: 100%;
    aspect-ratio: 16/9;
}

.feed-image-large {
    max-width: 100%;
    aspect-ratio: 16/9;
}

/* Image Link Wrapper */
.feed-image-link {
    display: block;
    overflow: hidden;
}

.feed-image-link:hover .feed-image {
    transform: scale(1.02);
    transition: transform 0.3s ease;
}

/* Caption and Credit Styles */
.feed-image-meta {
    padding: 8px 0;
    font-size: 0.875rem;
    color: #666;
    line-height: 1.4;
}

.feed-image-caption {
    display: block;
    font-style: italic;
}

.feed-image-credit {
    display: block;
    font-size: 0.8125rem;
    color: #888;
    margin-top: 4px;
}

/* Card Template Image Styles */
.feed-card .feed-image-figure {
    margin-bottom: 16px;
    border-radius: 4px;
    overflow: hidden;
}

.feed-card .feed-card-image {
    aspect-ratio: 16/9;
}

.feed-card .feed-image-link:hover .feed-card-image {
    transform: scale(1.05);
}

/* List Template Image Styles */
.feed-list {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.feed-list-image-container {
    flex-shrink: 0;
}

.feed-list-image-container .feed-image-figure {
    width: 80px;
    height: 80px;
    border-radius: 4px;
    overflow: hidden;
}

.feed-list-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
}

.feed-list-content {
    flex: 1;
    min-width: 0; /* Allow text truncation */
}

/* Grid Template Image Styles */
.feed-grid .feed-image-figure {
    margin-bottom: 12px;
    border-radius: 4px;
    overflow: hidden;
}

.feed-grid .feed-grid-image {
    aspect-ratio: 4/3;
}

.feed-grid .feed-image-link:hover .feed-grid-image {
    opacity: 0.9;
    transition: opacity 0.3s ease;
}

/* Minimal Template Image Styles */
.feed-minimal {
    display: flex;
    align-items: center;
    gap: 12px;
}

.feed-minimal .feed-image-figure {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 4px;
    overflow: hidden;
}

.feed-minimal .feed-minimal-icon {
    width: 40px;
    height: 40px;
    object-fit: cover;
}

/* Placeholder Styles */
.feed-image-placeholder {
    opacity: 0.6;
}

/* Loading State */
.feed-image[loading="lazy"] {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Responsive */
@media (max-width: 768px) {
    .datalake-feeds.template-grid {
        grid-template-columns: 1fr;
    }

    .filter-grid {
        grid-template-columns: 1fr;
    }

    .feed-card {
        padding: 15px;
    }

    /* Stack list images on mobile */
    .feed-list {
        flex-direction: column;
    }

    .feed-list-image-container .feed-image-figure {
        width: 100%;
        height: auto;
    }

    .feed-list-image {
        width: 100%;
        height: auto;
        max-height: 200px;
    }

    /* Adjust card images */
    .feed-card .feed-card-image {
        aspect-ratio: 4/3;
    }

    /* Smaller minimal icons on mobile */
    .feed-minimal .feed-image-figure {
        width: 32px;
        height: 32px;
    }

    .feed-minimal .feed-minimal-icon {
        width: 32px;
        height: 32px;
    }
}
