/**
 * KAITRUST Engagement Kit Styles
 * Dark mode (default) + Light mode support
 */

/* ========================================
   ENGAGEMENT BAR
   ======================================== */
.engagement-kit {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.engagement-kit-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.engagement-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    color: #e2e8f0;
    background: transparent;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: 'Noto Sans KR', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.engagement-btn:hover {
    background: rgba(168, 85, 247, 0.2);
}

.engagement-btn:active {
    transform: scale(0.98);
}

.engagement-btn:focus {
    outline: 2px solid #a855f7;
    outline-offset: 2px;
}

.engagement-btn:focus:not(:focus-visible) {
    outline: none;
}

.engagement-btn:focus-visible {
    outline: 2px solid #a855f7;
    outline-offset: 2px;
}

.engagement-btn .icon {
    font-size: 1.1rem;
}

.engagement-btn .count {
    background: rgba(168, 85, 247, 0.3);
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.8rem;
    min-width: 1.5rem;
    text-align: center;
}

.engagement-btn.active {
    color: #a855f7;
}

.engagement-btn.active .count {
    background: rgba(168, 85, 247, 0.5);
}

.engagement-divider {
    width: 1px;
    height: 24px;
    background: rgba(168, 85, 247, 0.3);
    margin: 0 0.25rem;
}

/* ========================================
   MODAL OVERLAY
   ======================================== */
.engagement-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

/* ========================================
   CITATION MODAL
   ======================================== */
.engagement-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    background: rgba(15, 23, 42, 0.98);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 16px;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.engagement-modal-overlay.show + .engagement-modal,
.engagement-modal.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.engagement-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(168, 85, 247, 0.2);
}

.engagement-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #e2e8f0;
}

.engagement-modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.engagement-modal-close:hover {
    background: rgba(168, 85, 247, 0.2);
    color: #e2e8f0;
}

.engagement-modal-close:focus {
    outline: 2px solid #a855f7;
    outline-offset: 2px;
}

.engagement-modal-close:focus:not(:focus-visible) {
    outline: none;
}

.engagement-modal-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

/* Citation Formats */
.citation-format {
    margin-bottom: 1.25rem;
    padding: 1rem;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 10px;
    border: 1px solid rgba(168, 85, 247, 0.15);
}

.citation-format:last-child {
    margin-bottom: 0;
}

.citation-format-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.citation-format-label {
    font-weight: 600;
    color: #a855f7;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.citation-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    background: rgba(168, 85, 247, 0.2);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 6px;
    color: #e2e8f0;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.citation-copy-btn:hover {
    background: rgba(168, 85, 247, 0.4);
}

.citation-copy-btn.copied {
    background: rgba(34, 197, 94, 0.3);
    border-color: rgba(34, 197, 94, 0.5);
    color: #22c55e;
}

.citation-text {
    font-family: 'Noto Sans KR', Georgia, serif;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #cbd5e1;
    word-break: break-word;
}

/* Export Buttons */
.citation-export-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(168, 85, 247, 0.2);
}

.citation-export-label {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-bottom: 0.75rem;
}

