html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    height: 100vh;
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-family: sans-serif;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

#feeds-main {
    display: flex;
    height: calc(100vh - 56px);
    background: #fafbfc;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    min-height: 0;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

.feed-row-flex {
    display: flex;
    align-items: center;
    gap: 0.5em;
    margin-bottom: 4px;
}

.feed-favicon {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    vertical-align: middle;
    border-radius: 3px;
    object-fit: contain;
    background: #f5f5f5;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.07);
}

.saved-badge,
.unread-badge {
    background: #43a047;
    color: #fff;
    border-radius: 1em;
    padding: 0.1em 0.7em 0.1em 0.7em;
    font-size: 0.85em;
    margin-left: 0.5em;
    margin-right: 0.2em;
    display: inline-block;
    min-width: 1em;
    text-align: center;
    font-weight: bold;
    box-shadow: 0 1px 4px rgba(67, 160, 71, 0.15);
}

.saved-badge {
    background: #2b7a78;
}

.article-title.current-viewed {
    background: #d6f5d6 !important;
    color: #256029 !important;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.13);
    opacity: 1 !important;
    /* Always override read/unread backgrounds */
}

/* Article meta info under title */
.article-meta {
    margin-bottom: 1em;
    padding-left: 1em;
    color: #444;
    font-size: 1em;
    line-height: 1.4;
}

.article-feed-name {
    font-weight: bold;
    color: #256029;
    margin-bottom: 0.2em;
}

.article-pub-date {
    color: #666;
    font-size: 0.97em;
    margin-bottom: 0.2em;
}

.article-content-inner img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 1em auto;
}

.article-content-inner svg {
    max-width: 100%;
    height: auto;
    max-height: 1.5em;
    width: auto;
    display: inline-block;
    vertical-align: middle;
}

.article-content-inner iframe {
    max-width: 100%;
    display: block;
    margin: 1em auto;
}

.article-content-inner {
    max-width: 60rem;

    margin: 0 auto;
    box-sizing: border-box;
}

#article-content>h2 {
    padding-left: 1em !important;
    padding-right: 1em !important;
    margin: 0.83em 0 0.83em 0 !important;
}

#article-content> :not(#article-actions-bar) {
    padding-left: 2em;
    padding-right: 2em;
}

#article-actions-bar {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.97);
    z-index: 10;
    padding: 0.75em 0.5em 0.5em 0.5em;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5em;
    align-items: flex-start;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-bottom: 1px solid #e0e0e0;
    backdrop-filter: blur(2px);
}

#article-actions-buttons {
    display: contents;
}

#article-actions-meta {
    display: flex;
    gap: 0.5em;
    align-items: center;
    flex-wrap: wrap;
    flex: 1 1 auto;
    min-width: 0;
}

#article-integration-buttons {
    margin-left: auto;
    display: flex;
    gap: 0.5em;
    align-items: center;
}

#article-actions-bar button {
    margin-right: 0;
}

.article-title.saved {
    border-left: 4px solid #4caf50;
    background-color: #e8f5e9;
}

#article-actions-bar .save-btn.saved {
    background-color: #4caf50;
    color: #fff;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);
}

#feeds-col {
    background: #f5f7fa;
    width: 270px;
    min-width: 140px;
    max-width: 270px;
    border-right: 1px solid #ccc;
    overflow-y: auto;
    padding: 1em 0.5em 1em 1em;
    white-space: nowrap;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

