/* Feed — Instagram-like, aligned with GG design tokens */

.feed-main {
    min-height: 100vh;
    background:
        radial-gradient(ellipse 80% 50% at 10% 0%, rgba(37, 211, 102, 0.08), transparent 55%),
        radial-gradient(ellipse 60% 40% at 90% 20%, rgba(26, 77, 58, 0.07), transparent 50%),
        var(--background-light);
    padding: 90px 16px 48px;
}

.feed-header {
    max-width: 540px;
    margin: 0 auto 28px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    animation: feedFadeUp 0.45s ease both;
}

.feed-header h1 {
    font-family: 'Lora', serif;
    font-size: clamp(1.8rem, 4vw, 2.4rem);
    color: var(--primary-color);
    font-weight: 700;
    line-height: 1.15;
}

.feed-header-text p {
    color: var(--text-light);
    font-size: 0.92rem;
    margin-top: 6px;
    max-width: 28ch;
}

.feed-header-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.feed-status {
    max-width: 540px;
    margin: 40px auto;
    text-align: center;
    color: var(--text-light);
    padding: 32px 20px;
}

.feed-status i {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 12px;
    display: block;
}

.feed-status-error {
    color: #c0392b;
    background: #fee;
    border-radius: var(--border-radius);
    border-left: 4px solid #e74c3c;
}

.feed-list {
    max-width: 540px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

/* Post card */
.feed-post {
    background: var(--secondary-color);
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    overflow: hidden;
    animation: feedFadeUp 0.4s ease both;
    border: 1px solid rgba(26, 77, 58, 0.06);
}

.feed-post:nth-child(1) { animation-delay: 0.02s; }
.feed-post:nth-child(2) { animation-delay: 0.06s; }
.feed-post:nth-child(3) { animation-delay: 0.1s; }

.feed-post-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
}

.feed-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.feed-author {
    flex: 1;
    min-width: 0;
}

.feed-author strong {
    display: block;
    color: var(--text-dark);
    font-size: 0.95rem;
}

.feed-author time {
    color: var(--text-light);
    font-size: 0.8rem;
}

.feed-post-delete {
    background: transparent;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 6px 8px;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

.feed-post-delete:hover {
    color: #c0392b;
    background: rgba(231, 76, 60, 0.08);
}

.feed-media {
    position: relative;
    background: #0f3026;
    aspect-ratio: 1 / 1;
    overflow: hidden;
}

.feed-media.has-carousel {
    cursor: grab;
}

.feed-media-track {
    display: flex;
    height: 100%;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

.feed-media-slide {
    min-width: 100%;
    height: 100%;
}

.feed-media-slide img,
.feed-media-slide video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.feed-media-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary-color);
    cursor: pointer;
    display: grid;
    place-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transition: var(--transition);
    z-index: 2;
}

.feed-media:hover .feed-media-nav,
.feed-media:focus-within .feed-media-nav {
    opacity: 1;
}

.feed-media-nav.prev { left: 10px; }
.feed-media-nav.next { right: 10px; }

.feed-media-dots {
    position: absolute;
    bottom: 10px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 6px;
    z-index: 2;
}

.feed-media-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.45);
    transition: var(--transition);
}

.feed-media-dots span.active {
    background: var(--accent-color);
    transform: scale(1.2);
}

.feed-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 12px 0;
}

.feed-action {
    background: transparent;
    border: none;
    color: var(--text-dark);
    font-size: 1.35rem;
    cursor: pointer;
    padding: 8px 10px;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.feed-action span {
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
}

.feed-action:hover {
    color: var(--primary-color);
    background: rgba(26, 77, 58, 0.06);
}

.feed-action.liked {
    color: #e74c3c;
}

.feed-action.liked:hover {
    color: #c0392b;
}

.feed-action.liked i {
    animation: likePop 0.35s ease;
}

.feed-body {
    padding: 8px 16px 16px;
}

.feed-likes {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-dark);
    margin-bottom: 6px;
}

.feed-caption {
    font-size: 0.95rem;
    color: var(--text-dark);
    line-height: 1.45;
    word-break: break-word;
}

.feed-caption strong {
    margin-right: 6px;
}

