/* Animation Enhancements & Multi-step Form Styles */

.fade-in {
    animation: fadeIn var(--transition-smooth) forwards;
}

.slide-up {
    animation: slideUp var(--transition-smooth) forwards;
}

.pulse-animation {
    animation: pulse 2s infinite;
}

.staggered-animation>* {
    opacity: 0;
    transform: translateY(10px);
    animation: slideUp 0.4s forwards;
}

.staggered-animation>*:nth-child(1) {
    animation-delay: 0.1s;
}

.staggered-animation>*:nth-child(2) {
    animation-delay: 0.2s;
}

.staggered-animation>*:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(245, 134, 52, 0.4);
    }

    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(245, 134, 52, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(245, 134, 52, 0);
    }
}

/* Multi-step Progress Bar */
.progress-bar {
    width: 100%;
    height: 4px;
    background-color: #eee;
    margin-bottom: var(--spacing-md);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar .fill {
    height: 100%;
    background-color: var(--color-primary);
    transition: width 0.3s ease;
}

.hidden {
    display: none !important;
}

/* Checkbox Style */
.check-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
}

/* --- Social Interactions (Likes, Comments & Post Overlay) --- */

.engagement .like-btn,
.engagement .comment-btn {
    padding: 10px 16px;
    /* Larger hit area */
    border-radius: 30px;
    transition: background 0.2s, color 0.2s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    /* better mobile feel */
}

.engagement .like-btn:hover {
    background-color: rgba(255, 0, 0, 0.08);
    /* faint red hover */
}

.engagement .like-btn.liked {
    color: #e0245e;
    /* Twitter-like red */
}

.engagement .comment-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

/* Post Details Overlay Modal */
#post-details-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    /* Bottom sheet align on mobile */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

#post-details-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Prevent body scroll when modal is active exactly for mobile touch */
body.modal-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100%;
}

.post-details-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
}

.post-details-modal {
    position: relative;
    width: 100%;
    max-width: 600px;
    height: 100%;
    max-height: 100%;
    background: var(--color-white);
    border-radius: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin: 0 auto;
}

@media (min-width: 768px) {
    #post-details-overlay {
        align-items: center;
        /* Center on desktop */
    }

    .post-details-modal {
        height: 85vh;
        border-radius: var(--radius-lg);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--color-primary);
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--color-text-muted);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.comments-section {
    padding: 1.5rem;
    padding-bottom: 3rem;
    /* Extra space to ensure the last comment clears the input box */
}

.comments-section h4 {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 0.5rem;
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.comment-item {
    display: flex;
    gap: 1rem;
}

.comment-content-box {
    background: #f4f6f8;
    padding: 0.8rem 1rem;
    border-radius: 18px;
    flex: 1;
}

.comment-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.3rem;
    align-items: baseline;
}

.comment-meta strong {
    font-size: 0.95rem;
    color: var(--color-primary);
}

.comment-meta span {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.comment-content-box p {
    font-size: 0.95rem;
    color: #333;
    line-height: 1.4;
    margin: 0;
    word-break: break-word;
}

.no-comments {
    text-align: center;
    color: var(--color-text-muted);
    font-style: italic;
    padding: 2rem 0;
}

/* Ensure the input area stays above the mobile software keyboard */
.sticky-bottom {
    position: relative;
    width: 100%;
    background: var(--color-white);
    padding: 1rem 1.5rem;
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 40px));
    /* Added strong 40px fallback for aggressive Android Chrome bottoms */
    border-top: 1px solid var(--color-border);
    z-index: 10;
    flex-shrink: 0;
}

/* Fix iOS Safari Auto-Zoom on Input Focus */
.comment-input-area input {
    font-size: 16px !important;
    /* Must be 16px to prevent zoom */
}

/* Post Options Dropdown */
.post-header {
    position: relative;
}

.post-options-dropdown {
    position: absolute;
    top: 40px;
    right: 0;
    background: var(--color-white);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 50;
    width: 150px;
    display: none;
    overflow: hidden;
    border: 1px solid var(--color-border);
}

.post-options-dropdown.active {
    display: block;
    animation: fadeIn 0.1s ease;
}

.dropdown-item {
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--color-text);
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: #f5f5f5;
}

.dropdown-item.delete {
    color: #ff4d4f;
}

.dropdown-item i {
    font-size: 1.1rem;
}

/* Ensure more-btn can trigger the dropdown */
.more-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: 5px;
    border-radius: 50%;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.more-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}