/* ========================================
   Общие стили и сброс
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --color-primary: #2c3e50;
    --color-secondary: #34495e;
    --color-accent: #3498db;
    --color-text: #333333;
    --color-text-light: #666666;
    --color-border: #e0e0e0;
    --color-background: #f8f9fa;
    --font-main:
        -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
        "Ubuntu", "Cantarell", sans-serif;
    --max-width: 850px;
}

body {
    font-family: var(--font-main);
    font-size: 13px;
    line-height: 1.4;
    color: var(--color-text);
    background-color: var(--color-background);
    padding: 15px;
}

/* ========================================
   Контейнер резюме
   ======================================== */
.resume-container {
    max-width: var(--max-width);
    margin: 0 auto;
    background-color: white;
    padding: 35px 45px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

/* ========================================
   Шапка резюме
   ======================================== */
.resume-header {
    margin-bottom: 18px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--color-primary);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.header-content {
    flex: 1;
}

.photo-container {
    flex-shrink: 0;
}

.resume-photo {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 4px;
    border: 2px solid var(--color-border);
}

.name {
    font-size: 26px;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 4px;
}

.title {
    font-size: 15px;
    color: var(--color-secondary);
    font-weight: 500;
    margin-bottom: 10px;
}

.location {
    color: var(--color-text-light);
    margin-bottom: 5px;
    font-size: 12px;
}

.contacts {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 5px;
    font-size: 12px;
}

.contact-link {
    color: var(--color-accent);
    text-decoration: none;
    transition: color 0.2s;
}

.contact-link:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

.separator {
    color: var(--color-text-light);
    margin: 0 3px;
}

.links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 12px;
}

.link-item {
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 500;
}

.link-item:hover {
    text-decoration: underline;
}

/* ========================================
   Секции
   ======================================== */
.resume-section {
    margin-bottom: 16px;
    page-break-inside: avoid;
}

.summary-section {
    margin-bottom: 18px;
}

.section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--color-border);
}

.section-content {
    color: var(--color-text);
}

/* ========================================
   Summary
   ======================================== */
.summary {
    margin-bottom: 8px;
    line-height: 1.5;
    text-align: justify;
}

.looking-for {
    font-weight: 600;
    color: var(--color-secondary);
    font-style: italic;
    font-size: 12px;
}

/* ========================================
   Двухколоночный layout
   ======================================== */
.two-column-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 30px;
}

.sidebar {
    /* Левая колонка */
}

.main-content {
    /* Правая колонка */
}

/* ========================================
   Навыки
   ======================================== */
.skills-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.skill-tag {
    background-color: #e8f4f8;
    color: var(--color-primary);
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    border: 1px solid #d0e8f0;
}

/* ========================================
   Опыт работы
   ======================================== */
.experience-item {
    margin-bottom: 14px;
    page-break-inside: avoid;
}

.experience-item:last-child {
    margin-bottom: 0;
}

.experience-header {
    margin-bottom: 6px;
}

.experience-title {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 3px;
    flex-wrap: wrap;
    gap: 8px;
}

.company-position {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-secondary);
}

.company {
    color: var(--color-primary);
}

.period {
    font-size: 12px;
    color: var(--color-text-light);
    font-weight: 500;
}

.duration {
    font-size: 11px;
    color: var(--color-text-light);
    font-style: italic;
}

.experience-description {
    margin-bottom: 6px;
    color: var(--color-text);
    line-height: 1.4;
    font-size: 12px;
}

.achievements {
    list-style: none;
    margin-bottom: 6px;
}

.achievements li {
    position: relative;
    padding-left: 15px;
    margin-bottom: 4px;
    line-height: 1.4;
    font-size: 12px;
}

.achievements li::before {
    content: "▸";
    position: absolute;
    left: 0;
    color: var(--color-accent);
    font-weight: bold;
}

.stack {
    margin-top: 6px;
    padding: 6px 10px;
    background-color: #f5f5f5;
    border-left: 3px solid var(--color-accent);
    font-size: 11px;
    line-height: 1.4;
}

.stack-label {
    font-weight: 600;
    color: var(--color-secondary);
    margin-right: 5px;
}

/* ========================================
   Образование
   ======================================== */
.education-item {
    margin-bottom: 10px;
}

.education-item:last-child {
    margin-bottom: 0;
}

.education-header {
    display: flex;
    flex-direction: column;
    margin-bottom: 3px;
    gap: 3px;
}

.institution {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-secondary);
}

.degree {
    color: var(--color-text);
    font-size: 12px;
}

/* ========================================
   Языки
   ======================================== */
.languages-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.language-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 12px;
}

.language-name {
    font-weight: 600;
    color: var(--color-secondary);
}

.language-level {
    color: var(--color-text-light);
    font-size: 11px;
}

/* ========================================
   Кнопка экспорта
   ======================================== */
