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

:root {
    /* Основные цвета */
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    
    /* Фон и карточки */
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    
    /* Текст */
    --text-color: #1e293b;
    --text-light: #64748b;
    --text-on-primary: #ffffff;
    
    /* Тени */
    --shadow-color: rgba(0, 0, 0, 0.1);
    --shadow: 0 1px 3px 0 var(--shadow-color), 0 1px 2px -1px var(--shadow-color);
    --shadow-lg: 0 10px 15px -3px var(--shadow-color), 0 4px 6px -4px var(--shadow-color);
    --shadow-primary-color: rgba(37, 99, 235, 0.1);
    --shadow-primary-hover-color: rgba(44, 36, 128, 0.07);
    --shadow-button-color: rgba(0, 0, 0, 0.03);
    --shadow-primary: 0 0 0 3px var(--shadow-primary-color);
    --shadow-primary-hover: 0 4px 14px 0 var(--shadow-primary-hover-color);
    --shadow-button: 0 2px 6px var(--shadow-button-color);
    
    /* Цвета метаболов (значения 0-255 для RGB компонентов) */
    /* Основной цвет метаболов (яркий цвет) */
    --metaball-color-r: 37;
    --metaball-color-g: 99;
    --metaball-color-b: 235;
    /* Цвет для смешивания (темный цвет, к которому переходит градиент) */
    --metaball-mix-color-r: 212;
    --metaball-mix-color-g: 222;
    --metaball-mix-color-b: 222;
    /* Прозрачность метаболов (0.0 - полностью прозрачно, 1.0 - непрозрачно) */
    --metaball-opacity: 0.8
}

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

/* Canvas для эффекта метаболов на фоне */
#metaballs-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

header {
    margin-bottom: 1rem;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 5px;
    width: 100%;
}

/* Навигация */
.navbar {
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    box-shadow: var(--shadow);
    outline: 1px solid var(--primary-color);
}

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

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

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--primary-color);
}

/* Основной контент */
main {
    flex: 1;
    padding: 2rem 0;
}

/* Заголовки */
h1, h2, h3 {
    color: var(--text-color);
    margin-bottom: 1rem;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

/* Кнопки */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--primary-color);
    color: var(--text-on-primary);
    text-decoration: none;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: background-color 0.2s;
    border: none;
    cursor: pointer;
    box-sizing: border-box;
    line-height: 1.5;
    font-size: 1rem;
    font-family: inherit;
    vertical-align: middle;
    min-height: 2.75rem;
}

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

.btn-primary {
    background-color: var(--primary-color);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--text-on-primary);
}

.btn-secondary:hover {
    background-color: #475569;
}

/* Hero секция */
.hero-section {
    text-align: center;
    padding: 3rem 0;
    margin-bottom: 3rem;
}

.hero-section h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.lead {
    font-size: 1.25rem;
    color: var(--text-light);
    margin-bottom: 2rem;
}

/* Сетка проектов */
.hobbies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 0rem;
}

/* Карточка проекта */
.hobby-card {
    background-color: var(--card-bg);
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
}

.hobby-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    outline: 1px solid var(--primary-color);
}

.hobby-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background-color: var(--border-color);
}

.hobby-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hobby-content {
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    flex: 1;
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.2s;
}

.hobby-content .project-avatar {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px var(--border-color);
    background: var(--border-color);
}
.hobby-content h2 {
    margin-bottom: 0;
    line-height: 1;
    font-size: 1.5rem;
}

.hobby-content:hover {
    color: var(--primary-color);
}

.hobby-content * {
    text-decoration: none;
}

.hobby-content h2,
.hobby-content h3 {
    margin-bottom: 0.5rem;
    color: inherit;
}

.hobby-description {
    color: var(--text-color);
    margin-bottom: 1rem;
    flex: 1;
}

.hobby-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: var(--text-light);
    margin-top: auto;
}

.entry-count {
    font-weight: 500;
}

/* Детальная страница проекта */

.hobby-detail-header {
    padding: 0 1.5rem 0 1.5rem;
}

.hobby-header-content {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
}

.hobby-title-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.project-avatar {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px var(--border-color);
    background: var(--border-color);
}

.hobby-header-content h1 {
    margin: 0;
    line-height: 1;
    font-size: 2.5rem;
}

.hobby-description-full {
    font-size: 1rem;
    color: var(--text-light);
    margin-bottom: 0.75rem;
    margin-top: 0.75rem;
    line-height: 1.2;
}

.hobby-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.btn-edit-project {
    background-color: var(--secondary-color);
    color: white;
}

