/* enhanced-theme-styles.css - Complete light/dark mode implementation */

.header-actions {
    position: relative;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .header-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .action-group {
        width: 100%;
        justify-content: center;
    }
}


.refresh-feed-btn {
    -webkit-appearance: none;
    appearance: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-light);
    padding: 4px;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-duration) var(--transition-easing);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.refresh-feed-btn:hover {
    background: var(--bg-hover);
    color: var(--accent-primary);
}

.refresh-feed-btn:disabled {
    cursor: default;
}

/* Feed row: name (favicon+title, truncates) on the left, meta (unread
   badge/error/refresh) pinned to the right and never wrapping - two
   predictable groups instead of several loose flex children spaced out
   by justify-content:space-between, which could push the refresh button
   onto its own line for a long feed title. */
.feed-row-name {
    display: flex;
    align-items: center;
    min-width: 0;
    flex: 1;
}

.feed-title-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.feed-row-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    margin-left: 8px;
}

.feed-error-indicator {
    color: var(--accent-warning);
    margin-left: 5px;
    cursor: help;
    display: inline-flex;
    align-items: center;
}

/* Quiet "hasn't fetched in a while" signal — distinct from the error
   indicator above (no explicit fetch error here, just staleness), so it
   stays muted rather than warning-colored. Only rendered when actually
   stale, so healthy/recent feeds show nothing extra. */
