/* ============================================
   UEB.SU — Цитатник Рунета
   Стиль: bashorg.ru (пастельные тона)
   ============================================ */

/* ---------- Светлая тема (по умолчанию) ---------- */
:root {
    --bg-body: #f5f4f2;
    --bg-card: #fff;
    --bg-header: #fff;
    --bg-sections: #edece8;
    --text-main: #252323;
    --text-muted: #827e7c;
    --text-header: #252323;
    --text-logo-sub: #9e9b98;
    --accent: #859900;
    --accent-hover: #a4bd00;
    --accent-active: #859900;
    --down-color: #d33682;
    --border: #e6e5e0;
    --border-hover: #d2d0c7;
    --border-focus: #bdbbae;
    --shadow-header: 0 1px 1px 0 #e6e5e0;
    --shadow-card: 0 1px 1px 0 #e6e5e0;
    --radius-card: 3px;
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    --font-quote: Georgia, 'Palatino Linotype', 'Book Antiqua', Palatino, serif;
}

/* ---------- Тёмная тема ---------- */
body.dark {
    --bg-body: #252323;
    --bg-card: #252323;
    --bg-header: #252323;
    --bg-sections: #42413d;
    --text-main: #e0deda;
    --text-muted: #9e9b98;
    --text-header: #e0deda;
    --text-logo-sub: #6a6862;
    --accent: #859900;
    --accent-hover: #a4bd00;
    --accent-active: #859900;
    --down-color: #d33682;
    --border: #42413d;
    --border-hover: #56554f;
    --border-focus: #6a6862;
    --shadow-header: 0 1px 0 0 #42413d;
    --shadow-card: inset 0 0 0 1px #42413d;
}

/* ---------- Глобальные стили ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Ссылки — тёмные по умолчанию, зелёные при наведении */
body a:not(.share-btn):not(.logo-main),
.nav-links a,
.sections__link,
.footer-nav a,
.pager__item {
    color: var(--text-main);
    transition: color .25s;
    text-decoration: none;
}

body a:not(.share-btn):not(.logo-main):hover,
.nav-links a:hover,
.sections__link:hover,
.footer-nav a:hover {
    color: var(--accent-hover);
}

/* Активные ссылки — зелёные */
.nav-links a.active,
.pager__item.active {
    color: var(--accent) !important;
}

body {
    font-family: var(--font);
    background: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    font-size: 16px;
    transition: background-color .15s, color .15s;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ---------- Layout — column чтобы футер был внизу ---------- */
.container {
    flex: 1;
    max-width: 940px;
    margin: 0 auto;
    padding: 15px 20px;
    width: 100%;
}

/* ---------- Header ---------- */
.site-header {
    background-color: var(--bg-header);
    box-shadow: var(--shadow-header);
    transition: background-color .15s, box-shadow .15s;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 940px;
    margin: 0 auto;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.logo {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    text-align: left;
}

/* Убираем зелёный цвет с лого */
.logo,
.logo a,
.logo:hover {
    color: inherit;
    text-decoration: none;
}

.logo-main {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-header);
    letter-spacing: 1px;
    transition: color .15s;
}

.logo:hover .logo-main {
    color: var(--accent-hover);
}

.logo-sub {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
    font-family: 'Courier New', Courier, monospace;
    white-space: nowrap;
    margin-top: 2px;
}

.nav-links {
    display: flex;
    gap: 2px;
    align-items: center;
    flex-wrap: wrap;
}

.nav-links a {
    color: var(--text-main);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 3px;
    transition: color .25s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-links a:hover {
    color: var(--accent-hover);
    background-color: rgba(133, 153, 0, 0.1);
}

.nav-links a.active {
    color: var(--accent) !important;
    font-weight: 700;
}

/* ---------- Theme Toggle ---------- */
#theme-toggle {
    background: transparent;
    border: none;
    outline: none;
    cursor: pointer;
    font-size: 18px;
    padding: 6px;
    transition: color .25s;
    margin-left: 8px;
    display: flex;
    align-items: center;
}

#theme-toggle:hover {
    color: var(--accent-hover);
}

/* ---------- Sections (табы) ---------- */
.sections {
    overflow: hidden;
    margin: 15px auto 20px;
    max-width: 940px;
    height: 35px;
    transition: background-color .15s, height .15s;
}

