:root {
    --pico-font-family-sans-serif: 'Public Sans', sans-serif, var(--pico-font-family-emoji);

    /* Original: 100% */
    --pico-line-height: 1.4;
    --pico-font-size: 1rem;
    /* Original: 1.5 */
    --pico-form-element-spacing-vertical: 0.5rem;
    /* Original: 1rem */
    --pico-form-element-spacing-horizontal: 1.0rem;
    /* Original: 1.25rem */
    --pico-border-radius: 0.375rem;
    /* Original: 0.25rem */
}

[data-theme=light],
:root:not([data-theme=dark]) {
    --pico-card-sectioning-background-color: var(--pico-color-grey-50);
}

[data-theme=dark],
:root:not([data-theme=light]) {
    --pico-card-sectioning-background-color: var(--pico-color-azure-800);
}

/* Theme toggle button styles */
.theme-toggle {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--pico-color-slate-700);
    transition: background-color 0.3s, color 0.3s;
}

.theme-toggle:hover {
    background-color: var(--pico-color-slate-200);
}

.theme-toggle:focus {
    outline: 2px solid var(--pico-primary-focus);
    outline-offset: 2px;
}

/* Show/hide icons based on current theme */
.theme-toggle .sun-icon {
    display: none;
}

.theme-toggle .moon-icon {
    display: block;
}

.theme-toggle.dark-mode .sun-icon {
    display: block;
}

.theme-toggle.dark-mode .moon-icon {
    display: none;
}

/* Dark theme specific adjustments */
[data-theme="dark"] .theme-toggle {
    color: var(--pico-color-slate-300);
}

[data-theme="dark"] .theme-toggle:hover {
    background-color: var(--pico-color-slate-800);
}

@media (min-width: 1px) {
    .version-info {
        display: none;
    }
    :root {
        --pico-font-size: 90%;
        /* Original: 106.25% */
    }
}
@media (min-width: 768px) {
    .version-info {
        display: block;
    }
    .cards {  grid-template-columns: repeat(2, 1fr); gap: 1rem; }
}


h1,
h2,
h3,
h4,
h5,
h6 {
    --pico-font-weight: 600;
    /* Original: 700 */
    font-family: 'Lilita One', cursive;
    letter-spacing: 0.02em;
}

/* Add specific styling for different header levels */
h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.75rem;
}

h4 {
    font-size: 1.5rem;
}

h5 {
    font-size: 1.25rem;
}

h6 {
    font-size: 1.1rem;
}

/* ======================================================
   GLOBAL STYLES
   ====================================================== */

/* Header styles */
.version-info {
    opacity: 0.7;
    margin-left: 0.5rem;
}

/* Alert styles */
.alert {
    background: var(--pico-card-background-color);
    padding: 1rem;
    border-radius: var(--pico-border-radius);
    border: 1px solid var(--pico-card-border-color);
    margin-bottom: 1rem;
}

.alert-success h3 {
    color: var(--pico-color-green-700);
}

.alert-error h3 {
    color: var(--pico-form-element-invalid-border-color);
}

.code-block {
    background: var(--pico-card-background-color);
    padding: 1rem;
    border-radius: var(--pico-border-radius);
    overflow: auto;
    margin-bottom: 1rem;
}

/* ======================================================
   PLATFORM PAGES - SHARED STYLES
   ====================================================== */

/* ======================================================
   HOME PAGE STYLES
   ====================================================== */

/* ======================================================
   PLATFORMS/SCRAPE.PHP STYLES
   ====================================================== */

/* Queue Stats Styling */
.queue-stats {
    margin-bottom: 1.5rem;
}

.queue-summary {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1.5rem;
}

.total-count {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 120px;
    padding: 1rem;
    background-color: var(--pico-primary-background);
    border-radius: var(--pico-border-radius);
    color: var(--pico-primary-inverse);
}

