/* ================================================
   Briefing — Modern Feed Reader
   Matching chat app color scheme (#667eea / #764ba2)
   Consistent border-radius: 10px (elements), 14px (cards)
   ================================================ */

/* Override app.css body lock for feed page */
body:has(.feed-app),
html:has(.feed-app) {
    position: static !important;
    overflow: auto !important;
    height: auto !important;
    background: #f8f9fb !important;
}

/* ---- Base ---- */
.feed-app {
    min-height: 100vh;
    background: #f8f9fb;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: #1a1a2e;
    -webkit-font-smoothing: antialiased;
}

/* ---- Header ---- */
.feed-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(102, 126, 234, 0.08);
}

.feed-header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.feed-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
}

.feed-logo {
    flex-shrink: 0;
}

.feed-brand-name {
    font-size: 20px;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

/* ---- Nav ---- */
.feed-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.feed-status-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

.feed-user-status {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.03);
    transition: all 0.2s ease;
}

.feed-user-active {
    background: rgba(102, 126, 234, 0.08);
}

.feed-status-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #b0b8c9;
    transition: color 0.2s ease;
}

.feed-user-active .feed-status-icon {
    color: #667eea;
}

.feed-pulse-dot {
    position: absolute;
    top: -2px;
    right: -3px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #667eea;
    border: 1.5px solid #fff;
    animation: feed-pulse 2s ease infinite;
}

@keyframes feed-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

.feed-last-seen {
    font-size: 10px;
    font-weight: 600;
    color: #8b95a8;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.feed-user-active .feed-last-seen {
    color: #667eea;
}

.feed-login-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: none;
    border: 1.5px solid #e2e6ed;
    border-radius: 10px;
    color: #8b95a8;
    cursor: pointer;
    transition: all 0.2s ease;
}

.feed-login-toggle:hover {
    background: rgba(102, 126, 234, 0.06);
    border-color: rgba(102, 126, 234, 0.3);
    color: #667eea;
}

.feed-login-toggle-active {
    background: linear-gradient(135deg, #667eea, #764ba2) !important;
    border-color: transparent !important;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.35);
}

/* ---- Main ---- */
.feed-main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 28px 24px 0;
}

/* ---- Login Panel ---- */
.feed-login-panel {
    margin-bottom: 28px;
    animation: feed-slide-down 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes feed-slide-down {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}

.feed-login-card {
    background: #fff;
    border: 1px solid rgba(102, 126, 234, 0.1);
    border-radius: 14px;
    padding: 28px 32px;
    max-width: 380px;
    box-shadow: 0 1px 3px rgba(102, 126, 234, 0.06), 0 8px 24px rgba(102, 126, 234, 0.04);
}

.feed-login-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 4px;
}

.feed-login-header p {
    font-size: 13px;
    color: #8b95a8;
    margin: 0 0 22px;
}

.feed-login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.feed-input-group {
    position: relative;
    display: flex;
    align-items: center;
}

.feed-input-icon {
    position: absolute;
    left: 12px;
    color: #b0b8c9;
    pointer-events: none;
    transition: color 0.2s ease;
}

.feed-input-group:focus-within .feed-input-icon {
    color: #667eea;
}

.feed-input {
    width: 100%;
    padding: 11px 14px 11px 38px;
    border: 1.5px solid #e2e6ed;
    border-radius: 10px;
    font-size: 14px;
    background: #f8f9fb;
    outline: none;
    transition: all 0.2s ease;
    box-sizing: border-box;
    color: #1a1a2e;
}

.feed-input:focus {
    border-color: #667eea;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.feed-input::placeholder {
    color: #b0b8c9;
}

.feed-submit-btn {
    width: 100%;
    padding: 11px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 4px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.25);
}

.feed-submit-btn:hover {
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
    transform: translateY(-1px);
}

.feed-submit-btn:active {
    transform: translateY(0);
}

