/* ============================================================
   theme.css — общие стили ailimit.ru
   ============================================================ */

/* ============================================================
   СВЕТЛАЯ ТЕМА (по умолчанию)
   ============================================================ */
:root {
    --bg:            #f5f5f7;
    --bg-card:       #ffffff;
    --bg-input:      #ffffff;
    --bg-hover:      #f0f0f2;
    --bg-active:     #e8e8ec;

    --text:          #1a1a1a;
    --text-muted:    #666666;
    --text-dim:      #999999;

    --border:        #e0e0e5;
    --border-hover:  #c0c0c5;

    --accent:        #da7756;
    --accent-hover:  #e0886a;
    --accent-text:   #ffffff;

    --link:          #3b82f6;
    --success:       #22c55e;
    --warning:       #eab308;
    --error:         #ef4444;
    --info:          #3b82f6;

    --shadow:        0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-lg:     0 4px 12px rgba(0,0,0,0.1);
}

/* ============================================================
   ТЁМНАЯ ТЕМА
   ============================================================ */
body.dark {
    --bg:            #121212;
    --bg-card:       #1e1e1e;
    --bg-input:      #2d2d2d;
    --bg-hover:      #2a2a2a;
    --bg-active:     #333333;

    --text:          #ffffff;
    --text-muted:    #aaaaaa;
    --text-dim:      #666666;

    --border:        #3c3c3c;
    --border-hover:  #555555;

    --accent:        #da7756;
    --accent-hover:  #e0886a;
    --accent-text:   #ffffff;

    --link:          #4a90e2;
    --success:       #2ecc71;
    --warning:       #f1c40f;
    --error:         #ff6b6b;
    --info:          #4a90e2;

    --shadow:        0 1px 3px rgba(0,0,0,0.5);
    --shadow-lg:     0 4px 12px rgba(0,0,0,0.6);
}

/* ============================================================
   ОБЩИЕ
   ============================================================ */
* { box-sizing: border-box; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 0;
    padding: 15px;
    line-height: 1.5;
    transition: background 0.2s, color 0.2s;
}

/* ============================================================
   ШАПКА
   ============================================================ */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

/* === ЛОГОТИП === */
.app-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
    line-height: 1;
    font-family: inherit;
}

.app-logo .logo-icon,
.app-logo img {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    display: block;
    object-fit: contain;
}

.app-logo .logo-text {
    display: inline-flex;
    align-items: baseline;
    gap: 0;
}

.logo-ai {
    font-size: 22px;
    font-weight: 500;
    color: #3b82f6;
    letter-spacing: 0;
    line-height: 1;
    transition: color 0.2s;
}

.logo-domain {
    font-size: 22px;
    font-weight: 500;
    color: #0ccbbb;
    letter-spacing: 0;
    line-height: 1;
    transition: color 0.2s;
}