.feed-stale {
    color: var(--text-muted);
    font-size: 0.72em;
    margin-left: 5px;
    cursor: help;
    /* .feed-row-meta is flex-shrink:0 (never wraps), so without a cap here
       this label's own width was taken entirely out of .feed-row-name's
       space - on a narrow sidebar with several stale feeds in a row, that
       squeezed feed titles down to one or two visible characters. Clip the
       label itself instead; the full text is still in the title attribute. */
    max-width: 68px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* CSS Custom Properties for comprehensive theming */
:root {
    --transition-duration: 0.2s;
    --transition-easing: cubic-bezier(0.4, 0, 0.2, 1);
    /* Flat design: minimal rounding, no drop-shadow "cards" anywhere except
       the mobile drawer, which is the one place floating-above-content
       elevation still earns its keep. */
    --border-radius: 6px;
    --border-radius-sm: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
}

/* Light theme (default) */
:root,
[data-theme="light"],
.theme-light {
    /* Tells the browser this subtree is explicitly light, so mobile
       auto-dark-mode heuristics (Android Chrome's "Force Dark" etc.)
       trust our own colors instead of guessing/inverting on top of them -
       same reasoning as the <meta name="color-scheme"> tag in <head>,
       just scoped per actual active theme rather than "both supported". */
    color-scheme: light;
    /* Backgrounds */
    --bg-primary: #ffffff;
    --bg-secondary: #eef1f6;
    --bg-tertiary: #e9eef5;
    --bg-hover: #e2e8f0;
    --bg-active: #cbd5e0;
    --bg-overlay: rgba(255, 255, 255, 0.95);

    /* Text colors */
    --text-primary: #171e2b;
    --text-secondary: #2d3748;
    --text-muted: #4a5568;
    --text-light: #5d6c82;
    --text-inverse: #ffffff;

    /* Border colors */
    --border-color: #d9e1ec;
    --border-light: #e8edf4;
    --border-dark: #c3cedd;

    /* Accent colors */
    --accent-primary: #2b6cb0;
    --accent-primary-hover: #234e78;
    --accent-secondary: #2f855a;
    --accent-secondary-hover: #276749;
    --accent-warning: #b7791f;
    --accent-danger: #c53030;
    --accent-danger-hover: #9b2c2c;
    
    /* Shadows: flat everywhere. Only the mobile drawer (--shadow-xl) keeps
       a deliberate, subtle one - it's the one element that floats over
       page content rather than sitting flush within the layout. */
    --shadow-sm: none;
    --shadow-md: none;
    --shadow-lg: none;
    --shadow-xl: 2px 0 10px rgba(0, 0, 0, 0.12);

    /* Status colors */
    --success-bg: #f0fff4;
    --success-border: #9ae6b4;
    --success-text: #22543d;
    
    --error-bg: #fed7d7;
    --error-border: #fc8181;
    --error-text: #742a2a;
    
    --warning-bg: #fefcbf;
    --warning-border: #f6e05e;
    --warning-text: #744210;
    
    --info-bg: #ebf8ff;
    --info-border: #90cdf4;
    --info-text: #2b6cb0;
    
    /* RSS Reader specific */
    --article-bg: var(--bg-primary);
    --article-border: var(--border-light);
    --article-hover: #f6f8fb;
    --sidebar-bg: var(--bg-primary);
    --header-bg: var(--bg-primary);
}

/* Dark theme */
[data-theme="dark"],
.theme-dark {
    color-scheme: dark;
    /* Backgrounds */
    --bg-primary: #1a202c;
    --bg-secondary: #2d3748;
    --bg-tertiary: #4a5568;
    --bg-hover: #2d3748;
    --bg-active: #4a5568;
    --bg-overlay: rgba(26, 32, 44, 0.95);
    
    /* Text colors */
    --text-primary: #f7fafc;
    --text-secondary: #e2e8f0;
    --text-muted: #a0aec0;
    --text-light: #718096;
    --text-inverse: #1a202c;
    
    /* Border colors */
    --border-color: #4a5568;
    --border-light: #2d3748;
    --border-dark: #718096;
    
    /* Accent colors */
    --accent-primary: #4299e1;
    --accent-primary-hover: #63b3ed;
    --accent-secondary: #48bb78;
    --accent-secondary-hover: #68d391;
    --accent-warning: #ed8936;
    --accent-danger: #f56565;
    --accent-danger-hover: #e53e3e;
    
    /* Shadows: flat, same reasoning as the light theme above. */
    --shadow-sm: none;
    --shadow-md: none;
    --shadow-lg: none;
    --shadow-xl: 2px 0 10px rgba(0, 0, 0, 0.5);

    /* Status colors */
    --success-bg: rgba(72, 187, 120, 0.16);
    --success-border: #48bb78;
    --success-text: #9ae6b4;
    
    --error-bg: rgba(245, 101, 101, 0.16);
    --error-border: #f56565;
    --error-text: #fc8181;
    
    --warning-bg: rgba(237, 137, 54, 0.16);
    --warning-border: #ed8936;
    --warning-text: #fbd38d;
    
    --info-bg: rgba(66, 153, 225, 0.16);
    --info-border: #4299e1;
    --info-text: #90cdf4;
    
    /* RSS Reader specific */
    --article-bg: var(--bg-primary);
    --article-border: var(--border-light);
    --article-hover: var(--bg-hover);
    --sidebar-bg: var(--bg-primary);
    --header-bg: var(--bg-primary);
}

/* Mobile Bottom Navigation Dark Mode Fixes */
@media (max-width: 768px) {
    [data-theme="dark"] .mobile-bottom-nav {
        background: var(--bg-secondary);
        border-top: 1px solid var(--border-color);
    }

    [data-theme="dark"] .mobile-bottom-nav .nav-item {
        color: var(--text-muted);
        background: transparent !important;
        border: none !important;
    }

    [data-theme="dark"] .mobile-bottom-nav .nav-item.active {
        color: var(--accent-primary);
        background: var(--bg-active) !important;
    }

    [data-theme="dark"] .mobile-bottom-nav .nav-item:hover {
        color: var(--accent-primary-hover);
        background: var(--bg-hover) !important;
    }

    /* Ensure the text is always readable */
    [data-theme="dark"] .mobile-bottom-nav .nav-item div {
        color: inherit;
    }

    /* Fix nav badge contrast in dark mode */
    [data-theme="dark"] .mobile-bottom-nav .nav-badge {
        background: var(--accent-primary);
        color: var(--text-inverse);
    }

    /* Specific fix for button.nav-item (Refresh button) */
    [data-theme="dark"] .mobile-bottom-nav button.nav-item {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        color: var(--text-muted) !important;
    }

    [data-theme="dark"] .mobile-bottom-nav button.nav-item:hover {
        background: var(--bg-hover) !important;
        color: var(--accent-primary-hover) !important;
    }
}

/* Additional mobile navigation contrast improvements */
@media (max-width: 768px) {
    .mobile-bottom-nav .nav-item.active {
        background: var(--bg-hover);
        color: var(--accent-primary);
    }

    .mobile-bottom-nav .nav-item:not(.active) {
        color: var(--text-muted);
    }

    /* Reset button styles for nav-item buttons */
    .mobile-bottom-nav button.nav-item {
        background: transparent;
        border: none;
        box-shadow: none;
        outline: none;
        font-family: inherit;
        font-size: 0.65em; /* Match the exact font size of other nav items */
        font-weight: 500;
        cursor: pointer;
        display: flex;
        flex-direction: column;
        align-items: center;
        text-decoration: none;
        padding: 6px 8px;
        border-radius: 6px;
        transition: all 0.2s ease;
        min-width: 44px;
        position: relative;
        margin: 0; /* Remove default button margins */
        line-height: normal; /* Reset line height */
    }

    /* Ensure consistent styling across themes */
    [data-theme="light"] .mobile-bottom-nav .nav-item.active {
        background: var(--bg-hover);
        color: var(--accent-primary);
    }

    [data-theme="light"] .mobile-bottom-nav button.nav-item {
        background: transparent !important;
        border: none !important;
        color: var(--text-muted) !important;
    }

    [data-theme="light"] .mobile-bottom-nav button.nav-item:hover {
        background: var(--bg-hover) !important;
        color: var(--accent-primary) !important;
    }

    [data-theme="auto"] .mobile-bottom-nav .nav-item.active {
        background: var(--bg-hover);
        color: var(--accent-primary);
    }

    [data-theme="auto"] .mobile-bottom-nav button.nav-item {
        background: transparent !important;
        border: none !important;
        color: var(--text-muted) !important;
    }

    [data-theme="auto"] .mobile-bottom-nav button.nav-item:hover {
        background: var(--bg-hover) !important;
        color: var(--accent-primary) !important;
    }
}

/* Smooth transitions for all themed elements */
* {
    transition: 
        background-color var(--transition-duration) var(--transition-easing),
        color var(--transition-duration) var(--transition-easing),
        border-color var(--transition-duration) var(--transition-easing),
        box-shadow var(--transition-duration) var(--transition-easing),
        opacity var(--transition-duration) var(--transition-easing);
}

/* Base styles */
body {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
}

/* Layout components */
.sidebar,
.main-content,
.panel,
.login-container,
.register-container,
.reset-container,
.message-container,
.header,
.stats {
    background: var(--bg-primary);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.user-info,
.stat-item,
.default-credentials,
.admin-info {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 600;
}

.feed-title,
.article-title a,
.username {
    color: var(--text-primary);
}

.article-meta,
.feed-url,
.feed-stats,
.stat-label {
    color: var(--text-light);
}

p, span, div {
    color: var(--text-secondary);
}

/* Links */
a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color var(--transition-duration) var(--transition-easing);
}

a:hover {
    color: var(--accent-primary-hover);
    text-decoration: underline;
}

/* Sidebar styling */
.sidebar {
    background: var(--sidebar-bg);
    position: sticky; /* Make the sidebar sticky */
    top: 20px; /* Stick to the top with some offset */
    align-self: start; /* Ensure it aligns to the start of the grid area */
}

.sidebar h2 {
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: var(--spacing-sm);
}

.sidebar ul {
    border-bottom: 1px solid var(--border-light);
}

.sidebar a {
    color: var(--text-muted);
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-duration) var(--transition-easing);
}

