/* News date on the right in detail-header */
.news-date {
    margin-left: auto;
    color: #888;
    font-size: 13px;
    float: none;
    padding-left: 10px;
    padding-right: 16px;
}

/* Main variables */
:root {
    --color-primary: #15c;
    --color-text: #333;
    --color-gray: #777;
    --bg-header: #f8f8f8;
    --bg-active: #e0e0e0;
    --border-color: #e7e7e7;
    --sidebar-width: 400px;
    --button-size: 34px;
}

/* Reset styles and base settings */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: #f5f5f5;
    color: var(--color-text);
    overflow: hidden;
}

/* Header */
.header {
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    padding: 10px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.logo {
    font-weight: bold;
    color: var(--color-primary);
    font-size: clamp(18px, 4vw, 20px);
    margin-right: 15px;
}

.search-box {
    flex-grow: 1;
    min-width: 150px;
}

.search-box input {
    width: 100%;
    max-width: 400px;
    padding: 5px;
    border: 1px solid #d9d9d9;
    border-radius: 2px;
}

/* Mobile menu button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    margin-left: 10px;
    padding: 5px;
}

@media (max-width: 767px) {
    .mobile-menu-btn {
        display: block;
    }
}

/* Main container */
.container {
    display: flex;
    height: calc(100vh - 50px);
}

/* Left panel (subscriptions) */
.sidebar {
    width: var(--sidebar-width);
    min-width: 180px;
    max-width: 600px;
    background: #fff;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    position: relative;
    overflow: hidden;
}

@media (max-width: 767px) {
    .sidebar {
        position: fixed;
        top: 50px;
        left: 0;
        bottom: 0;
        z-index: 100;
        transform: translateX(-100%);
        width: var(--sidebar-width);
        min-width: var(--sidebar-width);
        max-width: var(--sidebar-width);
    }
    .sidebar.visible {
        transform: translateX(0);
    }
}

.sidebar-content {
    width: 100%;
    min-width: 0;
    flex-grow: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.sidebar-toolbar {
    padding: 8px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 8px;
    background: var(--bg-header);
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-button {
    width: var(--button-size);
    height: var(--button-size);
    padding: 0;
    background: #fff;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.sidebar-button:hover {
    background: #f0f0f0;
}

.sidebar-button i {
    font-size: 16px;
    color: #555;
}

/* Subscriptions container */
.subscriptions-wrapper {
    flex-grow: 1;
    overflow-y: auto;
    padding: 10px;
    scrollbar-width: thin;
}

.subscriptions-wrapper::-webkit-scrollbar {
    width: 6px;
}
.subscriptions-wrapper::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}
.subscriptions-wrapper::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}
.subscriptions-wrapper::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Overlay for mobile menu */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 50px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}
@media (max-width: 767px) {
    .sidebar-overlay.visible {
        display: block;
    }
}

