/* DESIGN SYSTEM & VARIABLES */
:root {
    /* Fonts */
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-heading: 'Outfit', sans-serif;
    --font-serif: 'Lora', Georgia, serif;

    /* Theme-specific values (Default Dark Theme) */
    --bg-app: #0d0f12;
    --bg-sidebar: #14171c;
    --bg-panel: #0d0f12;
    --bg-card: #181c22;
    --bg-card-hover: #20262e;
    --bg-glass: rgba(20, 23, 28, 0.7);
    --border-color: #242b35;
    
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    /* Brand Colors */
    --primary: #38bdf8;
    --primary-hover: #7dd3fc;
    --primary-glow: rgba(56, 189, 248, 0.15);
    --accent: #c084fc;
    --danger: #f87171;
    --danger-hover: #ef4444;
    --success: #34d399;
    
    /* Layout Constants */
    --sidebar-width: 320px;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-main: 0 4px 20px -2px rgba(0, 0, 0, 0.3);
    
    /* User Adjustable Font Sizes */
    --list-font-size: 14px;
    --article-font-size: 18px;
}

/* Light Theme Variables */
[data-theme="light"] {
    --bg-app: #f8fafc;
    --bg-sidebar: #ffffff;
    --bg-panel: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --bg-glass: rgba(255, 255, 255, 0.75);
    --border-color: #e2e8f0;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --primary: #0284c7;
    --primary-hover: #0369a1;
    --primary-glow: rgba(2, 132, 199, 0.1);
    --accent: #8b5cf6;
    
    --shadow-main: 0 4px 20px -2px rgba(15, 23, 42, 0.05);
}

/* BASE STYLES */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-app);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* APP LAYOUT */
.app-container {
    display: grid;
    grid-template-columns: var(--sidebar-width, 320px) 6px 400px 6px 1fr;
    height: 100vh;
    width: 100%;
}

@media (max-width: 1024px) {
    .app-container {
        grid-template-columns: var(--sidebar-width) 1fr;
    }
    
    .reader-panel {
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        width: 100%;
        max-width: 600px;
        z-index: 100;
        transform: translateX(100%);
        transition: transform 0.3s ease-in-out;
    }
    
    .reader-panel.active {
        transform: translateX(0);
        box-shadow: -5px 0 25px rgba(0, 0, 0, 0.2);
    }
}

@media (max-width: 768px) {
    .app-container {
        grid-template-columns: 1fr;
    }
    
    .app-sidebar {
        display: none; /* Can add a drawer toggle later */
    }
}

/* SIDEBAR STYLES */
.app-sidebar {
    background-color: var(--bg-sidebar);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    padding: 1rem;
    gap: 1rem;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
}

.logo-icon {
    color: var(--primary);
    filter: drop-shadow(0 0 8px var(--primary));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sidebar-section h3 {
    font-family: var(--font-heading);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* INPUTS & BUTTONS */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.row-inputs {
    flex-direction: row;
}

.row-inputs input {
    flex: 2;
}

.row-inputs select {
    flex: 1;
    min-width: 100px;
}

input[type="url"],
input[type="text"],
input[type="number"],
input[type="search"],
select {
    width: 100%;
    padding: 0.75rem 1rem;
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    transition: var(--transition-smooth);
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.btn-primary {
    background-color: var(--primary);
    color: #000000;
    font-family: var(--font-sans);
    font-weight: 600;
    padding: 0.75rem;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition-smooth);
    width: 100%;
    text-align: center;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-weight: 500;
    padding: 0.6rem 1rem;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-secondary:hover {
    background-color: var(--bg-card-hover);
    border-color: var(--text-muted);
}

.btn-primary-outline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition-smooth);
    text-decoration: none;
}

.btn-primary-outline:hover {
    background-color: var(--primary);
    color: #000000;
}

.btn-danger {
    background-color: rgba(248, 113, 113, 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
    font-weight: 600;
    padding: 0.75rem 1.25rem;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-danger:hover {
    background-color: var(--danger);
    color: #ffffff;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.icon-btn:hover {
    color: var(--text-primary);
    background-color: var(--bg-card-hover);
}

.icon-btn-small {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.95rem;
    padding: 0.25rem;
    transition: var(--transition-smooth);
}

.icon-btn-small:hover {
    color: var(--primary);
}

.btn-small {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    background-color: var(--primary);
    color: #000000;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-weight: 600;
}

/* FILTERS & ACCORDIONS */
.filter-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filter-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.75rem;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition-smooth);
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.filter-item:hover, .filter-item.active {
    background-color: var(--bg-card-hover);
    color: var(--text-primary);
}

.filter-item.active {
    font-weight: 600;
    border-left: 3px solid var(--primary);
    padding-left: calc(0.75rem - 3px);
}

.badge {
    background-color: var(--border-color);
    color: var(--text-secondary);
    font-size: 0.75rem;
    padding: 0.15rem 0.45rem;
    border-radius: 20px;
    font-weight: 600;
}

.filter-item.active .badge {
    background-color: var(--primary-glow);
    color: var(--primary);
}

/* Subscribed Feeds Accordion Group */
.feeds-accordion {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.category-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
}

.category-group-header i.chevron {
    font-size: 0.8rem;
    transition: transform 0.2s;
}

.category-group-header.collapsed i.chevron {
    transform: rotate(-90deg);
}

.category-feeds-list {
    list-style: none;
    padding-left: 0.5rem;
    margin-top: 0.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.category-feeds-list.collapsed {
    display: none;
}

.feed-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.5rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.85rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition-smooth);
}

.feed-item:hover, .feed-item.active {
    background-color: var(--bg-card-hover);
    color: var(--text-primary);
}

.feed-item.active {
    font-weight: 600;
    color: var(--primary);
}

.feed-name-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 80%;
}