.sidebar a:hover,
.sidebar a.active {
    background: var(--bg-hover);
    color: var(--text-secondary);
    text-decoration: none;
}

.sidebar a.context-active {
    background: var(--bg-active);
    color: var(--text-primary);
}

/* Header styling */
.header {
    background: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
}

.header h1 {
    color: var(--text-primary);
}

/* Articles */
.article {
    background: var(--article-bg);
    border-bottom: 1px solid var(--article-border);
    transition: all var(--transition-duration) var(--transition-easing);
    position: relative;
}

.article:hover {
    background: var(--article-hover);
}

/* Read vs unread: unread = bold title + accent dot; read = muted colors at
   normal weight (no whole-row opacity — it washed out favicons and actions) */
.article-title a {
    color: var(--text-primary);
    font-weight: 600;
    transition: color var(--transition-duration) var(--transition-easing);
}

.article:not(.read) .article-title a::before {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-primary);
    margin-right: 8px;
    vertical-align: 2px;
}

.article.read .article-title a {
    color: var(--text-muted);
    font-weight: 400;
}

.article.read .article-summary,
.article.read .article-meta {
    color: var(--text-light);
}

.article.read .feed-favicon {
    filter: grayscale(60%);
    opacity: 0.7;
}

.article.focused {
    background: var(--bg-hover);
    border-left: 3px solid var(--accent-primary);
    padding-left: 17px; /* Compensate for border */
}