.print-controls {
    max-width: var(--max-width);
    margin: 0 auto 15px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.lang-btn {
    background-color: var(--color-secondary);
    color: white;
    border: none;
    padding: 10px 0;
    font-size: 13px;
    font-weight: 700;
    border-radius: 4px;
    cursor: pointer;
    transition:
        background-color 0.2s,
        transform 0.1s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: 50px;
}

.lang-btn:hover {
    background-color: var(--color-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

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

.export-btn {
    background-color: var(--color-accent);
    color: white;
    border: none;
    padding: 10px 0;
    font-size: 13px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition:
        background-color 0.2s,
        transform 0.1s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: 160px;
}

.export-btn:hover {
    background-color: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

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

/* ========================================
   Стили для печати - УЛЬТРА КОМПАКТНЫЕ
   ======================================== */
@media print {
    /* Скрыть элементы управления */
    .no-print {
        display: none !important;
    }

    /* Сброс фона и отступов */
    body {
        background-color: white;
        padding: 0;
        margin: 0;
        font-size: 8.5pt;
        line-height: 1.2;
    }

    .resume-container {
        max-width: 100%;
        padding: 8pt 12pt;
        margin: 0;
        box-shadow: none;
        border-radius: 0;
    }

    /* Оптимизация размера шрифта для печати */
    .name {
        font-size: 17pt;
        margin-bottom: 1pt;
    }

    .title {
        font-size: 10.5pt;
        margin-bottom: 3pt;
    }

    .location {
        font-size: 8pt;
        margin-bottom: 1pt;
    }

    .contacts {
        font-size: 8pt;
        margin-bottom: 1pt;
        gap: 3pt;
    }

    .links {
        font-size: 8pt;
        gap: 6pt;
    }

    .resume-header {
        margin-bottom: 7pt;
        padding-bottom: 5pt;
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 10pt;
    }

    .header-content {
        flex: 1;
    }

    .photo-container {
        flex-shrink: 0;
    }

    .resume-photo {
        width: 70pt;
        height: 70pt;
        object-fit: cover;
        border-radius: 2pt;
        border: 0.5pt solid #ccc;
    }

    .summary-section {
        margin-bottom: 6pt;
    }

    .summary {
        font-size: 8.5pt;
        margin-bottom: 2pt;
        line-height: 1.25;
    }

    .looking-for {
        font-size: 8pt;
    }

    /* Двухколоночный layout для печати */
    .two-column-layout {
        display: grid;
        grid-template-columns: 165pt 1fr;
        gap: 12pt;
    }

    .section-title {
        font-size: 10.5pt;
        page-break-after: avoid;
        margin-bottom: 3pt;
        padding-bottom: 1pt;
        margin-top: 0;
    }

    .resume-section {
        margin-bottom: 7pt;
    }

    .sidebar .resume-section {
        margin-bottom: 9pt;
    }

    .sidebar .resume-section:last-child {
        margin-bottom: 0;
    }

    /* Навыки в строку с переносом */
    .skills-list {
        display: flex;
        flex-wrap: wrap;
        gap: 2pt;
    }

    .skill-tag {
        font-size: 7.5pt;
        padding: 1pt 4pt;
        background-color: #f0f0f0;
        border: 0.5pt solid #ccc;
        color: #333;
    }

    .company-position {
        font-size: 9.5pt;
    }

    .period {
        font-size: 8pt;
    }

    .duration {
        font-size: 7.5pt;
    }

    .experience-description {
        font-size: 8pt;
        margin-bottom: 2pt;
        line-height: 1.2;
    }

    .achievements {
        margin-bottom: 2pt;
    }

    .achievements li {
        font-size: 8pt;
        margin-bottom: 0.5pt;
        padding-left: 9pt;
        line-height: 1.2;
    }

    .achievements li::before {
        font-size: 6.5pt;
    }

    .stack {
        font-size: 7.5pt;
        padding: 1.5pt 4pt;
        margin-top: 2pt;
        background-color: #f8f8f8;
        border-left-width: 1.5pt;
        border-left-color: #666;
        line-height: 1.2;
    }

    .institution {
        font-size: 8.5pt;
    }

    .degree {
        font-size: 7.5pt;
    }

    .language-item {
        font-size: 7.5pt;
    }

    .language-name {
        font-size: 8pt;
    }

    .language-level {
        font-size: 7pt;
    }

    /* Предотвращение разрывов */
    .resume-section,
    .experience-item,
    .education-item {
        page-break-inside: avoid;
    }

    .experience-header {
        page-break-after: avoid;
    }

    .experience-item {
        margin-bottom: 5pt;
    }

    .experience-header {
        margin-bottom: 2pt;
    }

    .experience-title {
        margin-bottom: 1pt;
    }

    /* Убрать интерактивные стили */
    .contact-link,
    .link-item {
        color: var(--color-text);
        text-decoration: none;
    }

    /* Убрать тени */
    * {
        box-shadow: none !important;
    }

    /* Очень компактные отступы для education и languages */
    .education-item {
        margin-bottom: 5pt;
    }

    .education-header {
        margin-bottom: 1pt;
    }

    .languages-list {
        gap: 3pt;
    }

    /* Убираем пустые блоки описания если они есть */
    .experience-description:empty {
        display: none;
        margin: 0;
    }

    /* Для позиций без достижений делаем еще компактнее */
    .experience-item:has(.achievements:empty) {
        margin-bottom: 3pt;
    }
}

/* ========================================
   Responsive для мобильных
   ======================================== */
@media screen and (max-width: 768px) {
    body {
        padding: 8px;
        font-size: 12px;
    }

    .resume-container {
        padding: 25px 20px;
    }

    .resume-header {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }

    .header-content {
        width: 100%;
        text-align: center;
    }

    .photo-container {
        order: -1;
    }

    .resume-photo {
        width: 100px;
        height: 100px;
    }

    .name {
        font-size: 22px;
    }

    .title {
        font-size: 14px;
    }

    /* На мобильных делаем одноколоночную верстку */
    .two-column-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .experience-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 3px;
    }

    .period {
        margin-left: 0;
    }

    .education-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 3px;
    }
}