/* Folders and subscriptions */
.folder {
    margin-bottom: 10px;
}
.folder-header {
    display: flex;
    align-items: center;
    padding: 8px 0;
    font-weight: bold;
    color: var(--color-text);
    cursor: pointer;
    position: relative;
}
.folder-name {
    flex-grow: 1;
    padding-right: 60px;
    font-size: clamp(14px, 3vw, 16px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.folder-icon {
    cursor: pointer;
    margin-right: 8px;
    transition: transform 0.2s;
    user-select: none;
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}
.folder-icon.collapsed {
    transform: rotate(-90deg);
}
.subscription-list {
    padding-left: 15px;
    overflow: hidden;
}
.subscription-item-wrapper {
    display: flex;
    align-items: center;
    position: relative;
    padding-right: 22px;
    background: transparent;
    gap: 2px; /* уменьшенное расстояние между иконкой и subscription-item */
}
.subscription-item {
    flex: 1 1 auto;
    min-width: 0;
    border-radius: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 8px 8px;
    font-size: clamp(13px, 3vw, 14px);
    cursor: pointer;
}
.context-button {
    margin-left: 8px;
    font-size: 16px;
    cursor: pointer;
    user-select: none;
    opacity: 0;
    transition: opacity 0.2s;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
}
.subscription-item-wrapper:hover .context-button,
.subscription-item-wrapper:focus-within .context-button {
    opacity: 1;
}
.item-counter {
    margin-left: 8px;
    font-size: 11px;
    color: var(--color-gray);
}
.folder-header:hover .context-button,
.subscription-item:hover .context-button {
    opacity: 1;
}
.folder-header.active,
.subscription-item.active {
    background-color: var(--bg-active);
    border-radius: 6px;
    padding-left: 8px 0;
    padding-right: 8px;
    width: 100%;
    box-sizing: border-box;
}
.folder-header:hover,
.subscription-item:hover {
    background: #f0f0f0;
}

/* Center panel (articles) */
.content {
    flex-grow: 1;
    overflow-y: auto;
    background: #fff;
    padding: 10px;
}
.article {
    border-bottom: 1px solid #eee;
    padding: 15px 0;
}
.article-title {
    font-size: clamp(15px, 4vw, 16px);
    font-weight: bold;
    color: var(--color-primary);
    margin-bottom: 5px;
}
.article-meta {
    font-size: 12px;
    color: var(--color-gray);
    margin-bottom: 8px;
}
.article-snippet {
    font-size: clamp(13px, 3vw, 14px);
    line-height: 1.4;
}

/* RSS URL add form */
.modal-form-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}
.modal-form {
    background-color: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    width: 400px;
    max-width: 90%;
    border: 1px solid #e0e0e0;
}
.modal-form-url-input {
    width: 100%;
    padding: 12px;
    margin: 15px 0;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 16px;
    transition: border 0.3s;
}
.modal-form-url-input:focus {
    border-color: #4CAF50;
    outline: none;
}
.modal-form-button-group {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
}
.modal-form-button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    transition: all 0.2s;
}
.modal-form-button:hover {
    transform: translateY(-1px);
}
.modal-form-ok-button {
    background-color: #4CAF50;
    color: white;
}
.modal-form-ok-button:hover {
    background-color: #45a049;
}
.modal-form-cancel-button {
    background-color: #f44336;
    color: white;
}
.modal-form-cancel-button:hover {
    background-color: #d32f2f;
}
.modal-form-open-button {
    margin: 20px 0;
    padding: 12px 24px;
    background-color: #2196F3;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}
.modal-form-open-button:hover {
    background-color: #0b7dda;
    transform: translateY(-1px);
}
.folder-selection {
    margin-bottom: 15px;
}
.folder-selection label {
    display: block;
    margin-bottom: -10px;
    color: #555;
    font-size: 14px;
}
datalist {
    font-size: 16px;
    border-radius: 6px;
}

/* News */
.news-container {
    max-height: 100%;
    display: flex;
    flex-direction: column;
    width: 100%;
    margin: 0 auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

#news-list {
    overflow-y: auto;
    flex-grow: 1;
    min-height: 0; /* Add this line */
}

.panel-header {
    padding: 8px 16px; /* reduced paddings */
    background: #e0e0e0;
    color: #333;
    font-size: 1.15em;
    font-weight: 700;
    text-align: left;
    letter-spacing: 0.5px;
    position: relative;
    display: flex;           /* added */
    align-items: center;     /* added */
    justify-content: space-between; /* added */
}
.panel-header-actions {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    /* float: right; remove if present */
}

.panel-header-btn {
    background: transparent;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 1.2em;
    cursor: pointer;
    color: #aaa; /* muted color */
    transition: color 0.2s, background 0.2s;
    display: flex;
    align-items: center;
}

.panel-header-btn:hover {
    color: #666;
    background: #e0e0e0;
}
.news-item {
    border-bottom: 1px solid #eee;
    position: relative;
}
.news-header {
    padding: 5px 16px;
    display: flex;
    align-items: center;
    cursor: pointer;
    background: white;
    transition: background 0.2s;
}
.news-header:hover {
    background-color: #f5f7fa;
}
.news-title {
    padding-left: 20px;
    font-weight: 500;
    font-size: 0.95em;
    flex: 1;
}
.news-title-bold {
    padding-left: 20px;
    font-weight: 700;
    font-size: 0.95em;
    flex: 1;
}
.news-detail {
    display: block;
    padding: 16px;
    background-color: #fafafa;
    border-top: 1px solid #eee;
    position: relative;
    z-index: 2;
}
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}
.detail-title {
    padding-left: 20px;
    font-weight: 500;
    font-size: 1.05em;
    color: #0066cc;
    text-decoration: none;
    transition: color 0.2s;
}
.detail-title-bold {
    padding-left: 20px;
    font-weight: 700;
    font-size: 1.05em;
    color: #0066cc;
    text-decoration: none;
    transition: color 0.2s;
}
.detail-title:hover {
    color: #004d99;
    text-decoration: underline;
}
.close-btn {
    background: #e1f0ff;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9em;
    color: #0066cc;
    transition: all 0.2s;
}
.close-btn:hover {
    background: #0066cc;
    color: white;
}
.news-content {
    max-width: 90%;
    font-size: 0.9em;
    margin: 0 auto 10px;
    overflow-y: auto;
    padding-right: 5px;
    text-align: left;
}
.news-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8em;
    color: #666;
    margin-bottom: 10px;
}
.news-category {
    background-color: #e1f0ff;
    color: #0066cc;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8em;
}
p {
    margin: 8px 0;
}
ul, ol {
    margin: 8px 0;
    padding-left: 20px;
}
li {
    margin: 5px 0;
}

/* Responsiveness for mobile devices */
@media (max-width: 900px) {
    .news-container {
        width: 85%;
    }
}
@media (max-width: 600px) {
    .news-container {
        width: 95%;
    }
    .news-header, .news-detail {
        padding: 10px 12px;
    }
    .detail-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .close-btn {
        margin-top: 10px;
        align-self: flex-end;
    }
}
@media (max-width: 400px) {
    .news-meta {
        flex-direction: column;
        gap: 5px;
    }
}

/* Splitter 
.splitter {
    width: 1px;
    background: #ccc;
    position: relative;
    z-index: 2;
}
.splitter::before {
    content: "";
    position: absolute;
    left: -4.5px;
    top: 0;
    width: 10px;
    height: 100%;
    cursor: col-resize;
} */

/* Google Sign In button */
.customGPlusSignIn {
    display: inline-flex;
    align-items: center;
    background: #fff;
    color: #444;
    border-radius: 4px;
    border: 1px solid #ddd;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    padding: 8px 16px;
    font-size: 15px;
    cursor: pointer;
    transition: box-shadow 0.2s;
}
.customGPlusSignIn:hover {
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
    background: #f7f7f7;
}
.buttonText {
    font-weight: 500;
}
.customGPlusSignIn.inactive {
    opacity: 0.6;
    pointer-events: none;
    filter: grayscale(70%);
}
.icon-subscription-link {
    display: flex;
    align-items: center;
}
.icon-subscription {
    width: 16px;
    height: 16px;
    vertical-align: middle;
    flex-shrink: 0;
}