.total-count .count {
    font-size: 2.5rem;
    font-weight: bold;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.total-count .label {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.progress-container {
    flex: 1;
}

.progress-container progress {
    width: 100%;
    height: 1.5rem;
    margin-bottom: 0.5rem;
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--pico-muted-color);
}

.queue-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    border-radius: var(--pico-border-radius);
    background-color: var(--pico-card-background-color);
    border-top: 4px solid var(--pico-muted-border-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-box:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.stat-box .stat-count {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.stat-box .stat-label {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--pico-muted-color);
}

/* Status-specific colors */
.stat-box.pending {
    border-top-color: var(--pico-color-blue-500);
}

.stat-box.processing {
    border-top-color: var(--pico-color-amber-500);
}

.stat-box.processed {
    border-top-color: var(--pico-color-green-500);
}

.stat-box.failed {
    border-top-color: var(--pico-color-red-500);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .queue-summary {
        flex-direction: column;
        align-items: stretch;
    }
    
    .total-count {
        flex-direction: row;
        justify-content: space-between;
        padding: 0.75rem 1rem;
        min-width: auto;
    }
    
    .total-count .count {
        font-size: 2rem;
        margin-bottom: 0;
    }
    
    .queue-details {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Scraper Controls */
#scraper-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

#progress-container {
    margin: 1rem 0;
    padding: 1rem;
    background-color: #f9f9f9;
    border-radius: 4px;
    border: 1px solid #ddd;
}

#progress-container progress {
    width: 100%;
    height: 20px;
    margin: 0.5rem 0;
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.25rem;
}

#current-account {
    font-weight: bold;
    margin: 0.5rem 0;
}

#scraper-status {
    margin-bottom: 0.5rem;
    font-weight: bold;
}

#log-container {
    margin: 1rem 0;
    padding: 1rem;
    background-color: #f9f9f9;
    border-radius: 4px;
    border: 1px solid #ddd;
}

.log-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.log-filters label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

article.messagebox p {
    margin-bottom: 0;
}

article.success {
    background-color: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

article.error {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

/* ======================================================
   PLATFORMS/ANALYTICS.PHP STYLES
   ====================================================== */

.table-container {
    overflow-x: auto;
    overflow-y: auto;
    max-width: 100%;
    max-height: calc(100vh - 600px); /* Reserve space for header, filters, and footer */
    min-height: 300px; /* Minimum height to ensure usability */
}

table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Arial', serif;
    font-size: 0.9rem;
    margin-bottom: 0; /* Remove bottom margin to prevent extra spacing */
}

/* Analytics page specific styles for better table layout */
.analytics-table-container {
    max-height: calc(100vh - 750px);
    overflow-y: auto;
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
}

/* Responsive adjustments for smaller screens */
@media (max-height: 800px) {
    .analytics-table-container {
        max-height: calc(100vh - 300px);
    }
}

@media (max-height: 600px) {
    .analytics-table-container {
        max-height: calc(100vh - 250px);
    }
}

/* Ensure the table fills the container properly */
.analytics-table-container table {
    margin-bottom: 0;
}

/* Make sure the header stays visible when scrolling */
.analytics-table-container thead th {
    position: sticky;
    top: 0;
    background-color: var(--pico-card-sectioning-background-color);
    z-index: 10;
    border-bottom: 2px solid var(--pico-muted-border-color);
}

/* Typeahead filter styles */
.typeahead-filter {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background-color: var(--pico-card-sectioning-background-color);
    border-radius: var(--pico-border-radius);
    border: 1px solid var(--pico-muted-border-color);
}

.typeahead-filter label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-weight: 500;
}

.typeahead-filter input {
    min-width: 250px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    font-size: 0.9rem;
}

.typeahead-filter input:focus {
    border-color: var(--pico-primary);
    box-shadow: 0 0 0 2px var(--pico-primary-focus);
}

.filter-count {
    font-size: 0.85rem;
    color: var(--pico-muted-color);
    font-style: italic;
}

/* Hidden rows for filtering */
tbody tr.hidden {
    display: none;
}

