/* ============================================================
   base.css — Базовые стили all-positions.ru в дизайн-языке
   ClickShot: белый фон, ink-шкала, сигнальный лайм, шрифты
   Geologica / Onest / JetBrains Mono.
   Завязан на токены из variables.css.
   ============================================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

*::selection { background: var(--accent); color: var(--accent-on); }

body {
    font-family: var(--font-body);
    background-color: var(--color-bg-primary);
    color: var(--color-text-primary);
    line-height: 1.5;
    font-size: 13px;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    letter-spacing: -0.02em;
    color: var(--color-text-primary);
}

a { color: var(--color-text-primary); }

.container {
    display: flex;
    flex: 1;
    align-items: stretch;
    min-height: 0;
}

/* ====================== КНОПКИ ====================== */

button {
    cursor: pointer;
    border: 1px solid var(--ink-200);
    background-color: var(--white);
    color: var(--ink-700);
    padding: 4px 14px;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: var(--radius-md);
    transition: transform var(--dur-2) var(--ease-out),
                background var(--dur-2) var(--ease-out),
                color var(--dur-2) var(--ease-out),
                border-color var(--dur-2) var(--ease-out),
                box-shadow var(--dur-2) var(--ease-out);
}

button:hover {
    background-color: var(--ink-50);
    border-color: var(--ink-400);
    color: var(--ink-950);
}

button:active { transform: translateY(0); }

/* Линейные иконки — единый стиль во всём проекте */
.app-icon {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

/* Лаймовая главная кнопка — фирменный CTA ClickShot */
.btn-primary {
    background-color: var(--lime-400);
    color: var(--accent);
    border-color: var(--lime-400);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(181, 255, 81, 0.25), 0 4px 12px rgba(181, 255, 81, 0.18);
}

.btn-primary:hover {
    background-color: var(--lime);
    border-color: var(--lime);
    color: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 1px 2px rgba(197, 255, 26, 0.3), 0 6px 16px rgba(197, 255, 26, 0.22);
}

.btn-primary:active { transform: translateY(0); }

.btn-primary:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(181, 255, 81, 0.35),
                0 4px 12px rgba(181, 255, 81, 0.18);
}

/* Вторичная — белая с обводкой */
.btn-secondary {
    background-color: var(--white);
    color: var(--ink-700);
    border-color: var(--ink-200);
}

.btn-secondary:hover {
    background-color: var(--ink-50);
    color: var(--ink-950);
    border-color: var(--ink-400);
}

/* ====================== ПОЛЯ ВВОДА ====================== */

input, select, textarea {
    font-family: var(--font-body);
    border: 1px solid var(--ink-300);
    padding: 5px 8px;
    font-size: 13px;
    background-color: var(--white);
    color: var(--ink-950);
    width: 100%;
    height: 28px;
    border-radius: var(--radius-md);
    transition: border-color var(--dur-2) var(--ease-out),
                box-shadow var(--dur-2) var(--ease-out);
}

input::placeholder, textarea::placeholder { color: var(--ink-400); }

textarea {
    height: auto;
    min-height: 60px;
    line-height: 1.5;
    resize: vertical;
    border-radius: var(--radius-md);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--lime);
    box-shadow: 0 0 0 3px var(--fc-lime-ring);
}

/* Кастомная стрелка select */
select {
    appearance: none;
    -webkit-appearance: none;
    background-image:
        linear-gradient(45deg, transparent 50%, var(--ink-700) 50%),
        linear-gradient(135deg, var(--ink-700) 50%, transparent 50%);
    background-position:
        calc(100% - 14px) 50%,
        calc(100% - 10px) 50%;
    background-size: 4px 4px, 4px 4px;
    background-repeat: no-repeat;
    padding-right: 28px;
}

label {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    color: var(--ink-700);
}

/* ====================== ЧЕКБОКСЫ ====================== */

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: var(--white);
    border: 1.5px solid var(--ink-300);
    border-radius: var(--radius-sm);
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    box-shadow: none;
    outline: none;
    transition: all var(--dur-2) var(--ease-out);
}

input[type="checkbox"]:hover {
    border-color: var(--lime-600);
    background-color: var(--ink-50);
}