.app-logo:hover .logo-ai     { color: #2563eb; }
.app-logo:hover .logo-domain { color: #0aa39a; }

body.dark .logo-ai            { color: #60a5fa; }
body.dark .logo-domain        { color: #22d3c5; }
body.dark .app-logo:hover .logo-ai     { color: #93c5fd; }
body.dark .app-logo:hover .logo-domain { color: #5eead4; }

/* ============================================================
   НАВИГАЦИЯ (десктоп)
   ============================================================ */
.app-nav {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
    font-size: 14px;
}

.app-nav a {
    color: var(--text-muted);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.15s;
    font-weight: 500;
    line-height: 1;
    background: none;
    padding: 0;
    border: none;
}

.app-nav a svg {
    color: inherit;
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.app-nav a:hover {
    color: var(--text);
    text-decoration: none;
}

.app-nav a:hover svg {
    opacity: 1;
}

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

.app-nav a.active svg {
    color: var(--accent);
    opacity: 1;
}

.app-nav a.logout {
    color: var(--error);
}

.app-nav a.logout svg {
    color: inherit;
    opacity: 1;
}

/* ============================================================
   КНОПКА ТЕМЫ
   ============================================================ */

/* Десктоп — компактная круглая иконка */
.theme-toggle {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
    flex-shrink: 0;
    font-family: inherit;
}

.theme-toggle:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    color: var(--accent);
}

.theme-toggle svg {
    flex-shrink: 0;
}

/* На десктопе текст темы скрыт */
.theme-toggle .theme-text {
    display: none;
}

/* ============================================================
   ГАМБУРГЕР — базовые стили (скрыт на десктопе)
   ============================================================ */
.hamburger {
    display: none;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 42px;
    height: 42px;
    cursor: pointer;
    padding: 8px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    transition: background 0.15s;
    flex-shrink: 0;
    font-family: inherit;
}

.hamburger:hover {
    background: var(--bg-hover);
}

.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.25s, opacity 0.25s;
}

.hamburger[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.hamburger[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}
.hamburger[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Кнопка ✕ внутри меню — скрыта по умолчанию */
.nav-close {
    display: none;
}

/* ============================================================
   МОБИЛЬНАЯ ВЕРСИЯ (≤ 768px)
   ============================================================ */
@media (max-width: 768px) {

    /* === Шапка: лого слева, гамбургер справа === */
    .app-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        flex-wrap: nowrap;
        gap: 10px;
    }

    /* === Гамбургер — виден === */
    .hamburger {
        display: flex;
        position: relative;
        z-index: 10001;
    }

    /* Скрываем гамбургер, когда меню открыто */
    body.menu-open .hamburger {
        visibility: hidden;
        opacity: 0;
        pointer-events: none;
    }

    /* === Выдвижное меню === */
    .app-nav {
        position: fixed;
        top: 0;
        right: 0;
        width: min(320px, 85vw);
        height: 100vh;
        background: var(--bg-card);
        border-left: 1px solid var(--border);
        box-shadow: -8px 0 24px rgba(0,0,0,0.3);
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 80px 20px 20px 20px;
        transform: translateX(100%);
        transition: transform 0.25s ease;
        z-index: 10000;
        overflow-y: auto;
    }

    .app-nav.open {
        transform: translateX(0);
    }

    /* === Кнопка ✕ внутри меню === */
    .nav-close {
        display: block;
        position: absolute;
        top: 15px;
        right: 15px;
        background: transparent;
        border: none;
        color: var(--text-muted);
        font-size: 28px;
        line-height: 1;
        cursor: pointer;
        padding: 5px 10px;
        border-radius: 6px;
        font-family: inherit;
    }

    .nav-close:hover {
        background: var(--bg-hover);
        color: var(--error);
    }

    /* === Пункты меню === */
    .app-nav a {
        padding: 14px 16px;
        font-size: 15px;
        border-radius: 8px;
        gap: 10px;
        color: var(--text-muted);
        text-decoration: none;
        display: flex;
        align-items: center;
    }

    .app-nav a:hover {
        background: var(--bg-hover);
        color: var(--text);
    }

    .app-nav a.active {
        background: var(--bg-active);
        color: var(--accent);
        font-weight: 700;
    }

    /* === Кнопка темы — квадратная === */
    /* === Кнопка темы — как пункт меню === */
    .app-nav .theme-toggle {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 10px;
        width: 100%;
        height: auto;
        padding: 14px 16px;
        margin: 0;
        background: transparent;
        border: none;
        border-radius: 8px;
        color: var(--text-muted);
        font-size: 15px;
        font-weight: 500;
        font-family: inherit;
        cursor: pointer;
        text-align: left;
        transition: background 0.15s, color 0.15s;
    }

    .app-nav .theme-toggle:hover {
        background: var(--bg-hover);
        color: var(--text);
    }

    .app-nav .theme-toggle svg {
        width: 16px;
        height: 16px;
        flex-shrink: 0;
        opacity: 0.7;
    }

    /* На мобильных текст виден */
    .app-nav .theme-toggle .theme-text {
        display: inline;
    }

    .app-nav .theme-toggle .theme-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 16px;
        height: 16px;
    }


    /* === «Выйти» внизу === */
    .app-nav a.logout {
        margin-top: auto;
        border-top: 1px solid var(--border);
        padding-top: 20px;
        padding-left: 0;
        padding-right: 0;
        color: var(--error);
        border-radius: 0;
    }

    .app-nav a.logout:hover {
        background: transparent;
        color: var(--error);
        text-decoration: underline;
    }

    /* === Затемнение === */
    body.menu-open::after {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 9999;
        animation: fadeIn 0.2s;
    }

    @keyframes fadeIn {
        from { opacity: 0; }
        to   { opacity: 1; }
    }
}

/* ============================================================
   ПЛАШКА "В РАЗРАБОТКЕ"
   ============================================================ */
.dev-banner-global {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
    padding: 12px 18px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    line-height: 1.5;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
}

.dev-banner-global svg {
    flex-shrink: 0;
}

.dev-banner-global b {
    font-weight: 800;
}

/* Для страниц-карточек — плашка сверху экрана */
@media (min-width: 768px) {
    .dev-banner-global.on-card-page {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        margin: 0;
        border-radius: 0;
        max-width: 100%;
        justify-content: center;
        text-align: center;
        z-index: 9998;
    }
    body:has(.dev-banner-global.on-card-page) {
        padding-top: 60px;
    }
}

/* ============================================================
   ФУТЕР
   ============================================================ */
.app-footer {
    border-top: 1px solid var(--border);
    margin-top: 40px;
    padding: 30px 0 20px 0;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.6;
}

.app-footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.app-footer-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
}

.app-footer-logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    line-height: 1;
}

.app-footer-copy {
    margin: 0;
    color: var(--text-dim);
    font-size: 12px;
}

.app-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    align-items: center;
}

.app-footer-links a {
    color: var(--link);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.15s;
}

.app-footer-links a:hover {
    color: var(--accent);
    text-decoration: underline;
}

.app-footer-disclaimer {
    background: var(--bg-hover);
    border-left: 3px solid var(--warning);
    border-radius: 0 6px 6px 0;
    padding: 12px 16px;
    font-size: 11px;
    line-height: 1.6;
    color: var(--text-muted);
}

.app-footer-disclaimer p {
    margin: 0;
}

.app-footer-disclaimer b {
    color: var(--warning);
}

@media (max-width: 768px) {
    .app-footer-links {
        flex-direction: column;
        gap: 10px;
    }
    .app-footer-disclaimer {
        font-size: 11px;
        padding: 10px 12px;
    }
}
/* ============================================================
   ФОРМА ЗАДАЧИ — селект + кнопка в строку
   ============================================================ */
.task-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
    margin-bottom: 12px;
}

.task-row .task-select {
    flex: 1;
    margin-bottom: 0;    /* убираем margin, он уже есть у .task-row */
}

.task-row .task-btn {
    width: auto;         /* не растягиваем на всю ширину */
    min-width: 200px;
    margin: 0;
    padding: 12px 24px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Мобильные — в столбик */
@media (max-width: 640px) {
    .task-row {
        flex-direction: column;
        gap: 8px;
    }
    .task-row .task-btn {
        width: 100%;
        min-width: 0;
    }
}