.feed-actions {
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.feed-item:hover .feed-actions {
    opacity: 1;
}

/* SETTINGS RANGE SLIDERS */
.setting-item {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.5rem 0;
}

.setting-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: var(--border-color);
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    transition: transform 0.1s;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.auto-fetch-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.auto-fetch-wrapper input {
    width: 70px;
    padding: 0.4rem;
}

.auto-fetch-wrapper span {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.checkbox-wrapper input {
    cursor: pointer;
}

.hidden-element {
    display: none !important;
}

/* ARTICLES PANEL STYLES */
.articles-panel {
    background-color: var(--bg-panel);
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.panel-header {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.panel-header h1 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
}

.meta-info {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.search-bar-wrapper {
    position: relative;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.search-bar-wrapper input {
    padding-left: 2.25rem;
    background-color: var(--bg-card);
}

.search-icon {
    position: absolute;
    left: 2.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* STATUS BANNER */
.status-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--primary-glow);
    padding: 0.5rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--primary);
}

.status-indicator-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--primary);
}

.status-indicator-dot.pulse {
    box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.7);
    animation: pulse 1.6s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(56, 189, 248, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 5px rgba(56, 189, 248, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(56, 189, 248, 0);
    }
}

/* ARTICLES LIST */
.articles-scroll-container {
    flex: 1;
    overflow-y: auto;
}

.articles-list {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    gap: 0.75rem;
}

.article-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.article-card:hover {
    background-color: var(--bg-card-hover);
    transform: translateY(-2px);
    border-color: var(--text-muted);
}

.article-card.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.article-card-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.card-source-name {
    color: var(--primary);
    font-weight: 600;
}

.article-card h2 {
    font-family: var(--font-heading);
    font-size: calc(var(--list-font-size) + 2px);
    font-weight: 600;
    line-height: 1.35;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-card p {
    font-size: var(--list-font-size);
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-card-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.25rem;
}

/* Loading/Error/Empty states */
.list-info-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--text-secondary);
    gap: 1rem;
}

.list-info-state i {
    font-size: 2rem;
    color: var(--text-muted);
}

/* ARTICLE READER PANEL STYLES */
.reader-panel {
    background-color: var(--bg-app);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.reader-blank-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    gap: 1rem;
    padding: 2rem;
    text-align: center;
}

.blank-icon {
    font-size: 3.5rem;
    color: var(--text-muted);
    opacity: 0.5;
}

.reader-content-state {
    padding: 2.5rem 3rem;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.close-reader-btn {
    display: none;
    margin-bottom: 1.5rem;
}

@media (max-width: 1024px) {
    .close-reader-btn {
        display: flex;
    }
}

.article-body {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.article-header {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.85rem;
}

.source-badge {
    background-color: var(--primary-glow);
    color: var(--primary);
    padding: 0.2rem 0.6rem;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
}

.pub-date {
    color: var(--text-muted);
}

.article-header h1 {
    font-family: var(--font-heading);
    font-size: calc(var(--article-font-size) + 8px);
    font-weight: 800;
    line-height: 1.25;
}

.header-divider {
    border: none;
    border-bottom: 2px solid var(--border-color);
    margin-top: 0.5rem;
}

.article-text-content {
    font-family: var(--font-serif);
    font-size: var(--article-font-size);
    line-height: 1.7;
    color: var(--text-primary);
}

.article-text-content p {
    margin-bottom: 1.5rem;
}

.article-text-content a {
    color: var(--primary);
    text-decoration: underline;
}

.article-text-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    margin: 1.5rem 0;
    box-shadow: var(--shadow-main);
}

.article-footer {
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    margin-top: 2rem;
    display: flex;
    justify-content: center;
}

/* MODAL STYLES */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    transition: var(--transition-smooth);
}

.modal-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 450px;
    padding: 1.5rem;
    box-shadow: var(--shadow-main);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
}

.modal-body {
    display: flex;
    flex-direction: column;
}

.modal-body form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.modal-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
}

/* COLUMN RESIZERS */
.col-resizer {
    cursor: col-resize;
    background-color: var(--border-color);
    width: 4px;
    height: 100vh;
    z-index: 10;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    transition: background-color 0.15s;
}

.col-resizer:hover,
.col-resizer.dragging {
    background-color: var(--primary);
}

.col-resizer::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 24px;
    background-color: var(--text-muted);
    border-radius: 1px;
    transition: background-color 0.15s;
}

.col-resizer:hover::after,
.col-resizer.dragging::after {
    background-color: #000000;
}