input[type="checkbox"]:checked {
    background-color: var(--lime-400);
    border-color: var(--lime-400);
}

input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--accent);
    font-size: 12px;
    font-weight: bold;
    line-height: 1;
}

input[type="checkbox"]:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--fc-lime-ring);
    border-color: var(--lime);
}

input[type="checkbox"]:checked:hover {
    background-color: var(--lime);
    border-color: var(--lime);
}

/* ====================== МОДАЛКИ ====================== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--color-overlay);
    z-index: 1000;
    backdrop-filter: blur(3px);
}

.modal.active,
.modal[style*="display: flex"],
.modal[style*="display:flex"] {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--white);
    border: 1px solid var(--ink-200);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-modal);
    animation: modalIn var(--dur-3) var(--ease-out);
}

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

/* Модальное окно выбора типа проверки */
#checkTypeModal .modal-content {
    max-width: 500px;
}

#checkTypeModal #btnCheckTypeSelected,
#checkTypeModal #btnCheckTypeAllRegions,
#checkTypeModal #btnCheckTypeAllEngines {
    width: 100%;
    text-align: left;
    justify-content: flex-start;
    padding: 12px;
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 0;
}

#checkTypeModal #btnCheckTypeSelected > div:first-child,
#checkTypeModal #btnCheckTypeAllRegions > div:first-child,
#checkTypeModal #btnCheckTypeAllEngines > div:first-child {
    font-weight: 600;
    margin-bottom: 4px;
    width: 100%;
}

#checkTypeModal #btnCheckTypeSelected > div:last-child,
#checkTypeModal #btnCheckTypeAllRegions > div:last-child,
#checkTypeModal #btnCheckTypeAllEngines > div:last-child {
    font-size: 11px;
    opacity: 0.8;
    width: 100%;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--ink-200);
}

.modal-header h3 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--ink-950);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 1;
    color: var(--ink-500);
}

.modal-close:hover {
    background: none;
    border: none;
    color: var(--ink-950);
}

.modal-body {
    padding: 20px;
}

.form-group {
    margin-bottom: 16px;
}

/* ====================== РЕГИОНЫ (чекбокс-список) ====================== */

.regions-checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.regions-checkbox-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
}

.regions-checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
}

.regions-checkbox-item label {
    margin: 0;
    cursor: pointer;
    flex: 1;
    font-size: 12px;
}

.regions-country-group {
    margin-top: 8px;
    margin-bottom: 4px;
}

.regions-country-group:first-child {
    margin-top: 0;
}

.regions-country-title {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-500);
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--ink-200);
}

.form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* ====================== ТАБЛИЦЫ (базовые) ====================== */

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 7px 8px;
    text-align: left;
    border-bottom: 1px solid var(--ink-150);
    font-size: 12px;
}

th {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ink-600);
    border-bottom: 1px solid var(--ink-200);
    background-color: var(--ink-50);
}

/* ============================================================
   ЛЕНДИНГ
   ============================================================ */

.landing-container {
    min-height: 100vh;
    background: var(--white);
}

.landing-header {
    position: sticky;
    top: 0;
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--ink-150);
    z-index: 100;
    padding: 14px 0;
}

.landing-header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.landing-logo {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin: 0;
    color: var(--ink-950);
}

.landing-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 80px 32px;
}

@media (max-width: 600px) {
    .landing-header-content,
    .landing-main { padding-left: 16px; padding-right: 16px; }
}

.landing-hero {
    text-align: center;
    margin-bottom: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.landing-hero-title {
    font-family: var(--font-display);
    font-size: clamp(34px, 5vw, 60px);
    font-weight: 600;
    font-stretch: 92%;
    margin-bottom: 20px;
    color: var(--ink-950);
    line-height: 1.06;
    letter-spacing: -0.045em;
    max-width: 900px;
    text-wrap: balance;
}

.landing-hero-subtitle {
    font-size: 19px;
    color: var(--ink-600);
    margin-bottom: 36px;
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.55;
}

.btn-large {
    padding: 16px 32px;
    font-size: 16px;
    height: auto;
    margin: 0 auto;
    display: inline-flex;
    border-radius: var(--radius-lg);
}

/* Карточки фич/преимуществ */
.landing-features,
.landing-advantages {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 100px;
}

.landing-feature,
.landing-advantage {
    padding: 28px;
    background-color: var(--white);
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-xl);
    box-shadow: var(--fc-shadow-flat);
    transition: transform var(--dur-3) var(--ease-out),
                box-shadow var(--dur-3) var(--ease-out),
                border-color var(--dur-3) var(--ease-out);
}