th {
    position: sticky;
    top: 0;
    background-color: var(--pico-card-sectioning-background-color);
    z-index: 10;
    padding: 0; /* Remove padding to allow the anchor to fill the entire cell */
    border-bottom: 2px solid var(--pico-muted-border-color);
}

th a {
    text-decoration: none;
    color: inherit;
    display: block; /* Make the anchor fill the entire cell */
    padding: 0.75rem; /* Add padding to the anchor instead of the th */
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    white-space: nowrap;
}

th a:hover {
    background-color: var(--pico-card-background-color);
}

tbody tr:hover td {
    background-color: var(--pico-card-sectioning-background-color);
}

tbody td:hover {
    background-color: var(--pico-primary-background) !important;
    color: var(--pico-primary-inverse);
}

/* Format numbers with thousand separators */
.number {
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}

/* Format dates */
.date-column {
    white-space: nowrap;
}

/* Highlight sorted column */
.sorted {
    background-color: rgba(var(--pico-primary-rgb), 0.05);
}

th.sorted a {
    font-weight: bold;
    background-color: rgba(var(--pico-primary-rgb), 0.1);
}

/* ======================================================
   PLATFORMS/OUTPUT.PHP STYLES
   ====================================================== */

.profile-image {
    max-width: 100px;
    border-radius: 50%;
}

.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.content-item {
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 0.5rem;
    overflow: hidden;
}

.content-header {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    background-color: var(--pico-card-sectioning-background-color);
    font-size: 0.8rem;
}

.media img, .media video {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
}

.content-body {
    padding: 0.5rem;
}

.caption {
    margin-bottom: 0.5rem;
    max-height: 100px;
    overflow-y: auto;
}

.engagement {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    color: var(--pico-muted-color);
}

.metric {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* ======================================================
   INSTAGRAM/INDEX.PHP STYLES
   ====================================================== */

.instagram-alert {
    margin-top: 1rem;
    padding: 1rem;
}

/* ======================================================
   LOG MESSAGE STYLING
   ====================================================== */

/* Log message styling */
#scraper-log {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--pico-card-border-color);
    padding: 0.5rem;
    background-color: var(--pico-card-background-color);
    font-family: monospace;
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 1rem;
}

#scraper-log div {
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    margin-bottom: 2px;
}

/* Log level colors */
#scraper-log div[data-level="1"],
#scraper-log div.debug-log {
    /* DEBUG */
    color: var(--pico-color-slate-600);
    background-color: var(--pico-color-slate-100);
}
#scraper-log div[data-level="1"]:after {
    content: "[DEBUG]";
    float: right;
    opacity: 0.7;
}

#scraper-log div[data-level="2"],
#scraper-log div.info-log {
    /* INFO */
    color: var(--pico-color-azure-700);
    background-color: var(--pico-color-azure-100);
}
#scraper-log div[data-level="2"]:after {
    content: "[INFO]";
    float: right;
    opacity: 0.7;
}

#scraper-log div[data-level="4"],
#scraper-log div.notice-log {
    /* NOTICE */
    color: var(--pico-color-cyan-700);
    background-color: var(--pico-color-cyan-100);
}
#scraper-log div[data-level="4"]:after {
    content: "[NOTICE]";
    float: right;
    opacity: 0.7;
}

#scraper-log div[data-level="8"],
#scraper-log div.warning-log {
    /* WARNING */
    color: var(--pico-color-amber-700);
    background-color: var(--pico-color-amber-100);
}
#scraper-log div[data-level="8"]:after {
    content: "[WARNING]";
    float: right;
    opacity: 0.7;
}

#scraper-log div[data-level="16"],
#scraper-log div.error-log {
    /* ERROR */
    color: var(--pico-color-red-700);
    background-color: var(--pico-color-red-100);
}
#scraper-log div[data-level="16"]:after {
    content: "[ERROR]";
    float: right;
    opacity: 0.7;
}