.feed-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.feed-btn-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: feed-spin 0.6s linear infinite;
}

.feed-login-error {
    color: #e74c3c;
    font-size: 13px;
    margin-top: 10px;
    font-weight: 500;
    padding: 8px 12px;
    background: rgba(231, 76, 60, 0.06);
    border-radius: 10px;
}

/* ---- Content ---- */
.feed-content {
    padding-bottom: 40px;
}

/* ---- Hero Article ---- */
.feed-hero {
    display: block;
    text-decoration: none;
    color: inherit;
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(102, 126, 234, 0.06);
    margin-bottom: 28px;
    transition: box-shadow 0.25s ease, transform 0.25s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.feed-hero:hover {
    box-shadow: 0 12px 40px rgba(102, 126, 234, 0.12);
    transform: translateY(-3px);
}

.feed-hero-image {
    width: 100%;
    height: 360px;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea20 0%, #764ba220 100%);
    position: relative;
}

.feed-hero-image::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.03));
    pointer-events: none;
}

.feed-hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.feed-hero:hover .feed-hero-image img {
    transform: scale(1.03);
}

.feed-hero-body {
    padding: 24px 28px 28px;
}

.feed-hero-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.feed-tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #fff;
    background: linear-gradient(135deg, #667eea, #764ba2);
    padding: 4px 12px;
    border-radius: 6px;
}

.feed-hero-title {
    font-size: 24px;
    font-weight: 800;
    line-height: 1.3;
    color: #1a1a2e;
    margin: 0 0 10px;
    letter-spacing: -0.3px;
}

.feed-hero-summary {
    font-size: 15px;
    color: #6b7280;
    line-height: 1.65;
    margin: 0 0 16px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.feed-time {
    font-size: 12px;
    color: #9ca3af;
    font-weight: 500;
}

.feed-read-more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #667eea;
    transition: gap 0.2s ease;
}

.feed-hero:hover .feed-read-more {
    gap: 10px;
}

/* ---- Card Grid ---- */
.feed-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.feed-card {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    background: #fff;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(102, 126, 234, 0.06);
    transition: box-shadow 0.25s ease, transform 0.25s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.feed-card:hover {
    box-shadow: 0 8px 28px rgba(102, 126, 234, 0.1);
    transform: translateY(-3px);
}

.feed-card-image {
    width: 100%;
    height: 170px;
    overflow: hidden;
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    flex-shrink: 0;
}

.feed-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.feed-card:hover .feed-card-image img {
    transform: scale(1.04);
}

.feed-card-body {
    padding: 16px 18px 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.feed-card-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
    color: #1a1a2e;
    margin: 6px 0 8px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    letter-spacing: -0.2px;
}

.feed-card-summary {
    font-size: 13px;
    color: #8b95a8;
    line-height: 1.55;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex: 1;
}

/* ---- Image fallback ---- */
.feed-img-fallback {
    display: none !important;
}

/* ---- Sentinel / Loading ---- */
.feed-sentinel {
    display: flex;
    justify-content: center;
    padding: 40px 0 20px;
}

.feed-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
}

.feed-loading-spinner {
    width: 28px;
    height: 28px;
    border: 2.5px solid rgba(102, 126, 234, 0.15);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: feed-spin 0.7s linear infinite;
}

@keyframes feed-spin {
    to { transform: rotate(360deg); }
}

