/**
 * 社群互動功能樣式
 * - 愛心 (Like)
 * - 收藏 (Bookmark)
 * - 分享 (Share)
 */

/* ========================================
   Action Buttons - Active States
======================================== */

/* 愛心按鈕 - 啟用狀態 */
.action-btn.like-btn.active {
    color: #E53935;
}

.action-btn.like-btn.active .material-icons {
    color: #E53935;
}

/* 收藏按鈕 - 啟用狀態 */
.action-btn.bookmark-btn.active {
    color: var(--paws-primary);
}

.action-btn.bookmark-btn.active .material-icons {
    color: var(--paws-primary);
}

/* ========================================
   Button Animations
======================================== */

/* 愛心彈跳動畫 */
@keyframes like-bounce {
    0% { transform: scale(1); }
    25% { transform: scale(1.3); }
    50% { transform: scale(0.9); }
    75% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.action-btn.like-btn.animating .material-icons {
    animation: like-bounce 0.4s ease-out;
}

/* 收藏旋轉動畫 */
@keyframes bookmark-fill {
    0% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.2) rotate(-10deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.action-btn.bookmark-btn.animating .material-icons {
    animation: bookmark-fill 0.3s ease-out;
}

/* 數量變化動畫 */
@keyframes count-pop {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

.action-btn .count.updating {
    animation: count-pop 0.3s ease-out;
}

/* ========================================
   Loading State
======================================== */

.action-btn.loading {
    pointer-events: none;
    opacity: 0.6;
}

.action-btn.loading .material-icons {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ========================================
   Toast Notification
======================================== */

.social-toast {
    position: fixed;
    bottom: calc(var(--bottom-nav-height, 60px) + 20px);
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.social-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.social-toast .material-icons {
    font-size: 18px;
}

.social-toast.success {
    background: rgba(76, 175, 80, 0.9);
}

.social-toast.error {
    background: rgba(244, 67, 54, 0.9);
}

/* ========================================
   Share Modal
======================================== */

.share-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.share-modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.share-modal {
    background: var(--paws-card, white);
    border-radius: 16px 16px 0 0;
    padding: 20px;
    width: 100%;
    max-width: 500px;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.share-modal-overlay.show .share-modal {
    transform: translateY(0);
}

.share-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.share-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.share-modal-close {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--paws-text-muted);
    border-radius: 50%;
}

.share-modal-close:hover {
    background: var(--paws-bg);
}

.share-options {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.share-option {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 8px;
    border: none;
    background: var(--paws-bg, #f5f5f5);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.share-option:hover {
    background: var(--paws-border, #e0e0e0);
}

.share-option .icon-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.share-option.copy-link .icon-circle {
    background: #607D8B;
    color: white;
}

.share-option.line .icon-circle {
    background: #06C755;
    color: white;
}

.share-option.facebook .icon-circle {
    background: #1877F2;
    color: white;
}

.share-option span:last-child {
    font-size: 12px;
    color: var(--paws-text);
}

/* Copy Link Input */
.copy-link-input {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: var(--paws-bg, #f5f5f5);
    border-radius: 8px;
}

.copy-link-input input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    color: var(--paws-text);
    outline: none;
}

.copy-link-input button {
    padding: 8px 16px;
    background: var(--paws-primary);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    white-space: nowrap;
}

.copy-link-input button:hover {
    opacity: 0.9;
}

/* ========================================
   Login Prompt
======================================== */

.login-prompt-toast {
    position: fixed;
    bottom: calc(var(--bottom-nav-height, 60px) + 20px);
    left: 50%;
    transform: translateX(-50%);
    background: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 16px;
}

.login-prompt-toast p {
    margin: 0;
    font-size: 14px;
    color: var(--paws-text);
}

.login-prompt-toast a {
    padding: 8px 16px;
    background: var(--paws-primary);
    color: white;
    border-radius: 6px;
    font-size: 14px;
    text-decoration: none;
}

/* ========================================
   Comment Modal
======================================== */

.comment-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.comment-modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.comment-modal {
    background: var(--paws-card, white);
    border-radius: 16px 16px 0 0;
    width: 100%;
    max-width: 700px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.comment-modal-overlay.show .comment-modal {
    transform: translateY(0);
}

/* Comment Modal Header */
.comment-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--paws-border, #e0e0e0);
}

.comment-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.comment-modal-header .comment-count {
    font-size: 14px;
    color: var(--paws-text-muted);
    font-weight: normal;
}

.comment-modal-close {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--paws-text-muted);
    border-radius: 50%;
}

.comment-modal-close:hover {
    background: var(--paws-bg);
}

/* Comment List */
.comment-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 200px;
}

.comment-list::-webkit-scrollbar {
    width: 4px;
}

.comment-list::-webkit-scrollbar-thumb {
    background: var(--paws-border);
    border-radius: 2px;
}

/* Comment Item */
.comment-item {
    display: flex;
    gap: 12px;
}

.comment-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--paws-bg);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comment-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.comment-avatar .material-icons {
    font-size: 20px;
    color: var(--paws-text-muted);
}

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

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

.comment-author {
    font-size: 1rem;
    font-weight: 600;
    color: var(--paws-text);
}

.comment-author.is-owner {
    color: var(--paws-primary);
}

.comment-time {
    font-size: .8rem;
    color: var(--paws-text-muted);
}

.comment-content {
    font-size: 1rem;
    line-height: 1.5;
    color: var(--paws-text);
    word-break: break-word;
    white-space: pre-wrap;
}

.comment-actions {
    display: flex;
    gap: 16px;
    margin-top: 8px;
}

.comment-action-btn {
    background: none;
    border: none;
    padding: 0;
    font-size: 12px;
    color: var(--paws-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.comment-action-btn:hover {
    color: var(--paws-primary);
}

.comment-action-btn .material-icons {
    font-size: 16px;
}

.comment-delete-btn:hover {
    color: #E53935;
}

/* Comment Input */
.comment-input-container {
    padding: 12px 20px;
    border-top: 1px solid var(--paws-border, #e0e0e0);
    display: flex;
    gap: 12px;
    align-items: center;
    background: var(--paws-card, white);
}

.comment-input-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--paws-bg);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comment-input-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.comment-input-avatar .material-icons {
    font-size: 18px;
    color: var(--paws-text-muted);
}

.comment-input-wrapper {
    flex: 1;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--paws-bg, #f5f5f5);
    border-radius: 20px;
    padding: 8px 16px;
}

.comment-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    color: var(--paws-text);
    resize: none;
    outline: none;
    max-height: 100px;
    line-height: 1.4;
    font-family: inherit;
}

.comment-input::placeholder {
    color: var(--paws-text-muted);
}

.comment-submit-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--paws-primary);
    opacity: 0.5;
    transition: opacity 0.2s;
}

.comment-submit-btn.active {
    opacity: 1;
}

.comment-submit-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.comment-submit-btn .material-icons {
    font-size: 24px;
}

/* Empty State */
.comment-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--paws-text-muted);
}

.comment-empty .material-icons {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.comment-empty p {
    margin: 0;
    font-size: 14px;
}

/* Loading */
.comment-loading {
    display: flex;
    justify-content: center;
    padding: 20px;
}

.comment-loading .spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--paws-border);
    border-top-color: var(--paws-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Login Required */
.comment-login-required {
    padding: 20px;
    text-align: center;
}

.comment-login-required p {
    margin: 0 0 12px;
    font-size: 14px;
    color: var(--paws-text-muted);
}

.comment-login-required a {
    display: inline-block;
    padding: 10px 24px;
    background: var(--paws-primary);
    color: white;
    border-radius: 20px;
    font-size: 14px;
    text-decoration: none;
}

/* Load More Button */
.load-more-comments {
    width: 100%;
    padding: 12px;
    background: var(--paws-bg, #f5f5f5);
    border: none;
    border-radius: 8px;
    color: var(--paws-primary);
    font-size: 14px;
    cursor: pointer;
    margin-top: 8px;
}

.load-more-comments:hover {
    background: var(--paws-border, #e0e0e0);
}

/* Comment Item Transition */
.comment-item {
    transition: opacity 0.2s, transform 0.2s;
}