.feed-category {
    font-weight: bold;
    margin-top: 1em;
    margin-bottom: 0.3em;
    color: #1976d2;
    font-size: 1.08em;
    letter-spacing: 0.01em;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

.feed-title {
    width: 163px;
    padding: 0.35em 0.7em;
    cursor: pointer;
    border-radius: 6px;
    margin-bottom: 0;
    margin-top: 0;
    flex: 0 1 auto;
    max-width: 70%;
    display: flex;
    align-items: center;
    transition: background 0.15s, box-shadow 0.15s;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    line-height: 1.4;
    font-size: .75rem;
}

.feed-title.selected,
.feed-title:hover {
    background: #e3f2fd;
    color: #1565c0;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.10);
}

#articles-col {
    background: #f9f9fb;
    width: 270px;
    min-width: 180px;
    max-width: 270px;
    border-right: 1px solid #ccc;
    overflow-y: auto;
    padding: 1em 0.5em 1em 1em;
    word-break: break-word;
    white-space: normal;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

.article-title {
    padding: 0.35em 0.7em;
    cursor: pointer;
    border-radius: 6px;
    margin-bottom: 6px;
    margin-top: 2px;
    transition: background 0.15s, box-shadow 0.15s;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    font-weight: 500;
    word-break: break-word;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    /* Prevent touch highlighting that could trigger reflow */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    /* Ensure consistent line height to prevent layout shifts */
    line-height: 1.4;
    font-size: 1rem;
}

.article-title.selected,
.article-title:hover {
    background: #c8e6c9;
    color: #256029;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.10);
}

.article-title.read {
    opacity: 0.7;
    background: #f0f0f0;
    color: #222;
    font-style: italic;
}

.article-title.unread {
    color: #222;
    background: #fffbe7;
}

#article-content {
    background: #fff;
    border-radius: 6px;
    min-height: 200px;
    flex: 1;
    overflow-y: auto;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

#feeds-list {
    max-width: 700px;
    margin: 2em auto;
}

/* Mobile responsive styles */
@media (max-width: 768px) {
    body {
        overflow: visible !important;
    }
    
    #feeds-main {
        flex-direction: column;
        height: calc(100vh - 56px);
    }

    #feeds-col,
    #articles-col,
    #article-content {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 100% !important;
        border-right: none;
        border-bottom: 1px solid #ccc;
        display: none;
    }

    /* Show only one column at a time */
    #feeds-col.mobile-active,
    #articles-col.mobile-active,
    #article-content.mobile-active {
        display: block;
        height: calc(100vh - 56px);
        overflow-y: auto;
    }

    /* Show feeds column by default */
    #feeds-col {
        display: block;
    }

    .feed-title {
        width: auto;
        max-width: 100%;
    }

    #article-content> :not(#article-actions-bar) {
        padding-left: 1em;
        padding-right: 1em;
    }

    #article-actions-bar {
        flex-wrap: wrap;
        padding: 0.5em;
    }

    #article-actions-bar button {
        margin-right: 0;
        margin-bottom: 0.3em;
        font-size: 0.9em;
        padding: 0.4em 1.7em;
    }

    .mobile-back-btn {
        background: #1976d2;
        color: white;
        border: none;
        padding: 1em 1.5em;
        border-radius: 8px;
        font-size: 1.1em;
        cursor: pointer;
        font-weight: 600;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        min-height: 48px;
        width: auto;
        display: inline-block;
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }

    .mobile-back-btn:active {
        background: #1565c0;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    }

    /* Additional mobile-specific fixes for layout stability */
    .article-title {
        /* Prevent any font size changes on mobile */
        font-size: 24px !important;
    }

    .feed-title {
        width: 100%;
        max-width: 70%;
        font-size: 24px !important;
        padding: 0.75em 1em;
        min-height: 48px;
    }

    .feed-row-flex {
        width: 100%;
    }

    .feed-favicon {
        width: 20px;
        height: 20px;
        margin-right: 10px;
    }

    .feed-category {
        font-size: 1.2em;
        margin-top: 1.2em;
    }

    .unread-badge,
    .saved-badge {
        font-size: 0.95em;
        padding: 0.2em 0.8em;
    }
    
    /* Navigation buttons for article switching (mobile only) */
    .article-nav-button {
        position: fixed !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        width: 48px !important;
        height: 48px !important;
        border-radius: 50% !important;
        background: rgba(102, 126, 234, 0.9) !important;
        color: white !important;
        border: none !important;
        font-size: 1.5em !important;
        cursor: pointer !important;
        z-index: 9999 !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
        align-items: center !important;
        justify-content: center !important;
        transition: all 0.2s !important;
        -webkit-tap-highlight-color: transparent !important;
        touch-action: manipulation !important;
    }

    .article-nav-button:active {
        background: rgba(102, 126, 234, 1) !important;
        transform: translateY(-50%) scale(0.95) !important;
    }

    .article-nav-button:disabled {
        opacity: 0.3 !important;
        cursor: not-allowed !important;
    }

    .article-nav-button.prev {
        left: 10px !important;
        right: auto !important;
    }

    .article-nav-button.next {
        right: 10px !important;
        left: auto !important;
    }
}