/*
 * Diário de Vacaria — Tema Escuro
 * O escopo .dvte-dark-mode evita alterações no painel administrativo e torna
 * toda a personalização facilmente reversível ao desativar o plugin.
 */

.dvte-theme-control {
    align-items: center;
    display: inline-flex;
    flex: 0 0 auto;
    line-height: 1;
    margin-left: 10px;
    position: relative;
    z-index: 1001;
}

.dvte-theme-toggle {
    align-items: center;
    background: #f7fafc;
    border: 1px solid rgba(15, 23, 42, 0.24);
    border-radius: 999px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.14);
    box-sizing: border-box;
    color: #263a3a;
    cursor: pointer;
    display: flex;
    height: 26px;
    justify-content: flex-start;
    padding: 2px;
    position: relative;
    transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
    width: 48px;
}

.dvte-theme-toggle::before {
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.26);
    content: '';
    height: 20px;
    left: 2px;
    position: absolute;
    top: 2px;
    transform: translateX(0);
    transition: transform 180ms ease;
    width: 20px;
}

.dvte-theme-toggle:hover {
    border-color: rgba(15, 23, 42, 0.5);
    box-shadow: 0 2px 5px rgba(15, 23, 42, 0.2);
}

.dvte-theme-toggle:focus-visible {
    outline: 3px solid #1976d2;
    outline-offset: 3px;
}

.dvte-theme-toggle__icon {
    align-items: center;
    display: flex;
    height: 20px;
    justify-content: center;
    position: absolute;
    top: 2px;
    transition: color 160ms ease, opacity 160ms ease;
    width: 20px;
    z-index: 1;
}

.dvte-theme-toggle__icon svg {
    fill: none;
    height: 14px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
    width: 14px;
}

.dvte-theme-toggle__icon--sun {
    color: #b45309;
    left: 2px;
}

.dvte-theme-toggle__icon--moon {
    color: #ffffff;
    opacity: 0.38;
    right: 2px;
}

html.dvte-dark-mode .dvte-theme-toggle {
    background: #132b2a;
    border-color: rgba(226, 232, 240, 0.42);
}

html.dvte-dark-mode .dvte-theme-toggle::before {
    transform: translateX(22px);
}

html.dvte-dark-mode .dvte-theme-toggle__icon--sun {
    opacity: 0.35;
}

html.dvte-dark-mode .dvte-theme-toggle__icon--moon {
    color: #f8fafc;
    opacity: 1;
}

/* Tema escuro: bases e superfícies de conteúdo. */
html.dvte-dark-mode,
html.dvte-dark-mode body,
html.dvte-dark-mode .tm-page,
html.dvte-dark-mode #tm-main,
html.dvte-dark-mode .tm-main,
html.dvte-dark-mode .tm-footer,
html.dvte-dark-mode footer,
html.dvte-dark-mode .uk-section-default,
html.dvte-dark-mode .uk-background-default,
html.dvte-dark-mode .uk-card-default,
html.dvte-dark-mode .uk-card-default .uk-card-body,
html.dvte-dark-mode .uk-navbar-dropdown,
html.dvte-dark-mode .uk-dropbar,
html.dvte-dark-mode .uk-offcanvas-bar,
html.dvte-dark-mode .uk-modal-dialog,
html.dvte-dark-mode .uk-tile-default {
    background-color: #10171f !important;
    color: #e7edf4 !important;
}

html.dvte-dark-mode .uk-section-muted,
html.dvte-dark-mode .uk-background-muted,
html.dvte-dark-mode .tm-bottom,
html.dvte-dark-mode .uk-card-muted,
html.dvte-dark-mode .uk-tile-muted {
    background-color: #17232d !important;
    color: #e7edf4 !important;
}

html.dvte-dark-mode .uk-section-secondary,
html.dvte-dark-mode .uk-background-secondary,
html.dvte-dark-mode .uk-card-secondary,
html.dvte-dark-mode .uk-tile-secondary {
    background-color: #0c1218 !important;
    color: #e7edf4 !important;
}

/* Mantém o verde institucional em seções primárias, mas melhora a leitura. */
html.dvte-dark-mode .uk-section-primary,
html.dvte-dark-mode .uk-background-primary,
html.dvte-dark-mode .uk-card-primary,
html.dvte-dark-mode .uk-tile-primary {
    background-color: #123e3b !important;
    color: #f1f5f9 !important;
}