.hobby-meta-large {
    display: flex;
    gap: 2rem;
    color: var(--text-light);
    font-size: 0.875rem;
}

.hobby-header-inline {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.hobby-content .project-avatar {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px var(--border-color);
    background: var(--border-color);
}
.hobby-header-inline h2 {
    margin: 0;
    font-size: 1.5rem;
    line-height: 1;
}
.hobby-description {
    font-size: 1rem;
    color: var(--text-color);
    margin-bottom: 1rem;
    margin-top: 0;
    flex: 1;
}

/* Список записей */
/* Лента постов */
.entries-feed {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

.entries-feed .entry-full {
    margin-bottom: 0;
}

.entries-feed .entry-full:last-child {
    margin-bottom: 0;
}

.entries-list {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.entry-card {
    background-color: var(--card-bg);
    border-radius: 0.75rem;
    padding: 2rem;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s;
}

.entry-card:hover {
    box-shadow: var(--shadow-lg);
}

.entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}


.entry-card h2 {
    margin-bottom: 0.5rem;
}

.entry-card h2 a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.2s;
}

.entry-card h2 a:hover {
    color: var(--primary-color);
}

.entry-content-preview {
    color: var(--text-light);
    margin-bottom: 1rem;
    line-height: 1.7;
}

.read-more {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.read-more:hover {
    text-decoration: underline;
}

/* Детальная страница записи */
.breadcrumb {
    margin-bottom: 2rem;
    font-size: 0.875rem;
    color: var(--text-light);
}

.breadcrumb a {
    color: var(--primary-color);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.entry-full {
    background-color: var(--card-bg);
    border-radius: 0.75rem;
    padding: 3rem;
    box-shadow: var(--shadow);
}

.entry-header-full {
    margin-bottom: 1rem;
    padding-bottom: 0rem;
    border-bottom: 1px solid var(--border-color);
}

.entry-meta-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

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

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

.entry-header-full h1,
.entry-header-full h2 {
    margin-bottom: 0rem;
}

.entry-meta {
    display: flex;
    gap: 2rem;
    color: var(--text-light);
    font-size: 0.875rem;
}

.entry-content-wrapper {
    position: relative;
}

.entry-content {
    font-size: 1.125rem;
    line-height: 1.2;
    overflow: hidden;
    transition: max-height 0.4s ease;
    margin: 0 0rem 1rem 0rem;
    word-wrap: break-word;
}

.entry-content.collapsed {
    /* Высота будет установлена через JavaScript в пикселях */
    max-height: 100px; /* Временное значение, будет переопределено JS */
}

.entry-content p {
    margin-bottom: 1.5rem;
}

.btn-expand-entry,
.toggle-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    margin: 0;
    font-size: 1rem;
    font-weight: 500;
    padding: 0;
    display: none; /* Скрываем по умолчанию, показываем через JS если нужно */
    text-align: left;
}

.btn-expand-entry:hover,
.toggle-btn:hover {
    text-decoration: underline;
    opacity: 0.8;
}

/* Изображения встроенные в текст поста */
.entry-image-inline {
    width: 100%;
    margin: 2rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.entry-image-inline img {
    width: 100%;
    height: auto;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    display: block;
}

.image-caption-inline {
    font-size: 0.875rem;
    color: var(--text-light);
    font-style: italic;
    text-align: center;
    margin: 0;
    padding: 0 1rem;
}

/* Старая галерея (оставлена на случай если понадобится) */
.entry-images-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin: 3rem 0;
}

.entry-image-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.entry-image-item img {
    width: 100%;
    height: auto;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
}

.image-caption {
    font-size: 0.875rem;
    color: var(--text-light);
    font-style: italic;
    text-align: center;
    margin: 0;
}

.image-count {
    color: var(--text-light);
    font-size: 0.875rem;
}

/* Превью изображений в списке постов */
.entry-images-preview {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.preview-thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 0.375rem;
    border: 1px solid var(--border-color);
}

.entry-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 1rem;
}

/* Навигация между записями */
.entry-navigation {
    display: flex;
    justify-content: space-between;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    gap: 1rem;
}

.nav-entry {
    padding: 1rem;
    background-color: var(--bg-color);
    border-radius: 0.5rem;
    text-decoration: none;
    color: var(--text-color);
    transition: background-color 0.2s;
    flex: 1;
    max-width: 300px;
}

.nav-entry:hover {
    background-color: var(--border-color);
}

.prev-entry {
    text-align: left;
}

.next-entry {
    text-align: right;
}

/* Сообщения */
.messages {
    margin-bottom: 2rem;
}

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

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Пустое состояние */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
}