/* Source indicators */
#scraper-log div[data-source="scraper"] {
    border-left: 3px solid var(--pico-color-azure-500);
}

#scraper-log div[data-source="stream"] {
    border-left: 3px solid var(--pico-color-green-500);
}

/* ======================================================
   DETAILS/SUMMARY ACCORDION STYLES
   ====================================================== */

details {
    width: 100%;
    border: 1px solid var(--pico-muted-border-color);
    border-radius: 0.25rem;
    padding: 0;
    margin-bottom: 1rem;
}

details summary {
    padding: 0.75rem 1rem;
    font-weight: bold;
    cursor: pointer;
    background-color: var(--pico-card-background-color);
    border-bottom: 1px solid transparent;
}

details[open] summary {
    border-bottom: 1px solid var(--pico-muted-border-color);
}

details article {
    padding: 1rem;
    margin: 0;
    border: none;
}



/* Make strong text more prominent */
strong {
    font-weight: 700;
}

/* Style for page titles and section headers */
.page-title {
    font-family: 'Lilita One', cursive;
    color: var(--pico-primary);
    margin-bottom: 1.5rem;
}

/* Style for navigation */
nav strong {
    font-family: 'Lilita One', cursive;
    font-size: 1.4rem;
    font-weight: normal;
    letter-spacing: 0.02em;
}

/* Adjust button text for better readability */
button, 
.button,
[role="button"] {
    font-family: 'Public sans', serif;
    font-weight: 600;
}

/* Add a class for when you want to use Lilita One for emphasis */
.accent-font {
    font-family: 'Public sans', cursive;
    letter-spacing: 0.02em;
}

/* Platform and Feature Cards
   ====================================================== */
.platform-card, 
.feature-card {
    border-radius: var(--pico-border-radius);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden;
}

.platform-card:hover, 
.feature-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.platform-card header, 
.feature-card header {
    padding: 1rem;
    font-weight: bold;
    font-size: 1.2rem;
    text-align: center;
}

.platform-card ul {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.platform-card li {
    margin-bottom: 0.5rem;
}

.platform-card progress {
    margin: 0.5rem 0 1rem 0;
    width: 100%;
    height: 2rem;
    background-color: white;

}

/* Platform-specific header styling */
.platform-card.instagram header {
    border-bottom: 5px solid var(--pico-color-amber-300);
}

.platform-card.youtube header {
    border-bottom: 5px solid var(--pico-color-red-300);
}

.platform-card.twitter header {
    border-bottom: 5px solid var(--pico-color-blue-300);
}

.platform-card.tiktok header {
    border-bottom: 5px solid var(--pico-color-purple-300);
}

/* Feature card specific styles */
.feature-button {
    margin-top: 0.5rem;
    text-align: center;
}

article.add-platform {
    margin-top: 2rem;
    padding: 1.5rem;
    text-align: center;
    border: 2px dashed var(--pico-muted-border-color);
    background-color: transparent;
}

/* Light theme colors */
[data-theme=light],
:root:not([data-theme=dark]) {
    .platform-card, 
    .feature-card {
        background-color: var(--pico-color-azure-100);
    }

    .platform-card header, 
    .feature-card header {
        background-color: var(--pico-color-azure-600);
        color: white;
    }

    .feature-button {
        background-color: var(--pico-color-azure-600);
        color: var(--pico-color-azure-100);
    }
}

/* Dark theme colors */
[data-theme=dark],
:root:not([data-theme=light]) {
    .platform-card, 
    .feature-card {
        background-color: var(--pico-color-azure-600);
    }

    .platform-card header, 
    .feature-card header {
        background-color: var(--pico-color-azure-700);
        color: white;
    }

    .feature-button,
    .platform-card .button {
        background-color: var(--pico-color-azure-800);
        color: var(--pico-color-azure-100);
    }
}

/* Log output styling */
.log-output {
    height: 300px;
    overflow-y: auto;
    background-color: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    font-family: monospace;
    font-size: 12px;
    line-height: 1.4;
    margin-top: 10px;
}

.log-output div {
    padding: 2px 5px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: block; /* Ensure divs are displayed as blocks */
}

/* Error level (16) */
.log-output div[data-level="16"],
.log-output div.error-log {
    color: #d9534f;
    background-color: rgba(217, 83, 79, 0.1);
    font-weight: bold;
}

/* Warning level (8) */
.log-output div[data-level="8"],
.log-output div.warning-log {
    color: #f0ad4e;
    background-color: rgba(240, 173, 78, 0.1);
}

/* Notice level (4) */
.log-output div[data-level="4"],
.log-output div.notice-log {
    color: #5bc0de;
    background-color: rgba(91, 192, 222, 0.1);
}

/* Info level (2) */
.log-output div[data-level="2"],
.log-output div.info-log {
    color: #5cb85c;
    background-color: rgba(92, 184, 92, 0.05);
}

/* Debug level (1) */
.log-output div[data-level="1"],
.log-output div.debug-log {
    color: #777;
}

/* Source-specific styling */
.log-output div[data-source="processor"] {
    border-left: 3px solid #5bc0de;
    padding-left: 7px;
}

.log-output div[data-source="api"] {
    border-left: 3px solid #5cb85c;
    padding-left: 7px;
}

.log-output div[data-source="database"] {
    border-left: 3px solid #f0ad4e;
    padding-left: 7px;
}

.log-output div[data-source="client"] {
    border-left: 3px solid #777;
    padding-left: 7px;
    font-style: italic;
}

.log-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

#current-account {
    font-weight: bold;
    margin: 0.5rem 0;
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.25rem;
}