html.dvte-dark-mode .uk-navbar-container,
html.dvte-dark-mode .uk-navbar-sticky,
html.dvte-dark-mode .tm-header .uk-navbar-container,
html.dvte-dark-mode .tm-header-mobile .uk-navbar-container {
    background-color: #10171f !important;
    color: #e7edf4 !important;
}

html.dvte-dark-mode body,
html.dvte-dark-mode p,
html.dvte-dark-mode li,
html.dvte-dark-mode dt,
html.dvte-dark-mode dd,
html.dvte-dark-mode blockquote,
html.dvte-dark-mode .uk-text-lead,
html.dvte-dark-mode .uk-text-meta {
    color: #cbd5e1 !important;
}

html.dvte-dark-mode h1,
html.dvte-dark-mode h2,
html.dvte-dark-mode h3,
html.dvte-dark-mode h4,
html.dvte-dark-mode h5,
html.dvte-dark-mode h6,
html.dvte-dark-mode .uk-heading-small,
html.dvte-dark-mode .uk-heading-medium,
html.dvte-dark-mode .uk-heading-large,
html.dvte-dark-mode .uk-heading-xlarge,
html.dvte-dark-mode .uk-article-title,
html.dvte-dark-mode .uk-nav-header {
    color: #f8fafc !important;
}

html.dvte-dark-mode a:not(.uk-button-primary):not(.uk-button-secondary) {
    color: #b7e4cf;
}

html.dvte-dark-mode a:not(.uk-button-primary):not(.uk-button-secondary):hover,
html.dvte-dark-mode a:not(.uk-button-primary):not(.uk-button-secondary):focus {
    color: #d8f3dc;
}

html.dvte-dark-mode .uk-navbar-nav > li > a,
html.dvte-dark-mode .uk-navbar-item,
html.dvte-dark-mode .uk-navbar-toggle,
html.dvte-dark-mode .uk-navbar-dropdown-nav > li > a,
html.dvte-dark-mode .uk-nav-default > li > a,
html.dvte-dark-mode .uk-nav-secondary > li > a,
html.dvte-dark-mode .uk-logo,
html.dvte-dark-mode .uk-search-input {
    color: #e7edf4 !important;
}

html.dvte-dark-mode .uk-search-input {
    border-color: #607284 !important;
}

html.dvte-dark-mode .uk-search-input::placeholder {
    color: #aab8c6 !important;
}

html.dvte-dark-mode .uk-hr,
html.dvte-dark-mode hr,
html.dvte-dark-mode .uk-divider-icon::after,
html.dvte-dark-mode .uk-divider-icon::before {
    border-color: #344555 !important;
}

html.dvte-dark-mode .uk-table th,
html.dvte-dark-mode .uk-table td,
html.dvte-dark-mode .uk-table-divider > tr:not(:first-child),
html.dvte-dark-mode .uk-table-divider > :not(:first-child) > tr,
html.dvte-dark-mode .uk-table-divider > :first-child > tr:not(:first-child) {
    border-color: #344555 !important;
    color: #e7edf4 !important;
}

html.dvte-dark-mode input,
html.dvte-dark-mode textarea,
html.dvte-dark-mode select {
    background-color: #17232d !important;
    border-color: #52667a !important;
    color: #f8fafc !important;
}

/* Oculta o controle se o JavaScript não conseguir posicioná-lo. */
.dvte-theme-control.dvte-theme-control--ready {
    visibility: visible;
}

@media (max-width: 639px) {
    .dvte-theme-control {
        margin-left: 7px;
    }

    .dvte-theme-toggle {
        height: 24px;
        width: 44px;
    }

    .dvte-theme-toggle::before {
        height: 18px;
        width: 18px;
    }

    html.dvte-dark-mode .dvte-theme-toggle::before {
        transform: translateX(20px);
    }

    .dvte-theme-toggle__icon {
        height: 18px;
        width: 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .dvte-theme-toggle,
    .dvte-theme-toggle::before,
    .dvte-theme-toggle__icon {
        transition: none;
    }
}