.empty-state a {
    color: var(--primary-color);
    text-decoration: none;
}

.empty-state a:hover {
    text-decoration: underline;
}

/* Пагинация */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 3rem;
}

.page-info {
    color: var(--text-light);
}

.page-header {
    margin: 1rem 0 1rem 0;
    padding-left: 1.5rem;
}

/* Подвал */
footer {
    background-color: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0;
    margin-top: auto;
    text-align: center;
    color: var(--text-light);
}

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

    .nav-links {
        flex-direction: column;
        gap: 0.5rem;
    }

    .navbar .container {
        flex-direction: column;
        gap: 1rem;
    }

    .entry-navigation {
        flex-direction: column;
    }

    .nav-entry {
        max-width: 100%;
    }

    .hero-section h1 {
        font-size: 2rem;
    }

    .entry-full {
        padding: 1.5rem;
    }

    .hobby-actions {
        flex-direction: row;
        gap: 0.5rem;
    }

    .hobby-actions .btn {
        flex: 1;
        min-width: 0;
        white-space: nowrap;
        font-size: 0.9rem;
        padding: 0.6rem 1rem;
    }

    .hobby-header-content h1 {
        font-size: 1.8rem;
    }

    .hobby-detail-header {
        padding: 0 1rem;
    }

    .expand-btn-container {
        justify-content: flex-start;
        margin-left: 0;
        margin-right: 0;
        padding: 0;
        max-width: 100%;
        overflow: hidden;
    }

    .btn-expand-entry.toggle-btn {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
        white-space: nowrap;
        flex-shrink: 0;
        min-width: 0;
        max-width: 100%;
        min-height: 2.25rem;
        line-height: 1.5;
    }
}

/* Стили для страницы паролей */
.password-form-container {
    max-width: 600px;
    margin: 0 auto;
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
}

.master-password-form {
    text-align: center;
}

.master-password-form h2 {
    margin-bottom: 1rem;
    color: var(--text-color);
}

.help-text {
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-primary);
}

.form-text {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-light);
}

.error-message {
    color: #dc2626;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.passwords-table-container {
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    overflow-x: auto;
}

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

.passwords-table thead {
    background-color: var(--bg-color);
}

.passwords-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-color);
    border-bottom: 2px solid var(--border-color);
}

.passwords-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.passwords-table tbody tr:hover {
    background-color: var(--bg-color);
}

.passwords-table tbody tr:last-child td {
    border-bottom: none;
}

.password-display {
    font-family: 'Courier New', monospace;
    background-color: var(--bg-color);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
}

.btn-toggle-password {
    background-color: var(--secondary-color);
    color: var(--text-on-primary);
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
    box-sizing: border-box;
    font-family: inherit;
    vertical-align: middle;
    display: inline-block;
    text-align: center;
    min-width: 7rem;
    min-height: 2rem;
}

.btn-toggle-password:hover {
    background-color: #475569;
}

.btn-sm {
    text-align: center;
    display: inline-block;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
    box-sizing: border-box;
    font-family: inherit;
    vertical-align: middle;
    min-width: 7rem;
    min-height: 2rem;
}

.btn-danger {
    background-color: #dc2626;
    color: var(--text-on-primary);
}

.btn-danger:hover {
    background-color: #b91c1c;
}

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

@media (max-width: 768px) {
    .passwords-table {
        font-size: 0.875rem;
    }
    
    .passwords-table th,
    .passwords-table td {
        padding: 0.5rem;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
    }

    .btn-toggle-password,
    .btn-sm {
        font-size: 0.875rem;
        padding: 0.375rem 0.75rem;
        min-width: 7rem;
        min-height: 2rem;
        white-space: nowrap;
        text-align: center;
    }
}

.expand-btn-container {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
    width: 100%;
    max-width: 100%;
}

.btn-expand-entry.toggle-btn {
    background: var(--secondary-color);
    color: #fff;
    border: none;
    border-radius: 2rem;
    padding: 0.5rem 1.25rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    box-shadow: var(--shadow-button);
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    text-decoration: none;
    outline: none;
    display: inline-block;
    box-sizing: border-box;
    line-height: 1.5;
    min-height: 2.5rem;
    vertical-align: middle;
    font-family: inherit;
}

.btn-expand-entry.toggle-btn:hover,
.btn-expand-entry.toggle-btn:focus {
    background: #475569;
    color: #fff;
    box-shadow: var(--shadow-primary-hover);
    text-decoration: none;
}

