/* Подключение шрифта Alteran */
@font-face {
    font-family: 'Alteran';
    src: url('/static/fonts/alteran.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

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

:root {
    --primary-green: #90EE90;
    --light-green: #E8F5E9;
    --dark-green: #4CAF50;
    --text-dark: #212121;
    --text-light: #757575;
    --bg-white: #FFFFFF;
    --bg-light: #FAFAFA;
    --border-color: #E0E0E0;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.15);
}

html {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-dark);
    background-color: var(--bg-light);
    line-height: 1.6;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
}

/* Контейнер для частиц фона */
.particles-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    font-family: 'Alteran', 'Arial', sans-serif;
    color: rgba(144, 238, 144, 0.5);
    font-size: 2rem;
    font-weight: normal;
    user-select: none;
    white-space: nowrap;
    will-change: transform;
    line-height: 1;
    display: block;
    visibility: visible;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    box-sizing: border-box;
    width: 100%;
}

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

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

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--text-dark);
}

.logo-text {
    border: 2px solid var(--text-dark);
    padding: 0.5rem 1rem;
    display: inline-block;
}

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

.nav-link {
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-link:hover {
    color: var(--dark-green);
}

.admin-link {
    color: var(--dark-green);
    display: none;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, var(--light-green) 0%, var(--bg-white) 100%);
    padding: 4rem 0;
    text-align: center;
    position: relative;
    z-index: 1;
}

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

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

/* Projects Section */
.projects-section {
    padding: 4rem 0;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(500px, 1fr));
    gap: 2rem;
    max-width: 100%;
    box-sizing: border-box;
}

.project-card {
    background-color: var(--bg-white);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    box-sizing: border-box;
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.project-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--light-green);
}

.project-title {
    font-size: 1.75rem;
    font-weight: bold;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

.project-industry {
    display: inline-block;
    background-color: var(--light-green);
    color: var(--text-dark);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
}

.project-images {
    margin: 1.5rem 0;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.project-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
}

.project-image:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-hover);
}

.project-results {
    margin: 1.5rem 0;
}

.section-title {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--text-dark);
    margin-bottom: 1rem;
}

.results-list {
    list-style: none;
}

.result-item {
    background-color: var(--light-green);
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: 6px;
    border-left: 4px solid var(--primary-green);
}

.project-resources {
    display: flex;
    gap: 2rem;
    margin: 1.5rem 0;
    padding: 1rem;
    background-color: var(--bg-light);
    border-radius: 8px;
}

.resource-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.resource-label {
    font-size: 0.875rem;
    color: var(--text-light);
    font-weight: 500;
}

.resource-value {
    font-size: 1.125rem;
    font-weight: bold;
    color: var(--text-dark);
}

.project-benefits {
    margin: 1.5rem 0;
    padding: 1rem;
    background-color: var(--light-green);
    border-radius: 8px;
}

.benefits-text {
    color: var(--text-dark);
    line-height: 1.8;
}

.project-tech-stack {
    margin: 1.5rem 0;
}

.tech-stack-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

.tech-item {
    background-color: var(--light-green);
    padding: 0.75rem 1rem;
    border-radius: 6px;
    border-left: 4px solid var(--primary-green);
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 0.75rem;
    max-width: 100%;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

.tech-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tech-icon-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: brightness(0);
}

.tech-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    min-width: 0;
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.tech-label {
    font-size: 0.875rem;
    color: var(--text-light);
    font-weight: 500;
}

.tech-value {
    font-size: 1rem;
    font-weight: bold;
    color: var(--text-dark);
}

.tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.25rem;
    max-width: 100%;
    min-width: 0;
}

.tech-tag {
    display: inline-block;
    background-color: var(--bg-white);
    color: var(--text-dark);
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    box-shadow: 0 1px 3px rgba(144, 238, 144, 0.3), 0 0 0 1px rgba(144, 238, 144, 0.2);
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
    box-sizing: border-box;
    transition: all 0.3s ease;
    cursor: default;
}

.tech-tag:hover {
    box-shadow: 0 2px 6px rgba(144, 238, 144, 0.4), 0 0 0 1px rgba(144, 238, 144, 0.3);
    transform: translateY(-1px);
    background-color: var(--light-green);
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-light);
    font-size: 1.25rem;
}