/* ---- Empty State ---- */
.feed-empty {
    text-align: center;
    padding: 80px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.feed-empty p {
    color: #6b7280;
    font-size: 16px;
    font-weight: 600;
    margin: 8px 0 0;
}

.feed-empty span {
    color: #9ca3af;
    font-size: 14px;
}

.feed-empty svg {
    color: #667eea;
}

/* ---- Footer ---- */
.feed-footer {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    color: #b0b8c9;
    border-top: 1px solid rgba(102, 126, 234, 0.06);
}

.feed-footer-brand {
    font-weight: 700;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.feed-footer-sep {
    color: #d5dce4;
}

/* ---- Page Loading ---- */
.feed-page-loading {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fb;
}

/* ================================================
   Responsive
   ================================================ */
@media (max-width: 900px) {
    .feed-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .feed-hero-image {
        height: 260px;
    }

    .feed-hero-title {
        font-size: 20px;
    }
}

@media (max-width: 600px) {
    .feed-header-inner {
        padding: 0 16px;
        height: 52px;
    }

    .feed-main {
        padding: 16px 16px 0;
    }

    .feed-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .feed-hero {
        border-radius: 12px;
        margin-bottom: 18px;
    }

    .feed-hero-image {
        height: 200px;
    }

    .feed-hero-body {
        padding: 18px 20px 22px;
    }

    .feed-hero-title {
        font-size: 18px;
    }

    .feed-hero-summary {
        font-size: 14px;
        -webkit-line-clamp: 2;
    }

    .feed-card {
        border-radius: 12px;
    }

    .feed-card-image {
        height: 180px;
    }

    .feed-card-body {
        padding: 14px 16px 16px;
    }

    .feed-card-title {
        font-size: 14px;
    }

    .feed-login-card {
        padding: 22px 20px;
        border-radius: 12px;
    }

    .feed-brand-name {
        font-size: 17px;
    }

    .feed-status-group {
        gap: 4px;
    }

    .feed-user-status {
        padding: 3px 6px;
    }

    .feed-last-seen {
        font-size: 9px;
    }
}

/* ---- Biometric authentication UI ---- */
.feed-biometric-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0 0;
    color: #94a3b8;
    font-size: 12px;
}

.feed-biometric-divider::before,
.feed-biometric-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
}

button.feed-biometric-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    margin-top: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: #fff;
    border: 2px solid #667eea;
    border-radius: 10px;
    color: #667eea;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
}

button.feed-biometric-btn:hover:not(:disabled) {
    background: #667eea;
    border-color: #667eea;
    color: #fff;
}

button.feed-biometric-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.feed-biometric-suggestion {
    padding: 14px;
    background: rgba(102, 126, 234, 0.12);
    border: 1px solid rgba(102, 126, 234, 0.25);
    border-radius: 12px;
    margin-bottom: 12px;
}

.feed-biometric-suggestion-row {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #c7d2fe;
    font-size: 13px;
    font-weight: 500;
}

.feed-biometric-suggestion-row svg {
    flex-shrink: 0;
    color: #818cf8;
}

.feed-suggestion-dismiss {
    margin-left: auto;
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
}

.feed-suggestion-dismiss:hover { color: #e2e8f0; }

.feed-biometric-suggestion-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.feed-biometric-btn-sm {
    flex: 1;
    padding: 7px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    background: #6366f1;
    color: #fff;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.feed-biometric-btn-sm:hover:not(:disabled) { background: #4f46e5; }
.feed-biometric-btn-sm:disabled { opacity: 0.6; cursor: not-allowed; }

.feed-biometric-btn-ghost {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
}

.feed-biometric-btn-ghost:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

/* Reminder story cards */
.feed-tag-reminder {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.feed-hero-reminder {
    cursor: default;
    border: 2px solid rgba(245, 158, 11, 0.3);
}

.feed-hero-reminder:hover {
    transform: none;
    box-shadow: 0 2px 20px rgba(245, 158, 11, 0.15);
}

.feed-hero-reminder .feed-hero-image {
    height: 120px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.feed-hero-reminder .feed-hero-image img {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.feed-card-reminder {
    cursor: default;
    border: 2px solid rgba(245, 158, 11, 0.3);
}

.feed-card-reminder:hover {
    transform: none;
    box-shadow: 0 2px 12px rgba(245, 158, 11, 0.15);
}

.feed-card-reminder .feed-card-image {
    height: 80px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.feed-card-reminder .feed-card-image img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}
