:root {
    --primary-blue: #0066CC;
    --primary-blue-dark: #004C99;
    --primary-blue-light: #3385D6;
    --secondary-gray: #F5F7FA;
    --text-dark: #1A1A1A;
    --text-gray: #6B7280;
    --border-color: #E5E7EB;
    --success-green: #10B981;
    --error-red: #EF4444;
    --white: #FFFFFF;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--text-dark);
    background-color: var(--secondary-gray);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background-color: var(--white);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 0;
}

.logo h1 {
    font-size: 2rem;
    color: var(--primary-blue);
    font-weight: 700;
}

.logo h1 span {
    color: var(--text-gray);
    font-weight: 400;
}

.tagline {
    font-size: 0.875rem;
    color: var(--text-gray);
    margin-top: 0.25rem;
}

.nav {
    display: flex;
    gap: 2rem;
}

.nav-link {
    color: var(--text-gray);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-blue);
    border-bottom-color: var(--primary-blue);
}

.nav-telegram {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-telegram-icon {
    font-size: 1.1rem;
}

/* Бургер-меню */
.burger-menu {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 101;
}

.burger-line {
    width: 24px;
    height: 3px;
    background-color: var(--primary-blue);
    border-radius: 2px;
    transition: all 0.3s;
}

.burger-menu.active .burger-line:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.burger-menu.active .burger-line:nth-child(2) {
    opacity: 0;
}

.burger-menu.active .burger-line:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 3rem 0;
}

.hero-title {
    font-size: 2.5rem;
    color: var(--text-dark);
    margin-bottom: 1rem;
    font-weight: 700;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-gray);
}

/* Layout — всегда одна колонка, без перерисовки при результате */
.content-wrapper {
    max-width: 100%;
    margin-bottom: 4rem;
}

/* Cards */
.card {
    background-color: var(--white);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--secondary-gray);
}

/* Краткая инфо в форме (серия, диапазоны) */
.form-card-info {
    font-size: 0.875rem;
    color: var(--text-gray);
    margin: -0.5rem 0 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.info-label {
    color: var(--text-gray);
    font-weight: 500;
}

.info-value {
    color: var(--text-dark);
    font-weight: 600;
}

/* Support Card */
.support-card {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
    color: var(--white);
    text-align: center;
}

.support-card .card-title {
    color: var(--white);
    border-bottom-color: rgba(255, 255, 255, 0.2);
}

.support-text {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.telegram-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background-color: var(--white);
    color: var(--primary-blue);
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.telegram-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.telegram-icon {
    font-size: 1.25rem;
}

.telegram-username {
    font-size: 1rem;
}

/* Form */
.generator-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-label {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.required {
    color: var(--error-red);
}

.form-input,
.form-select {
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
    background-color: var(--white);
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.form-hint {
    color: var(--text-gray);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Buttons */
.btn {
    padding: 0.875rem 2rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--primary-blue);
    color: var(--white);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background-color: var(--primary-blue-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background-color: var(--secondary-gray);
    color: var(--text-dark);
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

/* Loader */
.btn-loader {
    width: 20px;
    height: 20px;
    border: 3px solid var(--white);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Result */
.result-card {
    margin-top: 2rem;
    animation: fadeIn 0.5s;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.result-header .card-title {
    margin: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.result-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.result-content {
    text-align: center;
}

/* Две колонки: чертеж слева, паспорт справа */
.result-panes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
    text-align: left;
}

.result-pane {
    min-width: 0;
}

.result-pane-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.result-pane-drawing .result-drawing img {
    width: 100%;
}

.result-pane-passport .result-passport-viewer {
    max-height: 75vh;
}

.result-drawing {
    margin-bottom: 0;
}

.result-drawing img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
}

.result-params {
    margin-top: 1rem;
    color: var(--text-gray);
    font-size: 0.9375rem;
}

.result-passport {
    text-align: left;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.result-passport-title {
    font-size: 1rem;
    color: var(--text-dark);
    margin-bottom: 0.75rem;
}

.result-passport-viewer {
    width: 100%;
    min-height: 320px;
    max-height: 70vh;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--secondary-gray);
    padding: 0.5rem;
}

.result-passport-viewer .pdf-embed {
    width: 100%;
    height: 420px;
    min-height: 420px;
    max-height: 70vh;
    border: none;
}

.result-passport-viewer .pdf-page-wrap {
    margin-bottom: 1rem;
    box-shadow: var(--shadow-md);
    border-radius: 4px;
    overflow: hidden;
}

.result-passport-viewer .pdf-page-wrap canvas {
    display: block;
    max-width: 100%;
    height: auto;
}

.result-passport-viewer .pdf-loading,
.result-passport-viewer .pdf-error {
    padding: 2rem;
    text-align: center;
    color: var(--text-gray);
}

.result-passport-viewer .pdf-error a {
    color: var(--primary-blue);
}

.result-passport-hint {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-gray);
}

.result-passport-hint a {
    color: var(--primary-blue);
    text-decoration: none;
}

.result-passport-hint a:hover {
    text-decoration: underline;
}

.result-drawing-hint {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-gray);
}

.result-drawing-hint a {
    color: var(--primary-blue);
    text-decoration: none;
}

.result-drawing-hint a:hover {
    text-decoration: underline;
}

.result-pane-actions {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-gray);
}

.result-pane-actions a {
    color: var(--primary-blue);
    text-decoration: none;
}

.result-pane-actions a:hover {
    text-decoration: underline;
}

.result-actions-sep {
    margin: 0 0.35rem;
    color: var(--text-gray);
    user-select: none;
}

/* Error */
.error-card {
    margin-top: 2rem;
    animation: fadeIn 0.5s;
}

.error-content {
    text-align: center;
}

.error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.error-title {
    color: var(--error-red);
    margin-bottom: 0.5rem;
}

.error-message {
    color: var(--text-gray);
    margin-bottom: 1.5rem;
}

/* Footer */
.footer {
    background-color: var(--white);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    margin-top: auto;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-left p {
    color: var(--text-gray);
}

.footer-right {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.footer-right a {
    color: var(--text-gray);
    text-decoration: none;
    transition: color 0.3s;
}

.footer-right a:hover {
    color: var(--primary-blue);
}

.footer-sep {
    color: var(--border-color);
    margin: 0 0.25rem;
}

.footer-support {
    color: var(--text-gray);
    font-size: 0.875rem;
}

.footer-link {
    color: var(--primary-blue);
}

.separator {
    color: var(--border-color);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }

    .header-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .logo {
        text-align: left;
    }

    .tagline {
        display: none;
    }

    /* Показываем бургер-меню */
    .burger-menu {
        display: flex;
    }

    /* Скрываем навигацию по умолчанию */
    .nav {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background-color: var(--white);
        box-shadow: -4px 0 12px rgba(0, 0, 0, 0.15);
        flex-direction: column;
        padding: 80px 2rem 2rem;
        gap: 0;
        transition: right 0.3s ease-in-out;
        z-index: 100;
    }

    /* Показываем меню когда активно */
    .nav.active {
        right: 0;
    }

    .nav-link {
        padding: 1rem 0;
        border-bottom: 1px solid var(--border-color);
        width: 100%;
        text-align: left;
    }

    .nav-link:last-child {
        border-bottom: none;
    }

    .footer-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .footer-right {
        flex-wrap: wrap;
        justify-content: center;
    }

    /* Результат: колонки друг под другом */
    .result-panes {
        grid-template-columns: 1fr;
    }
}