.article-title a:hover {
    color: var(--accent-primary);
    text-decoration: none;
}

.article-summary {
    color: var(--text-muted);
}

.feed-name {
    color: var(--accent-primary);
}

.feed-name:hover {
    color: var(--accent-primary-hover);
}

/* Form elements */
input, select, textarea {
    background: var(--bg-primary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-duration) var(--transition-easing);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

input::placeholder {
    color: var(--text-light);
}

input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--accent-primary);
}

/* Buttons */
.btn:disabled,
.header-icon-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn {
    -webkit-appearance: none;
    appearance: none;
    border: none;
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    transition: all var(--transition-duration) var(--transition-easing);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
}

.btn-primary {
    background: var(--accent-primary);
    color: var(--text-inverse);
}

.btn-primary:hover {
    background: var(--accent-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--bg-active);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

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

.btn-success {
    background: var(--accent-secondary);
    color: var(--text-inverse);
}

.btn-success:hover {
    background: var(--accent-secondary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-danger {
    background: var(--accent-danger);
    color: var(--text-inverse);
}

.btn-danger:hover {
    background: var(--accent-danger-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-small {
    font-size: 0.85em;
    padding: 6px 12px;
}

/* Action buttons */
.action-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: var(--border-radius-sm);
    font-size: 0.9em;
    transition: all var(--transition-duration) var(--transition-easing);
    color: var(--text-light);
    display: inline-flex; /* Make it a flex container */
    align-items: center; /* Center SVG vertically */
    justify-content: center; /* Center SVG horizontally */
}

.action-btn svg {
    width: 18px; /* Adjust SVG size */
    height: 18px;
    stroke: currentColor; /* Inherit color from parent */
    stroke-width: 2; /* Default stroke width */
    fill: none; /* Default fill */
}

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

.star-btn.starred svg {
    fill: var(--accent-warning);
    stroke: var(--accent-warning);
}

.read-btn.read svg {
    stroke: var(--accent-secondary);
}

.archive-btn svg {
    stroke: var(--text-light);
}

.archive-btn:hover svg {
    stroke: var(--accent-primary);
}

.feed-favicon {
    width: 16px;
    height: 16px;
    border-radius: 2px;
    margin-right: 8px;
    vertical-align: middle;
    flex-shrink: 0;
    object-fit: cover;
}

.feed-favicon.default {
    opacity: 0.6;
    color: var(--text-muted);
}

.feed-favicon.error {
    display: none;
}

.archive-btn {
    color: var(--text-light);
}

.archive-btn:hover {
    color: var(--accent-primary);
}

/* Theme toggle specific */
.theme-toggle {
    min-width: auto;
    font-size: 0.85em;
    padding: 8px 12px;
    position: relative;
}

.scroll-toggle {
    font-size: 0.85em;
    padding: 8px 12px;
}

/* Unread count badge */
.unread-count {
    background: var(--accent-primary);
    color: var(--text-inverse);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.75em;
    font-weight: 600;
    float: right;
    transition: all var(--transition-duration) var(--transition-easing);
}

.unread-count:hover {
    background: var(--accent-primary-hover);
    transform: scale(1.05);
}

.unread-count.clickable {
    cursor: pointer;
}

.unread-count.clickable:hover {
    background: var(--accent-secondary);
}

/* Messages and alerts */
.message {
    padding: 12px 16px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    border-width: 1px;
    border-style: solid;
}

.message.success {
    background: var(--success-bg);
    color: var(--success-text);
    border-color: var(--success-border);
}

.message.error {
    background: var(--error-bg);
    color: var(--error-text);
    border-color: var(--error-border);
}

.message.warning {
    background: var(--warning-bg);
    color: var(--warning-text);
    border-color: var(--warning-border);
}

.message.info {
    background: var(--info-bg);
    color: var(--info-text);
    border-color: var(--info-border);
}

/* Tables */
.feeds-table {
    background: var(--bg-primary);
}

.feeds-table th {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

.feeds-table td {
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
}

.feeds-table tr:hover {
    background: var(--bg-hover);
}

/* Pagination */
.pagination {
    border-top: 1px solid var(--border-color);
}

.pagination a {
    color: var(--accent-primary);
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-duration) var(--transition-easing);
}

.pagination a:hover {
    background: var(--bg-hover);
    text-decoration: none;
}

.pagination .current {
    background: var(--accent-primary);
    color: var(--text-inverse);
}

/* Status indicators */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-active {
    background: var(--accent-secondary);
}

.status-error {
    background: var(--accent-danger);
}

/* Code blocks */
code, pre {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
}

pre {
    padding: 12px;
    overflow-x: auto;
}

code {
    padding: 2px 4px;
}

/* Context menu */
.context-menu {
    position: fixed;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 4px 0;
    z-index: 1000;
    min-width: 180px;
    display: none;
}

.context-menu-item {
    padding: 8px 16px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.9em;
    transition: background-color var(--transition-duration) var(--transition-easing);
    display: flex;
    align-items: center;
    gap: 8px;
}

.context-menu-item:hover {
    background: var(--bg-hover);
}

.context-menu-item.danger {
    color: var(--accent-danger);
}

.context-menu-item.danger:hover {
    background: var(--error-bg);
}

.context-menu-separator {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

/* Loading states */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    margin-top: 20px;
    border: 1px solid var(--border-color);
}

.empty-state-image {
    max-width: 200px;
    margin-bottom: 20px;
    opacity: 0.8;
}

.empty-state h2 {
    font-size: 1.8em;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.empty-state p {
    font-size: 1.1em;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.empty-state .btn {
    margin-top: 15px;
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
}

/* Toast notifications */
.theme-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--info-bg);
    color: var(--info-text);
    padding: 12px 16px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--info-border);
    font-size: 0.9em;
    max-width: 300px;
    font-weight: 500;
}

.theme-toast.toast-success {
    background: var(--success-bg);
    color: var(--success-text);
    border-left-color: var(--success-border);
}

.theme-toast.toast-error {
    background: var(--error-bg);
    color: var(--error-text);
    border-left-color: var(--error-border);
}


/* Read feedback animation */
.read-feedback {
    background: var(--accent-secondary) !important;
    color: var(--text-inverse) !important;
    font-weight: 600;
}

/* Login page specific theming — scoped to auth pages (they render .auth-card).
   Unscoped [data-theme] body rules used to leak the purple gradient onto the
   reader and admin pages in light mode. auth.css supplies the light gradient. */
[data-theme="dark"] body:has(.auth-card) {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
}

/* Login containers get special treatment */
.login-container,
.register-container,
.reset-container,
.message-container {
    background: var(--bg-primary);
    box-shadow: var(--shadow-xl);
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) var(--bg-secondary);
}

/* Selection styling */
::selection {
    background: var(--accent-primary);
    color: var(--text-inverse);
}

::-moz-selection {
    background: var(--accent-primary);
    color: var(--text-inverse);
}

/* Focus visible for accessibility */
*:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .container {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 12px;
    }
    
    .sidebar {
        order: 2;
        padding: 12px;
    }
    
    .header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
        padding: 12px;
    }
    
    .header-actions {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 6px;
    }
    
    .header-actions .btn {
        font-size: 0.8em;
        padding: 6px 10px;
    }
    
    .theme-toggle,
    .scroll-toggle {
        font-size: 0.75em;
        padding: 6px 8px;
    }
    
    .article-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .article-actions {
        margin-top: 8px;
        align-self: flex-end;
    }
    
    /* Mobile table styling */
    .feeds-table,
    .feeds-table thead,
    .feeds-table tbody,
    .feeds-table th,
    .feeds-table td,
    .feeds-table tr {
        display: block;
    }
    
    .feeds-table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    .feeds-table tr {
        border: 1px solid var(--border-color);
        border-radius: var(--border-radius);
        margin-bottom: 8px;
        padding: 8px;
        background: var(--bg-primary);
    }
    
    .feeds-table td {
        border: none;
        border-bottom: 1px solid var(--border-light);
        position: relative;
        padding: 6px 6px 6px 35%;
        text-align: left;
    }
    
    .feeds-table td:before {
        content: attr(data-label) ": ";
        position: absolute;
        left: 6px;
        width: 30%;
        padding-right: 8px;
        white-space: nowrap;
        font-weight: 600;
        color: var(--text-muted);
    }
    
    .feeds-table td:last-child {
        border-bottom: 0;
    }
    
    /* Mobile context menu */
    .context-menu {
        min-width: 160px;
        font-size: 0.85em;
    }
    
    .context-menu-item {
        padding: 10px 14px;
        min-height: 44px;
    }
    
    /* Mobile toast positioning */
    .theme-toast {
        bottom: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 8px;
        gap: 8px;
    }
    
    .header,
    .panel-content,
    .sidebar {
        padding: 10px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .login-container,
    .register-container,
    .reset-container,
    .message-container {
        margin: 8px;
        padding: 16px 12px;
    }
}

/* Landscape mobile adjustments */
@media screen and (max-width: 768px) and (orientation: landscape) {
    .container {
        grid-template-columns: 180px 1fr;
    }
    
    .sidebar {
        order: 0;
        padding: 8px;
    }
    
    .sidebar h2 {
        font-size: 0.9em;
        margin-bottom: 8px;
    }
    
    .sidebar a {
        padding: 4px 6px;
        font-size: 0.85em;
    }
}

/* Touch device enhancements */
@media (hover: none) and (pointer: coarse) {
    .action-btn,
    .btn,
    .sidebar a {
        min-height: 44px;
        padding: 8px 12px;
    }
    
    .action-btn {
        margin: 2px;
    }
    
    .theme-toggle,
    .scroll-toggle {
        min-height: 44px;
        padding: 8px 12px;
    }
    
    .article {
        padding: 16px 0;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000000;
        --text-muted: #000000;
    }
    
    [data-theme="dark"] {
        --border-color: #ffffff;
        --text-muted: #ffffff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
    
    .article.focused {
        scroll-behavior: auto;
    }
}

/* Print styles */
@media print {
    .sidebar,
    .header-actions,
    .theme-toggle,
    .scroll-toggle,
    .action-btn,
    .context-menu {
        display: none !important;
    }
    
    .container {
        grid-template-columns: 1fr;
        max-width: none;
    }
    
    .article {
        break-inside: avoid;
        border-bottom: 1px solid #ccc;
    }
    
    .article-title a {
        color: #000 !important;
        text-decoration: underline;
    }
    
    .article-summary {
        color: #333 !important;
    }
}

/* Dashboard styles */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.dashboard-card {
    background: var(--bg-primary);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.dashboard-card .card-icon {
    font-size: 2.5em;
    margin-bottom: 15px;
    color: var(--accent-primary);
}

.dashboard-card .card-title {
    font-size: 1.4em;
    color: var(--text-primary);
    margin-bottom: 15px;
}

.dashboard-card .card-content {
    width: 100%;
}

/* Status pills */
.status-pill {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-pill.status-good {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid var(--success-border);
}

.status-pill.status-warning {
    background: var(--warning-bg);
    color: var(--warning-text);
    border: 1px solid var(--warning-border);
}

.status-pill.status-error {
    background: var(--error-bg);
    color: var(--error-text);
    border: 1px solid var(--error-border);
}

.status-pill.status-info {
    background: var(--info-bg);
    color: var(--info-text);
    border: 1px solid var(--info-border);
}

/* Bar Chart */
.chart-container {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-light);
}

.bar-chart-label {
    font-size: 0.9em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.bar-chart {
    display: flex;
    width: 100%;
    height: 20px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--bg-tertiary);
}

.bar-segment {
    height: 100%;
    transition: width 0.5s ease-out;
}

.bar-segment.active-bar {
    background: var(--accent-secondary);
}

.bar-segment.inactive-bar {
    background: var(--accent-danger);
}

.chart-legend {
    display: flex;
    justify-content: space-between;
    font-size: 0.8em;
    color: var(--text-light);
    margin-top: 5px;
}

/* Log cards grid */
.log-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
}

/* Form grid for 2-column layout */
.form-grid-2-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

@media (max-width: 768px) {
    .form-grid-2-col {
        grid-template-columns: 1fr;
    }
}