.sections__list {
    margin: 0 10px;
    padding: 1px;
    height: 25px;
    display: flex;
    border-radius: 4px;
    background-color: var(--bg-sections);
}

.sections__item {
    flex: 1;
}

.sections__link {
    position: relative;
    padding: 0 10px;
    width: 100%;
    height: 24px;
    font-size: 14px;
    font-weight: 600;
    line-height: 22px;
    text-align: center;
    text-decoration: none;
    border-radius: 3px;
    white-space: nowrap;
    transition: background-color .15s, font-size .15s, box-shadow .15s;
    color: var(--text-main);
}

.sections__link.active {
    cursor: default;
    background-color: var(--bg-card);
    box-shadow: 0 1px 1px 0 var(--border);
}

/* ---------- Quote Card ---------- */
.quote-card {
    position: relative;
    margin: 10px 0;
    background-color: var(--bg-card);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    transition: background-color .15s, box-shadow .15s;
}

.quote-card:hover {
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    font-weight: 600;
    padding: 15px 15px 10px;
    transition: color .15s;
    color: var(--text-muted);
}

.quote-id {
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font);
}

.card-body {
    padding: 0 15px 20px;
    font-size: 19px;
    line-height: 1.6;
    transition: color .25s;
    overflow-wrap: break-word;
    font-family: var(--font-quote);
}

.card-footer {
    margin: 0;
    padding: 0;
    min-height: 45px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    transition: color .15s, box-shadow .15s;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    padding: 10px 15px;
}

/* ---------- Share Button ---------- */
.share-trigger {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0;
    background: none;
    border: none;
    outline: none;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: color .15s;
    font-family: var(--font);
}

.share-trigger:hover,
.share-trigger:focus {
    color: var(--accent);
}

/* ---------- Share Popup ---------- */
.share-popup {
    display: none;
    z-index: 50;
    padding: 12px 14px;
    margin: 0 15px 10px 15px;
    min-width: 0;
    background-color: var(--bg-card);
    box-shadow: 0 0 0 1px var(--border) inset, 0 4px 16px rgba(0,0,0,0.1);
    border-radius: 3px;
}

.share-popup.visible {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
    animation: fadeSlideDown 0.2s ease-out;
}

.share-popup .share-row {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    width: 100%;
}

.share-popup .share-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 3px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: opacity .2s;
    color: white;
    font-family: var(--font);
    white-space: nowrap;
    flex-shrink: 0;
}

.share-popup .share-btn:hover {
    opacity: 0.85;
}

@keyframes fadeSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- Vote Buttons ---------- */
.vote-buttons {
    display: flex;
    align-items: center;
    gap: 4px;
}

.vote-btn {
    width: auto;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    text-decoration: none;
    transition: color .15s;
    cursor: pointer;
    background: none;
    border: none;
    outline: none;
    padding: 4px 8px;
    border-radius: 3px;
    font-family: var(--font);
}

.vote-btn.up {
    color: var(--accent);
    background: rgba(133, 153, 0, 0.1);
}

.vote-btn.up:hover {
    background: rgba(133, 153, 0, 0.2);
}

.vote-btn.down {
    color: var(--down-color);
    background: rgba(211, 54, 130, 0.1);
}

.vote-btn.down:hover {
    background: rgba(211, 54, 130, 0.2);
}

.score {
    font-weight: 700;
    font-size: 15px;
    min-width: 24px;
    text-align: center;
    color: var(--text-main);
}

.vote-result {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    font-size: 14px;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-block;
    padding: 10px 50px;
    font-size: 14px;
    line-height: 18px;
    text-align: center;
    color: #fff;
    background-color: var(--accent);
    border: none;
    border-radius: 3px;
    transition: background-color .25s;
    text-decoration: none;
    cursor: pointer;
    font-family: var(--font);
}

.btn:hover {
    color: #fff;
    background-color: var(--accent-hover);
}

/* ---------- Forms ---------- */
.form-group {
    margin-bottom: 10px;
}

.form__label {
    display: block;
    padding: 0 0 5px;
    font-size: 14px;
    font-weight: 600;
}