.feed-view-comments {
    display: inline-block;
    margin-top: 8px;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 0.88rem;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
}

.feed-view-comments:hover {
    color: var(--primary-color);
}

/* Shared form bits (compose) */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

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

.form-group input[type="text"],
.form-group textarea {
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus,
.comment-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 77, 58, 0.1);
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
}

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

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(26, 77, 58, 0.3);
}

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

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.btn-large {
    width: 100%;
    font-size: 1.05rem;
    padding: 14px;
}

.error-message {
    padding: 12px 15px;
    background: #fee;
    border-left: 4px solid #e74c3c;
    border-radius: 4px;
    color: #c0392b;
    font-weight: 500;
    margin-bottom: 12px;
}

.loading {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 12px;
}

/* Media dropzone */
.media-drop {
    position: relative;
    border: 2px dashed #d0d0d0;
    border-radius: var(--border-radius);
    background: #fafbfc;
    transition: var(--transition);
}

.media-drop.drag-over {
    border-color: var(--primary-color);
    background: rgba(26, 77, 58, 0.04);
}

.media-drop input[type="file"] {
    display: none;
}

.media-drop-label {
    padding: 28px 16px;
    text-align: center;
    cursor: pointer;
    color: var(--text-light);
}

.media-drop-label i {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.media-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.media-preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    background: #eee;
}

.media-preview-item img,
.media-preview-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-preview-item button {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    cursor: pointer;
    display: grid;
    place-items: center;
}

/* Modals */
.feed-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}

.feed-modal[hidden] {
    display: none;
}

.feed-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 48, 38, 0.55);
    backdrop-filter: blur(4px);
    animation: feedFade 0.25s ease;
}

.feed-modal-panel {
    position: relative;
    width: 100%;
    max-width: 520px;
    max-height: min(92vh, 720px);
    overflow: auto;
    background: var(--secondary-color);
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
    padding: 20px 20px 28px;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.18);
    animation: feedSheetUp 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
}

@media (min-width: 640px) {
    .feed-modal {
        align-items: center;
        padding: 24px;
    }

    .feed-modal-panel {
        border-radius: var(--border-radius-lg);
        animation: feedFadeUp 0.3s ease;
    }
}

.feed-modal-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.feed-modal-top h2 {
    font-family: 'Lora', serif;
    color: var(--primary-color);
    font-size: 1.35rem;
}

.feed-modal-close {
    background: transparent;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-light);
    font-size: 1.1rem;
    transition: var(--transition);
}

.feed-modal-close:hover {
    background: rgba(26, 77, 58, 0.08);
    color: var(--primary-color);
}

.feed-comments-panel {
    display: flex;
    flex-direction: column;
    max-height: min(88vh, 640px);
}

.comments-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 4px 0 16px;
    min-height: 120px;
}

.comment-item {
    display: flex;
    gap: 10px;
    animation: feedFadeUp 0.25s ease;
}

.comment-item .feed-avatar {
    width: 32px;
    height: 32px;
    font-size: 0.8rem;
}

.comment-body {
    flex: 1;
    min-width: 0;
}

.comment-body strong {
    font-size: 0.88rem;
    margin-right: 6px;
}

.comment-body p {
    font-size: 0.92rem;
    color: var(--text-dark);
    word-break: break-word;
}

.comment-body time {
    display: block;
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 2px;
}

.comments-empty {
    text-align: center;
    color: var(--text-light);
    padding: 24px 8px;
    font-size: 0.92rem;
}

.comment-form {
    display: grid;
    grid-template-columns: 100px 1fr auto;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid #eee;
}

.comment-form input {
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    font-family: inherit;
    min-width: 0;
}

@keyframes feedFadeUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes feedSheetUp {
    from { transform: translateY(40px); opacity: 0.6; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes likePop {
    0% { transform: scale(1); }
    40% { transform: scale(1.35); }
    100% { transform: scale(1); }
}

@media (max-width: 480px) {
    .feed-header {
        flex-direction: column;
        align-items: stretch;
    }

    .feed-header-actions {
        justify-content: flex-end;
    }

    .comment-form {
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
    }

    .comment-form #commentOwner {
        grid-column: 1 / -1;
    }
}