.citation-export-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.citation-export-btn {
    padding: 0.5rem 1rem;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.citation-export-btn:hover {
    background: rgba(168, 85, 247, 0.3);
    border-color: rgba(168, 85, 247, 0.5);
}

/* ========================================
   COMMENT SECTION
   ======================================== */
.engagement-comment-section {
    margin-top: 1rem;
}

.comment-login-prompt {
    text-align: center;
    padding: 2rem;
    color: #94a3b8;
}

.comment-login-prompt a {
    color: #a855f7;
    text-decoration: none;
}

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

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

.comment-textarea {
    width: 100%;
    min-height: 80px;
    padding: 0.75rem;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 8px;
    color: #e2e8f0;
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 0.9rem;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s ease;
}

.comment-textarea:focus {
    border-color: rgba(168, 85, 247, 0.6);
}

.comment-submit-btn {
    margin-top: 0.75rem;
    padding: 0.5rem 1.5rem;
    background: linear-gradient(135deg, #a855f7 0%, #7c3aed 100%);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.comment-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.4);
}

.comment-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.comment-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.comment-item {
    padding: 1rem;
    background: rgba(30, 41, 59, 0.3);
    border-radius: 8px;
    margin-bottom: 0.75rem;
}

.comment-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.comment-author {
    font-weight: 600;
    color: #e2e8f0;
}

.comment-date {
    font-size: 0.8rem;
    color: #64748b;
}

.comment-content {
    color: #cbd5e1;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ========================================
   DONATE MODAL
   ======================================== */
.donate-modal-content {
    text-align: center;
    padding: 2rem 1rem;
}

.donate-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.donate-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #e2e8f0;
    margin-bottom: 0.75rem;
}

.donate-description {
    color: #94a3b8;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.donate-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 2rem;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.donate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

/* ========================================
   TOAST NOTIFICATION
   ======================================== */
.engagement-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    padding: 0.75rem 1.5rem;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(168, 85, 247, 0.4);
    border-radius: 10px;
    color: #e2e8f0;
    font-size: 0.9rem;
    z-index: 100000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.engagement-toast.success {
    border-color: rgba(34, 197, 94, 0.5);
}

.engagement-toast.error {
    border-color: rgba(239, 68, 68, 0.5);
}

/* ========================================
   LIGHT MODE
   ======================================== */
body.light-mode .engagement-kit-bar {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

body.light-mode .engagement-btn {
    color: #334155;
}

body.light-mode .engagement-btn:hover {
    background: rgba(168, 85, 247, 0.1);
}

body.light-mode .engagement-btn .count {
    background: rgba(168, 85, 247, 0.15);
    color: #6b21a8;
}

body.light-mode .engagement-divider {
    background: #e2e8f0;
}

body.light-mode .engagement-modal {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

body.light-mode .engagement-modal-header {
    border-bottom-color: #e2e8f0;
}

body.light-mode .engagement-modal-header h3 {
    color: #1e293b;
}

body.light-mode .engagement-modal-close {
    color: #64748b;
}

body.light-mode .engagement-modal-close:hover {
    background: rgba(168, 85, 247, 0.1);
    color: #1e293b;
}

body.light-mode .citation-format {
    background: #f8fafc;
    border-color: #e2e8f0;
}

body.light-mode .citation-format-label {
    color: #7c3aed;
}

body.light-mode .citation-copy-btn {
    background: rgba(168, 85, 247, 0.1);
    border-color: rgba(168, 85, 247, 0.2);
    color: #334155;
}

body.light-mode .citation-copy-btn:hover {
    background: rgba(168, 85, 247, 0.2);
}

body.light-mode .citation-text {
    color: #334155;
}

body.light-mode .citation-export-section {
    border-top-color: #e2e8f0;
}

body.light-mode .citation-export-label {
    color: #64748b;
}

body.light-mode .citation-export-btn {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #334155;
}

body.light-mode .citation-export-btn:hover {
    background: rgba(168, 85, 247, 0.1);
    border-color: rgba(168, 85, 247, 0.3);
}

body.light-mode .comment-textarea {
    background: #f8fafc;
    border-color: #e2e8f0;
    color: #1e293b;
}

body.light-mode .comment-textarea:focus {
    border-color: rgba(168, 85, 247, 0.5);
}

body.light-mode .comment-item {
    background: #f8fafc;
}

body.light-mode .comment-author {
    color: #1e293b;
}

body.light-mode .comment-content {
    color: #334155;
}

body.light-mode .comment-login-prompt {
    color: #64748b;
}

body.light-mode .donate-title {
    color: #1e293b;
}

body.light-mode .donate-description {
    color: #64748b;
}

body.light-mode .engagement-toast {
    background: #ffffff;
    border-color: rgba(168, 85, 247, 0.3);
    color: #1e293b;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* ========================================
   RESPONSIVE - MOBILE
   ======================================== */
@media (max-width: 768px) {
    .engagement-kit {
        padding: 0 0.75rem;
        margin: 1.5rem auto;
    }

    .engagement-kit-bar {
        flex-wrap: wrap;
        gap: 0.25rem;
        padding: 0.5rem;
    }

    .engagement-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
        flex: 1 1 auto;
        min-width: calc(50% - 0.5rem);
        justify-content: center;
    }

    .engagement-btn .icon {
        font-size: 1rem;
    }

    .engagement-btn .count {
        font-size: 0.75rem;
        padding: 0.1rem 0.4rem;
    }

    .engagement-divider {
        display: none;
    }

    .engagement-modal {
        width: 95%;
        max-height: 90vh;
    }

    .engagement-modal-header {
        padding: 0.75rem 1rem;
    }

    .engagement-modal-content {
        padding: 1rem;
    }

    .citation-format {
        padding: 0.75rem;
    }

    .citation-format-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .citation-export-buttons {
        justify-content: center;
    }

    .citation-export-btn {
        flex: 1 1 calc(50% - 0.25rem);
        text-align: center;
    }
}

@media (max-width: 480px) {
    .engagement-btn {
        min-width: calc(50% - 0.25rem);
        padding: 0.35rem 0.5rem;
        font-size: 0.75rem;
    }

    .engagement-btn .label {
        display: none;
    }

    .engagement-btn .count {
        margin-left: 0;
    }
}

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.engagement-btn.pulse {
    animation: pulse 0.3s ease;
}
