/* ============================================================
   SRRU News Feed — Frontend Styles v2.1
   ============================================================ */

:root {
    --srru-primary:   #1a56a0;
    --srru-accent:    #e8f0fb;
    --srru-border:    #e2e8f0;
    --srru-text:      #1e293b;
    --srru-muted:     #64748b;
    --srru-radius:    10px;
    --srru-shadow:    0 2px 12px rgba(0,0,0,.08);
    --srru-shadow-hv: 0 6px 24px rgba(0,0,0,.14);
    --srru-img-ratio: 56.25%; /* 16:9 */
}

.srru-news-feed { font-family: inherit; box-sizing: border-box; }
.srru-news-feed *, .srru-news-feed *::before, .srru-news-feed *::after { box-sizing: inherit; }

/* ── Empty state ── */
.srru-news-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--srru-muted);
    font-style: italic;
}

/* ============================================================
   LIST layout
   ============================================================ */
.srru-news-feed.layout-list .srru-news-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
}

.srru-news-feed.layout-list .srru-news-item {
    display: flex;
    gap: 14px;
    padding: 14px 8px;
    border-bottom: 1px solid var(--srru-border);
    border-radius: 6px;
    transition: background .15s, padding-left .15s;
}
.srru-news-feed.layout-list .srru-news-item:last-child { border-bottom: none; }
.srru-news-feed.layout-list .srru-news-item:hover {
    background: var(--srru-accent);
    padding-left: 14px;
}

.srru-news-feed.layout-list .srru-news-thumb {
    flex-shrink: 0;
    width: 110px;
    height: 76px;
    border-radius: 8px;
    overflow: hidden;
    display: block;
}
.srru-news-feed.layout-list .srru-news-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s;
}
.srru-news-feed.layout-list .srru-news-item:hover .srru-news-thumb img { transform: scale(1.05); }

.srru-news-feed.layout-list .srru-news-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.srru-news-feed.layout-list .srru-news-title {
    font-size: .95rem;
    font-weight: 600;
    line-height: 1.45;
    color: var(--srru-text);
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color .15s;
}
.srru-news-feed.layout-list .srru-news-title:hover { color: var(--srru-primary); }

.srru-news-feed.layout-list .srru-news-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ============================================================
   GRID layout
   ============================================================ */
.srru-news-feed.layout-grid .srru-news-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
}

.srru-news-feed.layout-grid .srru-news-item {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: var(--srru-radius);
    box-shadow: var(--srru-shadow);
    overflow: hidden;
    transition: box-shadow .2s, transform .2s;
}
.srru-news-feed.layout-grid .srru-news-item:hover {
    box-shadow: var(--srru-shadow-hv);
    transform: translateY(-3px);
}

.srru-news-feed.layout-grid .srru-news-thumb {
    display: block;
    width: 100%;
    padding-top: var(--srru-img-ratio);
    position: relative;
    overflow: hidden;
    background: #f1f5f9;
}
.srru-news-feed.layout-grid .srru-news-thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .35s;
}
.srru-news-feed.layout-grid .srru-news-item:hover .srru-news-thumb img { transform: scale(1.06); }

/* placeholder — SVG newspaper icon via background-image */
.srru-news-feed.layout-grid .srru-news-thumb-placeholder {
    display: block;
    width: 100%;
    padding-top: var(--srru-img-ratio);
    background: linear-gradient(135deg, #e8f0fb 0%, #c7d9f5 100%);
    position: relative;
}
.srru-news-feed.layout-grid .srru-news-thumb-placeholder::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231a56a0' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2Zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2'/%3E%3Cpath d='M18 14h-8M15 18h-5M10 6h8v4h-8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 40px 40px;
    opacity: .35;
}

.srru-news-feed.layout-grid .srru-news-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 16px 16px;
    flex: 1;
}

.srru-news-feed.layout-grid .srru-news-title {
    font-size: .9rem;
    font-weight: 600;
    line-height: 1.5;
    color: var(--srru-text);
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color .15s;
    flex: 1;
}
.srru-news-feed.layout-grid .srru-news-title:hover { color: var(--srru-primary); }

.srru-news-feed.layout-grid .srru-news-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: auto;
}

/* ── Shared meta elements ── */
.srru-news-date {
    font-size: .75rem;
    color: var(--srru-muted);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
/* SVG calendar icon inline via mask */
.srru-news-date::before {
    content: "";
    display: inline-block;
    width: 13px;
    height: 13px;
    background-color: var(--srru-muted);
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-size: contain;
    mask-size: contain;
    flex-shrink: 0;
}

.srru-news-category {
    font-size: .7rem;
    font-weight: 600;
    color: var(--srru-primary);
    background: var(--srru-accent);
    padding: 2px 8px;
    border-radius: 20px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

/* "อ่านต่อ" link with SVG arrow */
.srru-news-read-more {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: .78rem;
    font-weight: 600;
    color: var(--srru-primary);
    text-decoration: none;
    margin-top: 4px;
    transition: gap .15s;
}
.srru-news-read-more:hover { gap: 8px; }
.srru-news-read-more::after {
    content: "";
    display: inline-block;
    width: 14px;
    height: 14px;
    background-color: var(--srru-primary);
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='5' y1='12' x2='19' y2='12'/%3E%3Cpolyline points='12 5 19 12 12 19'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='5' y1='12' x2='19' y2='12'/%3E%3Cpolyline points='12 5 19 12 12 19'/%3E%3C/svg%3E");
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-size: contain;
    mask-size: contain;
    flex-shrink: 0;
    transition: transform .15s;
}
.srru-news-read-more:hover::after { transform: translateX(2px); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 600px) {
    .srru-news-feed.layout-grid .srru-news-list {
        grid-template-columns: 1fr;
    }
    .srru-news-feed.layout-list .srru-news-thumb {
        width: 80px;
        height: 60px;
    }
    .srru-news-feed.layout-list .srru-news-title { font-size: .88rem; }
}

@media (min-width: 601px) and (max-width: 900px) {
    .srru-news-feed.layout-grid .srru-news-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Loading state */
.srru-news-loading {
    color: var(--srru-muted);
    font-size: .9rem;
    padding: 20px 0;
    text-align: center;
    animation: srru-pulse 1.4s ease-in-out infinite;
}
@keyframes srru-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: .4; }
}
