/* =========================
   Bottom Sheet Modal - Mobile Optimized
   ========================= */

/* Overlay */
.bottom-sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    z-index: 2000;
    transition: background 0.3s ease;
    pointer-events: none;
}

.bottom-sheet-overlay.active {
    background: rgba(0, 0, 0, 0.5);
    pointer-events: all;
}

/* Bottom Sheet Container */
.bottom-sheet {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    max-height: 90vh;
    background: var(--bg-white);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
    z-index: 2001;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.bottom-sheet.active {
    transform: translateY(0);
}

/* Drag Handle */
.sheet-handle {
    width: 100%;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: grab;
}

.sheet-handle:active {
    cursor: grabbing;
}

.sheet-handle-bar {
    width: 40px;
    height: 4px;
    background: #d0d0d0;
    border-radius: 2px;
}

/* Sheet Header */
.sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}

.sheet-header h2 {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.sheet-close-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.2s;
}

.sheet-close-btn:hover {
    background: var(--bg-main);
}

/* Sheet Body */
.sheet-body {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

/* Scroll Hint (appears when content is scrollable) */
.sheet-body::after {
    content: '';
    position: sticky;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40px;
    background: linear-gradient(to top, var(--bg-white) 0%, transparent 100%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.sheet-body.has-scroll::after {
    opacity: 1;
}

/* Original Post in Sheet */
.sheet-post {
    padding: 16px 20px;
    border-bottom: 8px solid var(--bg-main);
}

.sheet-post-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.sheet-author-avatar {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--accent-teal) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.sheet-author-info {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.sheet-author-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.sheet-post-time {
    font-size: 13px;
    color: var(--text-secondary);
}

.sheet-author-name::after {
    content: '·';
    margin: 0 4px;
    color: var(--text-secondary);
}

/* Post Action Buttons (Follow/Delete) */
.sheet-post-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.sheet-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-main);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.sheet-action-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    transform: scale(1.1);
}

.sheet-action-btn:active {
    transform: scale(0.95);
}

.sheet-action-btn.following {
    background: var(--primary);
    border-color: var(--primary);
}

.sheet-post-content {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-wrap: break-word;
    margin-bottom: 14px;
}

/* Post Media in Sheet (Full Size) */
.sheet-post-media {
    margin: 16px 0;
    border-radius: 12px;
    overflow: hidden;
}

.sheet-post-media img {
    width: 100%;
    max-height: 500px;
    object-fit: contain;
    display: block;
    border-radius: 12px;
    background: var(--bg-main);
}

.sheet-post-media iframe {
    width: 100%;
    height: 300px;
    border-radius: 12px;
    border: none;
}

/* Reaction Bar in Sheet */
.sheet-reactions {
    display: flex;
    gap: 12px;
    margin-top: 14px;
}

.sheet-reaction-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-main);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.sheet-reaction-btn:hover {
    background: var(--bg-white);
    border-color: var(--primary);
    color: var(--primary);
}

.sheet-reaction-btn .emoji {
    font-size: 16px;
}

/* Comments Section */
.sheet-comments {
    padding: 0 20px 80px 20px;
    /* Extra bottom padding for smooth scrolling */
}

.sheet-comments-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 16px 0 12px 0;
    position: sticky;
    top: 0;
    background: var(--bg-white);
    z-index: 10;
    border-bottom: 1px solid var(--border-light);
}

.sheet-comments-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.sheet-comments-title::after {
    content: ' ↓ 아래로 스크롤';
    font-size: 12px;
    font-weight: 400;
    color: var(--text-secondary);
    margin-left: 8px;
    animation: scrollHint 2s ease-in-out infinite;
}

@keyframes scrollHint {
    0%, 100% { opacity: 0.5; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(3px); }
}

/* Hide hint when scrolled */
.sheet-body.scrolled .sheet-comments-title::after {
    display: none;
}

/* Compact Comment Item */
.sheet-comment-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}

.sheet-comment-item:last-child {
    border-bottom: none;
}

.sheet-comment-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.sheet-comment-avatar {
    width: 28px;
    height: 28px;
    min-width: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--accent-teal) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.sheet-comment-author {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.sheet-comment-time {
    font-size: 12px;
    color: var(--text-secondary);
}

.sheet-comment-author::after {
    content: '·';
    margin: 0 4px;
    color: var(--text-secondary);
}

.sheet-comment-actions {
    display: flex;
    gap: 12px;
    margin-left: auto;
}

.sheet-comment-btn {
    background: transparent;
    border: none;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.sheet-comment-btn:hover {
    background: var(--bg-main);
    color: var(--primary);
}

.sheet-comment-content {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-wrap: break-word;
    margin-left: 36px;
}

/* Reply (Nested Comment) */
.sheet-comment-item.is-reply {
    padding-left: 36px;
    background: var(--bg-main);
    border-left: 2px solid var(--primary);
}

.sheet-comment-item.is-reply .sheet-comment-content {
    margin-left: 36px;
}

/* Reply Input Container */
.sheet-reply-input-container {
    margin-top: 12px;
    padding-left: 0;
}

.sheet-reply-input {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sheet-reply-input .sheet-input-avatar {
    display: none; /* Hide avatar for consistency */
}

.sheet-reply-input .sheet-input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px 6px 16px;
    background: var(--bg-main);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    transition: all 0.2s;
    height: 40px; /* Slightly smaller */
}

.sheet-reply-input .sheet-input-wrapper:focus-within {
    border-color: var(--primary);
    background: var(--bg-white);
    box-shadow: 0 2px 8px rgba(74, 143, 181, 0.15);
}

.sheet-reply-input .sheet-input-field {
    font-size: 13px;
    line-height: 1.2;
    padding: 0;
    height: 28px;
}

.sheet-reply-input .sheet-send-btn {
    min-width: 50px;
    height: 32px;
    font-size: 12px;
}

/* Comment Input Footer (Same as Main Chat Input) */
.sheet-footer {
    padding: 8px 16px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-white);
    flex-shrink: 0;
}

.sheet-comment-input {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sheet-input-avatar {
    display: none; /* Hide avatar in input - keep consistent with main */
}

.sheet-input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-main);
    border: 1px solid var(--border-light);
    border-radius: 24px;
    padding: 6px 8px 6px 16px;
    transition: all 0.2s;
    height: 44px; /* Fixed height */
}

.sheet-input-wrapper:focus-within {
    border-color: var(--primary);
    background: var(--bg-white);
    box-shadow: 0 2px 8px rgba(74, 143, 181, 0.15);
}

.sheet-input-field {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    line-height: 1.2;
    font-family: 'Noto Sans KR', sans-serif;
    color: var(--text-primary);
    outline: none;
    padding: 0;
    height: 32px;
}

.sheet-input-field::placeholder {
    color: var(--text-secondary);
}

.sheet-send-btn {
    min-width: 60px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
    border-radius: 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(74, 143, 181, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sheet-send-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(74, 143, 181, 0.3);
}

.sheet-send-btn:active {
    transform: translateY(0);
}

.sheet-send-btn:disabled {
    background: var(--bg-main);
    color: var(--text-secondary);
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

/* Empty Comments */
.sheet-empty-comments {
    padding: 40px 20px;
    text-align: center;
}

.sheet-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.sheet-empty-text {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Mobile Optimization */
@media (max-width: 640px) {
    .bottom-sheet {
        max-height: 95vh;
        border-radius: 16px 16px 0 0;
    }
    
    .sheet-post {
        padding: 14px 16px;
    }
    
    .sheet-comments {
        padding: 0 16px 16px 16px;
    }
    
    .sheet-footer {
        padding: 10px 16px;
    }
}