/* Main */
.main {
    flex: 1;
}

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

/* LLM Generation Section */
.llm-generation-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: var(--light-green);
    border-radius: 8px;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.llm-generation-title {
    margin-bottom: 1rem;
    font-size: 1.25rem;
    color: var(--text-dark);
    word-wrap: break-word;
}

.llm-generation-forms {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    width: 100%;
    box-sizing: border-box;
}

.llm-generation-form {
    flex: 1;
    min-width: 300px;
    max-width: 100%;
    box-sizing: border-box;
}

.llm-form-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    width: 100%;
    box-sizing: border-box;
    align-items: flex-start;
}

.llm-textarea {
    flex: 1;
    min-height: 80px;
    min-width: 200px;
    box-sizing: border-box;
}

.llm-input {
    flex: 1;
    min-width: 200px;
    box-sizing: border-box;
}

.llm-button {
    align-self: flex-start;
    white-space: nowrap;
    box-sizing: border-box;
    flex-shrink: 0;
}

/* Адаптивность */
@media (max-width: 768px) {
    .projects-grid {
        grid-template-columns: 1fr;
    }

    .hero-title {
        font-size: 2rem;
    }

    .project-resources {
        flex-direction: column;
        gap: 1rem;
    }

    .tech-stack-grid {
        grid-template-columns: 1fr;
    }

    .project-card {
        padding: 1.5rem;
    }

    .tech-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .tech-content {
        width: 100%;
    }

    .llm-generation-section {
        padding: 1rem;
        margin-left: 0;
        margin-right: 0;
    }

    .llm-generation-forms {
        flex-direction: column;
        gap: 1rem;
    }

    .llm-generation-form {
        min-width: 0;
        width: 100%;
        max-width: 100%;
    }

    .llm-form-row {
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
    }

    .llm-textarea,
    .llm-input {
        min-width: 0;
        width: 100%;
        max-width: 100%;
    }

    .llm-button {
        width: 100%;
        align-self: stretch;
        white-space: normal;
        word-wrap: break-word;
    }

    .admin-container {
        padding: 1rem;
        margin: 1rem auto;
    }
}

/* Админ стили */
.admin-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
    background-color: var(--bg-white);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.admin-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

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

.form-label {
    font-weight: 500;
    color: var(--text-dark);
}

.form-input,
.form-textarea,
.form-select {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.tech-stack-textarea {
    min-height: 44px;
    max-height: 300px;
    resize: none;
    overflow-y: auto;
    flex: 1;
    line-height: 1.5;
}

.form-button {
    padding: 0.75rem 1.5rem;
    background-color: var(--dark-green);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s;
}

.form-button:hover {
    background-color: #45a049;
}

.form-button-secondary {
    background-color: var(--text-light);
}

.form-button-secondary:hover {
    background-color: #616161;
}

.form-button-danger {
    background-color: #f44336;
}

.form-button-danger:hover {
    background-color: #da190b;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.admin-table th,
.admin-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.admin-table th {
    background-color: var(--bg-light);
    font-weight: 600;
}

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

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.login-container {
    max-width: 400px;
    margin: 4rem auto;
    padding: 2rem;
    background-color: var(--bg-white);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.login-title {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2rem;
    color: var(--text-dark);
}

.alert {
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.alert-error {
    background-color: #ffebee;
    color: #c62828;
    border-left: 4px solid #c62828;
}

.alert-success {
    background-color: var(--light-green);
    color: var(--dark-green);
    border-left: 4px solid var(--dark-green);
}

/* Модальное окно для увеличения изображений */
.image-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s;
}

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

.image-modal-content {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.3s;
}

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.image-modal-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
    z-index: 1001;
    line-height: 1;
}

.image-modal-close:hover,
.image-modal-close:focus {
    color: var(--primary-green);
}

@media (max-width: 768px) {
    .image-modal-close {
        top: 15px;
        right: 20px;
        font-size: 30px;
    }

    .image-modal-content {
        max-width: 95%;
        max-height: 95%;
    }
}