textarea,
textarea.form__textarea {
    width: 100%;
    min-height: 400px;
    padding: 10px 12px;
    background-color: #fff;
    border: 1px solid var(--border);
    border-radius: 2px;
    font-family: var(--font);
    font-size: 15px;
    line-height: 18px;
    color: var(--text-main);
    resize: vertical;
    outline: none;
    transition: border-color .25s;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

body.dark textarea,
body.dark textarea.form__textarea {
    background-color: #252323;
    border-color: #42413d;
    color: #e0deda;
}

textarea:hover,
textarea.form__textarea:hover {
    border-color: var(--border-hover);
}

textarea:focus,
textarea.form__textarea:focus {
    border-color: var(--border-focus);
}

/* ---------- Search Form ---------- */
.search {
    position: relative;
    margin: 0 0 20px;
    display: block;
}

.search-form {
    display: flex;
    gap: 0;
    margin-bottom: 18px;
}

.search-input {
    flex: 1;
    padding: 0 42px 0 12px;
    width: 100%;
    height: 40px;
    background-color: #fff;
    border: 1px solid var(--border);
    border-radius: 2px;
    font-size: 15px;
    line-height: 18px;
    color: var(--text-main);
    font-family: var(--font);
    outline: none;
    transition: border-color .25s;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

body.dark .search-input {
    background-color: #252323;
    border-color: #42413d;
    color: #e0deda;
}

.search-input:hover {
    border-color: var(--border-hover);
}

.search-input:focus {
    border-color: var(--border-focus);
}

.search .search__button {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    padding: 0;
    width: 42px;
    height: 40px;
    color: var(--accent);
    background: none;
    border: none;
    outline: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color .15s;
    font-size: 18px;
}

.search .search__button:hover {
    color: var(--accent-hover);
}

.search .search__button[disabled] {
    opacity: 0.25;
    cursor: default;
    color: inherit !important;
}

/* ---------- Pagination ---------- */
.pager {
    position: relative;
    margin: 20px auto;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pager__item {
    box-sizing: border-box;
    margin: 0 0 0 -1px;
    flex-basis: 40px;
    flex-grow: 0;
    flex-shrink: 0;
    white-space: nowrap;
    height: 40px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default;
    border: 1px solid var(--border);
    transition: color .15s, border-color .15s, box-shadow .15s;
    text-decoration: none;
    color: var(--text-main);
    background-color: var(--bg-card);
}

.pager__item:first-of-type {
    border-radius: 2px 0 0 2px;
}

.pager__item:last-of-type {
    border-radius: 0 2px 2px 0;
}

.pager__item[href] {
    cursor: pointer;
}

.pager__item[href]:hover {
    border-color: var(--border-hover);
}

.pager__item[href]:focus {
    border-color: var(--border-focus);
}

.pager__item.active {
    font-weight: 700;
    background-color: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ---------- Footer ---------- */
.site-footer {
    width: 100%;
    margin: 40px auto 0;
    padding: 20px 20px 15px;
    font-size: 12px;
    line-height: 18px;
    text-align: center;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    flex-shrink: 0;
    background-color: var(--bg-body);
    transition: background-color .15s, border-color .15s;
}

/* ---------- Footer Navigation ---------- */
.footer-nav {
    margin: 0 auto 12px auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    max-width: 940px;
    gap: 4px;
}

.footer-nav a {
    padding: 6px 10px;
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    text-decoration: none;
    transition: color .25s;
    font-weight: 500;
}

.footer-nav a:hover {
    color: var(--accent);
}

/* ---------- Admin Actions ---------- */
.admin-actions {
    display: flex;
    gap: 6px;
    padding: 0 15px 12px;
}

.admin-actions .btn {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-danger {
    background: var(--down-color);
}

.btn-danger:hover {
    background-color: #e8469a;
}

.btn-success {
    background: var(--accent);
}

.btn-success:hover {
    background-color: var(--accent-hover);
}

/* ---------- Animations ---------- */
@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .header-inner {
        flex-direction: column;
        align-items: flex-start;
        padding: 12px 15px;
    }

    .nav-links {
        width: 100%;
        justify-content: flex-start;
    }

    .logo-sub {
        display: none;
    }

    .card-body {
        padding: 0 15px 15px;
        font-size: 17px;
    }

    .sections {
        margin-left: 15px;
        margin-right: 15px;
    }

    .footer-nav {
        flex-direction: column;
        gap: 0;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px 12px;
    }

    .quote-card {
        margin: 8px 0;
    }

    .card-header {
        padding: 12px 12px 8px;
    }

    .card-body {
        padding: 0 12px 12px;
        font-size: 16px;
    }

    .card-footer {
        padding: 8px 12px;
        font-size: 12px;
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
}
