/**
 * Frontend Styles for RSS Feed Display Plugin
 */

/* Feed Container */
.rfd-feed-container {
    max-width: 100%;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* Feed Header */
.rfd-feed-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.rfd-feed-title {
    margin: 0 0 10px 0;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.3;
    color: #333;
}

.rfd-feed-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.rfd-feed-title a:hover {
    color: #0073aa;
}

.rfd-feed-description {
    margin: 0;
    font-size: 16px;
    color: #666;
    line-height: 1.6;
}

/* Feed Items */
.rfd-feed-items {
    display: grid;
    gap: 30px;
}

/* Feed Item */
.rfd-feed-item {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 25px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

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

/* Item with Image Layout */
.rfd-feed-item:has(.rfd-item-image) {
    grid-template-columns: 250px 1fr;
}

/* Item Image */
.rfd-item-image {
    overflow: hidden;
    border-radius: 6px;
    background: #f5f5f5;
}

.rfd-item-image img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    aspect-ratio: 16/9;
    transition: transform 0.3s ease;
}

.rfd-item-image a:hover img {
    transform: scale(1.05);
}

/* Item Content */
.rfd-item-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Item Title */
.rfd-item-title {
    margin: 0;
    font-size: 22px;
    font-weight: 600;
    line-height: 1.4;
    color: #333;
}

.rfd-item-title a {
    color: inherit;
    text-decoration: none;
    transition: color 0.3s ease;
}

.rfd-item-title a:hover {
    color: #0073aa;
}

/* Item Meta */
.rfd-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #666;
    flex-wrap: wrap;
}

.rfd-item-author {
    font-weight: 500;
    color: #555;
}

.rfd-meta-separator {
    color: #ccc;
}

.rfd-item-date {
    color: #888;
}

/* Item Description */
.rfd-item-description {
    font-size: 15px;
    line-height: 1.7;
    color: #555;
    margin: 0;
}

.rfd-item-description p {
    margin: 0 0 10px 0;
}

.rfd-item-description p:last-child {
    margin-bottom: 0;
}

.rfd-item-description a {
    color: #0073aa;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s ease;
}

.rfd-item-description a:hover {
    border-bottom-color: #0073aa;
}

/* Item Footer */
.rfd-item-footer {
    margin-top: auto;
    padding-top: 10px;
}

.rfd-read-more {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    font-weight: 600;
    color: #0073aa;
    text-decoration: none;
    transition: gap 0.3s ease;
}

.rfd-read-more:hover {
    gap: 8px;
    color: #005177;
}

/* Error Message */
.rfd-error {
    padding: 15px 20px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    color: #856404;
    font-size: 15px;
}

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

.rfd-loading::before {
    content: "";
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    animation: rfd-spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes rfd-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .rfd-feed-item:has(.rfd-item-image) {
        grid-template-columns: 1fr;
    }
    
    .rfd-item-image {
        max-width: 100%;
    }
    
    .rfd-feed-title {
        font-size: 24px;
    }
    
    .rfd-item-title {
        font-size: 20px;
    }
    
    .rfd-feed-item {
        padding: 20px;
    }
}

@media screen and (max-width: 480px) {
    .rfd-feed-container {
        margin: 15px 0;
    }
    
    .rfd-feed-items {
        gap: 20px;
    }
    
    .rfd-feed-item {
        padding: 15px;
        gap: 15px;
    }
    
    .rfd-feed-title {
        font-size: 22px;
    }
    
    .rfd-item-title {
        font-size: 18px;
    }
    
    .rfd-item-description {
        font-size: 14px;
    }
}

/* Print Styles */
@media print {
    .rfd-feed-item {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .rfd-read-more {
        display: none;
    }
    
    .rfd-item-image img {
        max-height: 200px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .rfd-feed-container {
        color: #e0e0e0;
    }
    
    .rfd-feed-header {
        border-bottom-color: #444;
    }
    
    .rfd-feed-title,
    .rfd-item-title {
        color: #f0f0f0;
    }
    
    .rfd-feed-description,
    .rfd-item-description {
        color: #ccc;
    }
    
    .rfd-feed-item {
        background: #2a2a2a;
        border-color: #444;
    }
    
    .rfd-feed-item:hover {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
    
    .rfd-item-image {
        background: #1a1a1a;
    }
    
    .rfd-item-meta {
        color: #aaa;
    }
    
    .rfd-item-author {
        color: #bbb;
    }
    
    .rfd-item-date {
        color: #999;
    }
    
    .rfd-read-more {
        color: #4a9eff;
    }
    
    .rfd-read-more:hover {
        color: #6bb0ff;
    }
    
    .rfd-error {
        background: #3a3a2a;
        border-color: #665500;
        color: #ffeb3b;
    }
}

/* Accessibility */
.rfd-feed-item:focus-within {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.rfd-item-title a:focus,
.rfd-read-more:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
    border-radius: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .rfd-feed-item {
        border-width: 2px;
    }
    
    .rfd-item-title a,
    .rfd-read-more {
        text-decoration: underline;
    }
}