.success {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.error {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

#analytics-table_wrapper .dt-input[type="search"] {
    
    padding-left: 3em !important;
    
}

.dataTable [role="button"] {
    all: unset !important;
    background: green !important; 
    cursor: pointer;
}                           
.dt-type-date, .dt-type-number {
    white-space: nowrap;
}

.dataTable thead th {
    white-space: nowrap;
    padding-left: 0.5rem;
}

.dt-ordering-asc, .dt-ordering-desc { 
    color: white;
    background-color: var(--pico-color-azure-600);
}

.formsettings input {
    width: unset;
}

.dt-input {
    width: 5em;
}
.dt-search #dt-search-0 {
    width: 20em !important;
}
.dt-search label {
    display: inline-block;
}

/* ======================================================
   AUTO-SCROLL INDICATOR - CIRCULAR BUTTON
   ====================================================== */

/* Auto-scroll indicator - Circular button in upper right of log container, sticky */
#auto-scroll-indicator {
    position: sticky !important;
    top: 10px !important;
    right: 10px !important;
    z-index: 1000 !important;
    width: 50px !important;
    height: 50px !important;
    border-radius: 50% !important;
    background: #007bff !important;
    border: 2px solid #fff !important;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    color: white !important;
    font-size: 18px !important;
    font-weight: bold !important;
    float: right !important;
    margin: 10px !important;
}

#auto-scroll-indicator:hover {
    background: #0056b3 !important;
    transform: scale(1.1) !important;
    box-shadow: 0 6px 16px rgba(0, 123, 255, 0.4) !important;
}

#auto-scroll-indicator:active {
    transform: scale(0.95) !important;
}

#auto-scroll-indicator .scroll-arrow {
    display: block !important;
    width: 0 !important;
    height: 0 !important;
    border-left: 8px solid transparent !important;
    border-right: 8px solid transparent !important;
    border-top: 12px solid white !important;
    margin-top: 2px !important;
}

#auto-scroll-indicator .scroll-text {
    display: none !important;
}

#auto-scroll-indicator.hidden {
    opacity: 0 !important;
    pointer-events: none !important;
}

#auto-scroll-indicator {
    opacity: 1 !important;
    transition: opacity 0.1s ease !important;
}