@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap');

:root {
    --primary-dark: #1b5e20;
    --primary: #2e7d32;
    --primary-light: #4caf50;
    --primary-very-light: #c8e6c9;
    --accent: #81c784;
    --bg-light: #f1f8e9;
    --text-dark: #1b2e1b;
    --text-light: #f1f8e9;
    --gray-light: #e0e0e0;
    --shadow: 0 2px 10px rgba(0, 40, 0, 0.1);
    --border-radius: 8px;
}

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

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    line-height: 1.6;
}

header {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    box-shadow: var(--shadow);
}

.logo a {
    color: white;
    font-size: 2rem;
    font-weight: 700;
    text-decoration: none;
    letter-spacing: 1px;
}

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

nav a {
    color: var(--primary-very-light);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
}

nav a:hover {
    color: white;
    border-bottom-color: white;
}

.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
    padding: 2rem;
}

.post-card {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 60, 0, 0.2);
}

.post-card a {
    text-decoration: none;
    color: inherit;
}

.post-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
}

.post-card h3 {
    font-size: 1.2rem;
    margin: 0.5rem 1rem;
    color: var(--primary-dark);
}

.post-meta {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 1rem 1rem;
    font-size: 0.85rem;
    color: #4f5b4f;
}

.post-meta a {
    color: var(--primary-dark);
    text-decoration: none;
    font-weight: 500;
}

.post-meta a:hover {
    text-decoration: underline;
}

.post-container {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.post-content {
    background: white;
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.post-content h1 {
    font-size: 2.2rem;
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
}

.post-content .author {
    color: #4f5b4f;
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.post-content .author a {
    color: var(--primary-dark);
    text-decoration: none;
    font-weight: 500;
}

.post-content .author a:hover {
    text-decoration: underline;
}

.author-message-link {
    color: var(--primary);
    margin-left: 10px;
    font-size: 1.1rem;
}

.post-content img {
    max-width: 100%;
    border-radius: var(--border-radius);
    margin: 1.5rem 0;
    box-shadow: var(--shadow);
}

.post-description {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #1e2b1e;
    margin-bottom: 2rem;
}

.likes {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin: 2rem 0;
    padding-top: 1rem;
    border-top: 2px solid var(--primary-very-light);
}

.likes span {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--primary-dark);
}

.like-btn {
    background: var(--primary-light);
    color: white;
    padding: 0.6rem 1.5rem;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 500;
    transition: background 0.3s ease;
}

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

.like-btn.unlike {
    background: #ff6b6b;
}

.like-btn.unlike:hover {
    background: #ff5252;
}

.comments-section {
    margin-top: 3rem;
}

.comments-section h3 {
    font-size: 1.8rem;
    color: var(--primary-dark);
    margin-bottom: 1.5rem;
}

.comment-form {
    background: white;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.comment-form textarea {
    width: 100%;
    min-height: 100px;
    padding: 1rem;
    border: 1px solid var(--gray-light);
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 1rem;
    resize: vertical;
    margin-bottom: 1rem;
    transition: border-color 0.3s ease;
}

.comment-form textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.comment-form button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s ease;
}

.comment-form button:hover {
    background: var(--primary-dark);
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.comment {
    background: white;
    padding: 1.2rem 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
}

.comment strong {
    color: var(--primary-dark);
    font-size: 1.1rem;
}

.comment strong a {
    color: var(--primary-dark);
    text-decoration: none;
}

.comment strong a:hover {
    text-decoration: underline;
}

.comment small {
    color: #7b8a7b;
    margin-left: 1rem;
}

.comment p {
    margin-top: 0.5rem;
    color: #2e3b2e;
}

.profile-header {
    background: white;
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.profile-header h1 {
    font-size: 2.5rem;
    color: var(--primary-dark);
    margin-bottom: 0.5rem;
}

.profile-header p {
    color: #4f5b4f;
    font-size: 1.1rem;
}

.profile-header a {
    display: inline-block;
    margin-top: 1rem;
    background: var(--primary);
    color: white;
    padding: 0.8rem 2rem;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 500;
    transition: background 0.3s ease;
}

.profile-header a:hover {
    background: var(--primary-dark);
}

.form-container {
    max-width: 500px;
    margin: 3rem auto;
    background: white;
    padding: 2.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.form-container h2 {
    text-align: center;
    color: var(--primary-dark);
    margin-bottom: 2rem;
    font-size: 2rem;
}

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

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

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.9rem 1rem;
    border: 1px solid var(--gray-light);
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group input[type="file"] {
    padding: 0.5rem 0;
    border: none;
}

.btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    transition: background 0.3s ease;
}

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

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    width: auto;
}

.form-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: #4f5b4f;
}

.form-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.form-footer a:hover {
    text-decoration: underline;
}

.message {
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    font-weight: 500;
}

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

.message.success {
    background: #e8f5e8;
    color: #2e7d32;
    border-left: 4px solid #2e7d32;
}

/* Диалоги (список переписок) */
.dialogs-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 2rem;
}
.dialog-item {
    display: flex;
    align-items: center;
    background: white;
    padding: 1rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s, box-shadow 0.2s;
}
.dialog-item:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}
.dialog-avatar {
    margin-right: 1rem;
    color: var(--primary);
}
.dialog-info {
    flex: 1;
}
.dialog-username {
    font-weight: 600;
    color: var(--primary-dark);
    display: block;
    margin-bottom: 0.25rem;
}
.dialog-preview {
    color: #4f5b4f;
    font-size: 0.9rem;
}
.dialog-date {
    color: #7b8a7b;
    font-size: 0.85rem;
    white-space: nowrap;
}