.landing-feature:hover,
.landing-advantage:hover {
    border-color: var(--ink-300);
    box-shadow: var(--fc-shadow-card);
    transform: translateY(-3px);
}

.landing-advantages-title {
    grid-column: 1 / -1;
    font-family: var(--font-display);
    font-size: clamp(28px, 3.5vw, 44px);
    font-weight: 600;
    letter-spacing: -0.04em;
    margin-bottom: 8px;
    text-align: center;
    color: var(--ink-950);
}

.landing-advantage-icon,
.landing-feature-icon {
    font-size: 34px;
    margin-bottom: 16px;
    line-height: 1;
}

.landing-advantage h3,
.landing-feature h3 {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 10px;
    color: var(--ink-950);
}

.landing-advantage p,
.landing-feature p {
    font-size: 15px;
    color: var(--ink-600);
    line-height: 1.6;
    margin: 0;
}

/* Лаймовая полоса-акцент */
.landing-advantage-highlight {
    grid-column: 1 / -1;
    padding: 24px;
    background-color: var(--lime-400);
    border-radius: var(--radius-xl);
    text-align: center;
}

.landing-advantage-highlight p {
    margin: 0;
    color: var(--accent);
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.5;
}

/* Финальный CTA-блок */
.landing-cta {
    text-align: center;
    padding: 72px 32px;
    background-color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: var(--radius-xl);
}

.landing-cta h2 {
    font-family: var(--font-display);
    font-size: clamp(28px, 3.5vw, 44px);
    font-weight: 600;
    letter-spacing: -0.04em;
    margin-bottom: 16px;
    color: var(--white);
}

.landing-cta p {
    font-size: 17px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 32px;
}

.landing-footer {
    margin-top: 100px;
    padding: 40px 24px;
    text-align: center;
    border-top: 1px solid var(--ink-150);
}

.footer__developer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    color: var(--ink-500);
}

.footer__developer span {
    color: var(--ink-500);
}

.footer__developer a {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    border-bottom: none;
    transition: opacity var(--dur-2) var(--ease-out);
}

.footer__developer a:hover {
    opacity: 0.7;
}

.developer-logo {
    height: 20px;
    width: auto;
    display: block;
}

/* Ошибка авторизации */
.auth-error {
    margin-top: 12px;
    padding: 10px 12px;
    background-color: var(--color-error-bg);
    border: 1px solid #fbb4ad;
    border-left: 3px solid var(--color-error);
    color: var(--color-error-text);
    font-size: 12px;
    text-align: center;
    border-radius: var(--radius-md);
}

@media (max-width: 768px) {
    .landing-hero { margin-bottom: 64px; }
    .landing-features,
    .landing-advantages { gap: 16px; margin-bottom: 64px; }
    .landing-cta { padding: 48px 24px; }
}

/* ============================================================
   ШАПКА ПРИЛОЖЕНИЯ
   ============================================================ */

#mainContainer {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.user-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--ink-200);
    background-color: var(--white);
    flex-shrink: 0;
    gap: 16px;
    box-shadow: var(--fc-shadow-flat);
}

.user-header-left {
    flex: 1;
    display: flex;
    align-items: center;
    min-width: 0;
    overflow: hidden;
}

.user-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.user-header #projectTitle {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.user-header #userInfo {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--ink-600);
    font-weight: 500;
}

.user-header #btnLogout {
    font-size: 11px;
    padding: 6px 12px;
    flex-shrink: 0;
}

.user-header #btnSettings {
    flex-shrink: 0;
}

.user-header #activeCheckInfo {
    font-family: var(--font-mono);
    transition: background var(--dur-2) var(--ease-out);
}

.user-header #activeCheckInfo:hover {
    background-color: var(--ink-150) !important;
}
