/* ==========================================================================
   Newsknit RSS Core Styles (Inheriting Theme Typography)
   ========================================================================= */

.csrkk-wrapper-block {
    width: 100%;
    margin: 20px auto;
    font-family: inherit; /* Natively inherits your theme's exact font family set */
    transition: opacity 0.25s ease-in-out;
}

/* Base Card Grid Architecture */
.csrkk-feed-container {
    display: grid;
    gap: 20px;
    margin-bottom: 30px;
}

.csrkk-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    display: flex;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.csrkk-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Image Wrappers */
.csrkk-thumb-wrapper {
    position: relative;
    overflow: hidden;
    background-color: #f7fafc;
    flex-shrink: 0;
}

.csrkk-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Content Frame */
.csrkk-content {
    padding: 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
}

.csrkk-content h3 {
    margin: 0 0 8px 0;
    font-size: 1.1rem;
    line-height: 1.4;
    font-family: inherit; /* Natively inherits theme heading fonts */
}

.csrkk-content h3 a {
    color: #1a202c;
    text-decoration: none;
    transition: color 0.15s ease;
}

.csrkk-content h3 a:hover {
    color: #3182ce;
}

.csrkk-content small {
    color: #718096;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: inherit;
}

.csrkk-excerpt {
    margin: 8px 0 0;
    color: #4a5568;
    font-size: 0.9rem;
    line-height: 1.5;
    font-family: inherit;
}

/* ==========================================================================
   Source Filter Chips
   ========================================================================= */
.csrkk-source-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.csrkk-source-filter-btn {
    border: 1px solid #cbd5e0;
    background: #ffffff;
    color: #4a5568;
    border-radius: 999px;
    padding: 5px 14px;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
}

.csrkk-source-filter-btn:hover {
    border-color: #4a5568;
}

.csrkk-source-filter-btn.active {
    background: #3182ce;
    border-color: #3182ce;
    color: #ffffff;
}

/* ==========================================================================
   Layout Style Modifier Classes
   ========================================================================= */

/* Traditional Rows (List View) */
.csrkk-layout-list {
    grid-template-columns: 1fr;
}

.csrkk-layout-list .csrkk-card {
    flex-direction: row;
}

.csrkk-layout-list .csrkk-thumb-wrapper {
    width: 200px;
    height: 130px;
}

/* Modern Response Columns (Card Grid View) */
.csrkk-layout-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.csrkk-layout-grid .csrkk-card {
    flex-direction: column;
}

.csrkk-layout-grid .csrkk-thumb-wrapper {
    width: 100%;
    height: 180px;
}

/* ==========================================================================
   Asynchronous Pagination Interface
   ========================================================================= */
.csrkk-pagination-ajax {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
}

.csrkk-pagination-ajax a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 35px;
    height: 35px;
    padding: 0 6px;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    color: #4a5568;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    background: #ffffff;
    font-family: inherit;
    transition: all 0.2s ease;
}

.csrkk-pagination-ajax a:hover {
    border-color: #4a5568;
    background: #f7fafc;
}

.csrkk-pagination-ajax a.active {
    background: #3182ce;
    color: #ffffff;
    border-color: #3182ce;
    cursor: default;
}

/* Responsive Overrides */
@media (max-width: 640px) {
    .csrkk-layout-list .csrkk-card {
        flex-direction: column;
    }
    .csrkk-layout-list .csrkk-thumb-wrapper {
        width: 100%;
        height: 180px;
    }
}

/* ==========================================================================
   Responsive Pagination Constraints (Mobiles & Tablets)
   ========================================================================= */
@media (max-width: 1024px) {
    /* Step 1: Hide all numeric page elements by default on small screens */
    .csrkk-pagination-ajax a.csrkk-page-num,
    .csrkk-pagination-ajax a:not([class*="prev"]):not([class*="next"]):not([class*="first"]):not([class*="last"]) {
        display: none;
    }

    /* Step 2: Explicitly show only the first 3 numeric items */
    .csrkk-pagination-ajax a.csrkk-page-num:nth-of-type(-n+3),
    .csrkk-pagination-ajax a:not([class*="prev"]):not([class*="next"]):not([class*="first"]):not([class*="last"]):nth-of-type(-n+3) {
        display: inline-flex;
    }
}

/* ==========================================================================
   Load More Button Styles (Mobile)
   ========================================================================= */
.csrkk-load-more-wrapper {
    display: block;
    text-align: center;
    margin-top: 25px;
    padding: 10px 0;
    width: 100%;
}

.csrkk-load-more-btn {
    background: #3182ce;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 12px 28px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    box-shadow: 0 2px 4px rgba(49, 130, 206, 0.3);
    display: inline-block;
}

.csrkk-load-more-btn:hover:not(:disabled) {
    background: #2b6cb0;
    box-shadow: 0 4px 6px rgba(49, 130, 206, 0.4);
    transform: translateY(-1px);
}

.csrkk-load-more-btn:active:not(:disabled) {
    transform: translateY(0);
}

.csrkk-load-more-btn:disabled {
    background: #a0aec0;
    cursor: not-allowed;
    opacity: 0.7;
}

.csrkk-no-more-articles {
    color: #718096;
    font-size: 0.9rem;
    font-style: italic;
    margin: 0;
    padding: 10px 0;
}

/* Infinite scroll: the button doubles as the scroll-trigger sentinel,
   so its disabled/loading state reads as a quiet inline spinner
   rather than a button the user needs to tap. */
.csrkk-load-more-btn:disabled {
    position: relative;
    color: transparent;
}

.csrkk-load-more-btn:disabled::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: csrkk-spin 0.6s linear infinite;
}

@keyframes csrkk-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   Feed Group Admin UI (admin-settings.php)
   ========================================================================= */

.csrkk-feed-group {
    transition: box-shadow 0.2s ease;
}

.csrkk-feed-group:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.csrkk-feed-group .form-table th {
    padding-top: 12px;
    padding-bottom: 12px;
    font-weight: 600;
}

.csrkk-feed-group .form-table td {
    padding-top: 12px;
    padding-bottom: 12px;
}

.csrkk-shortcode-preview {
    display: inline-block;
    font-size: 0.95rem;
}

#csrkk-add-group-btn {
    font-size: 0.95rem;
    padding: 6px 16px;
    height: auto;
}

.csrkk-remove-group-btn {
    font-size: 0.8rem;
    color: #dc3232 !important;
    text-decoration: none !important;
    border: 1px solid #dc3232 !important;
    border-radius: 3px !important;
    padding: 2px 8px !important;
    background: transparent !important;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.csrkk-remove-group-btn:hover {
    background: #dc3232 !important;
    color: #fff !important;
}