/* Страница переписки */
.conversation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}
.conversation-header h1 {
    font-size: 1.8rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary-dark);
}
.conversation-header h1 a {
    color: var(--primary-dark);
    text-decoration: none;
}
.conversation-header h1 a:hover {
    text-decoration: underline;
}
.conversation-header .btn-small {
    width: auto;
    padding: 0.5rem 1.2rem;
    font-size: 0.95rem;
    margin-left: auto;
}
.conversation-box {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 60vh;
    border: 1px solid var(--primary-very-light);
}
.messages-list {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: #f9fff9;
}
.no-messages {
    text-align: center;
    padding: 3rem 1rem;
    color: #7b8a7b;
    font-style: italic;
    background: #f9fff9;
    border-radius: var(--border-radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}
.no-messages i {
    font-size: 4rem;
    color: var(--primary-light);
    opacity: 0.5;
}
.no-messages p {
    font-size: 1.2rem;
}
.message {
    max-width: 70%;
    padding: 0.6rem 1.2rem;
    border-radius: 20px;
    position: relative;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.message.mine {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}
.message.theirs {
    align-self: flex-start;
    background: white;
    color: var(--text-dark);
    border: 1px solid var(--primary-very-light);
    border-bottom-left-radius: 4px;
}
.message-content {
    margin-bottom: 0.25rem;
    line-height: 1.4;
    font-size: 1rem;
}
.message-meta {
    font-size: 0.7rem;
    opacity: 0.8;
    text-align: right;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.3rem;
}
.message.mine .message-meta {
    color: rgba(255,255,255,0.9);
}
.message.theirs .message-meta {
    color: #7b8a7b;
}
.message-form {
    display: flex;
    padding: 1rem;
    background: white;
    border-top: 2px solid var(--primary-very-light);
    gap: 0.75rem;
    align-items: center;
}
.message-form textarea {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-light);
    border-radius: 24px;
    resize: vertical;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
    min-height: 80px;
    max-height: 200px;
}
.message-form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
}
.message-form button.btn {
    width: auto;
    padding: 0.75rem 1.8rem;
    border-radius: 30px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    flex-shrink: 0;
}
.message-form button i {
    font-size: 1rem;
}

/* Уведомления */
.notifications-link {
    position: relative;
}
.badge {
    background: #ff5252;
    color: white;
    border-radius: 50%;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    position: absolute;
    top: 0;
    right: -10px;
    transform: translateY(-5px);
}
.notifications-list {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.notification-item {
    background: white;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: background 0.2s;
}
.notification-item.unread {
    background: #e8f5e8;
    border-left: 4px solid var(--primary);
}
.notification-item.read {
    opacity: 0.8;
}
.notification-icon {
    font-size: 1.5rem;
    width: 2rem;
    text-align: center;
}
.notification-content {
    flex: 1;
}
.notification-content a {
    color: var(--primary-dark);
    text-decoration: none;
    font-weight: 500;
}
.notification-content a:hover {
    text-decoration: underline;
}
.notification-date {
    color: #7b8a7b;
    font-size: 0.85rem;
    white-space: nowrap;
}

/* Адаптивность */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        padding: 1rem;
    }
    .post-content h1 {
        font-size: 1.8rem;
    }
    .profile-header h1 {
        font-size: 2rem;
    }
    .form-container {
        margin: 2rem 1rem;
        padding: 1.5rem;
    }
    .conversation-box {
        height: 70vh;
    }
    .message {
        max-width: 85%;
    }
}

@media (max-width: 600px) {
    .conversation-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .conversation-header .btn-small {
        margin-left: 0;
    }
    .message-form {
        flex-direction: column;
        align-items: stretch;
    }
    .message-form button.btn {
        width: 100%;
        justify-content: center;
    }
    .notification-item {
        flex-wrap: wrap;
    }
    .notification-date {
        width: 100%;
        margin-left: 2.5rem;
    }
}