/* ============================================
   CHANGELOG & FEEDBACK MODALS
   Centered floating modals with overlay
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,600;1,400&family=JetBrains+Mono:wght@400;500&display=swap');

/* Shared Variables */
:root {
    --panel-bg: rgba(12, 12, 18, 0.95);
    --panel-border: rgba(255, 255, 255, 0.08);
    --panel-accent: #c9a962;
    --panel-accent-dim: rgba(201, 169, 98, 0.15);
    --panel-text: #e8e4dc;
    --panel-text-muted: rgba(232, 228, 220, 0.55);
    --font-changelog: 'Cormorant Garamond', Georgia, serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
}

/* ============================================
   SHARED OVERLAY
   ============================================ */

.changelog-modal-overlay,
.feedback-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
}

.changelog-modal-overlay { z-index: 1000; }
.feedback-modal-overlay { z-index: 1002; }

.changelog-modal-overlay.open,
.feedback-modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   CHANGELOG MODAL
   ============================================ */

.changelog-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 420px;
    max-height: calc(100vh - 6rem);
    z-index: 1001;
    /* Changelog: overlay 1000, modal 1001 */
    display: flex;
    flex-direction: column;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    box-shadow: 0 20px 80px -15px rgba(0, 0, 0, 0.8);
    transform: translate(-50%, -50%) scale(0.95);
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.changelog-modal.open {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    visibility: visible;
}

/* Changelog Header */
.changelog-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--panel-border);
    position: relative;
}

.changelog-modal-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--panel-accent) 20%, var(--panel-accent) 80%, transparent);
    opacity: 0.6;
}

.changelog-modal-title-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.changelog-modal-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--panel-accent-dim);
    border-radius: 10px;
}

.changelog-modal-icon svg {
    width: 18px;
    height: 18px;
    stroke: var(--panel-accent);
    stroke-width: 1.5;
    fill: none;
}

.changelog-modal-title {
    font-family: var(--font-changelog);
    font-size: 1.3rem;
    font-weight: 400;
    color: var(--panel-text);
    letter-spacing: 0.03em;
}

.changelog-modal-subtitle {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 400;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--panel-text-muted);
}

.changelog-modal-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.2s ease;
}

.changelog-modal-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.changelog-modal-close svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* Changelog Body */
.changelog-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--panel-accent-dim) transparent;
    max-height: 400px;
}

.changelog-modal-body::-webkit-scrollbar { width: 5px; }
.changelog-modal-body::-webkit-scrollbar-track { background: transparent; }
.changelog-modal-body::-webkit-scrollbar-thumb { background: var(--panel-accent-dim); border-radius: 3px; }
.changelog-modal-body::-webkit-scrollbar-thumb:hover { background: var(--panel-accent); }

/* Changelog Entry */
.changelog-entry {
    margin-bottom: 1.75rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px dashed var(--panel-border);
    animation: entryFadeIn 0.5s ease forwards;
    opacity: 0;
}

.changelog-entry:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

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

.changelog-entry:nth-child(1) { animation-delay: 0.1s; }
.changelog-entry:nth-child(2) { animation-delay: 0.2s; }
.changelog-entry:nth-child(3) { animation-delay: 0.3s; }
.changelog-entry:nth-child(4) { animation-delay: 0.4s; }
.changelog-entry:nth-child(5) { animation-delay: 0.5s; }

.entry-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.entry-version {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.6rem;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--panel-accent);
    background: var(--panel-accent-dim);
    border-radius: 6px;
    white-space: nowrap;
}

.entry-date {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--panel-text-muted);
    padding-top: 0.35rem;
}

.entry-title {
    font-family: var(--font-changelog);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--panel-text);
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.entry-description {
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--panel-text-muted);
}

.entry-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.75rem;
}

.entry-tag {
    padding: 0.2rem 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--panel-text-muted);
    border: 1px solid var(--panel-border);
}

.entry-tag.feature {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border-color: rgba(99, 102, 241, 0.3);
}

.entry-tag.fix {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border-color: rgba(16, 185, 129, 0.3);
}

.entry-tag.improvement {
    background: rgba(6, 182, 212, 0.15);
    color: #67e8f9;
    border-color: rgba(6, 182, 212, 0.3);
}

/* Changelog Empty State */
.changelog-empty {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--panel-text-muted);
}

.changelog-empty svg {
    width: 48px;
    height: 48px;
    stroke: var(--panel-border);
    stroke-width: 1.5;
    margin-bottom: 1rem;
}

.changelog-empty p {
    font-size: 0.85rem;
    line-height: 1.6;
}

/* Changelog Footer - Dismiss Button */
.changelog-modal-footer {
    padding: 0.75rem 1.5rem;
    border-top: 1px solid var(--panel-border);
    display: flex;
    justify-content: center;
}

.changelog-dismiss-btn {
    padding: 0.5rem 1.25rem;
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--panel-text-muted);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.changelog-dismiss-btn:hover {
    color: var(--panel-text);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

/* ============================================
   FEEDBACK MODAL
   ============================================ */

.feedback-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 420px;
    max-height: calc(100vh - 6rem);
    z-index: 1003;
    /* Feedback: overlay 1002, modal 1003 */
    display: flex;
    flex-direction: column;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    box-shadow: 0 20px 80px -15px rgba(0, 0, 0, 0.8);
    transform: translate(-50%, -50%) scale(0.95);
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.feedback-modal.open {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    visibility: visible;
}

/* Feedback Header */
.feedback-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--panel-border);
    position: relative;
}

.feedback-modal-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, #5CC6C3 20%, #5CC6C3 80%, transparent);
    opacity: 0.6;
}

.feedback-modal-title-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.feedback-modal-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(92, 198, 195, 0.15);
    border-radius: 10px;
}

.feedback-modal-icon svg {
    width: 18px;
    height: 18px;
    stroke: #5CC6C3;
    stroke-width: 1.5;
    fill: none;
}

.feedback-modal-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--panel-text);
}

.feedback-modal-subtitle {
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--panel-text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.feedback-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 0.4rem;
    font-size: 0.65rem;
    background: rgba(92, 198, 195, 0.15);
    color: #5CC6C3;
    border-radius: 10px;
}

.feedback-modal-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.2s ease;
}

.feedback-modal-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.feedback-modal-close svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* Feedback Body (Comments List) */
.feedback-modal-body {
    flex: 1;
    overflow-y: auto;
    max-height: 300px;
    scrollbar-width: thin;
    scrollbar-color: rgba(92, 198, 195, 0.2) transparent;
}

.feedback-modal-body::-webkit-scrollbar { width: 4px; }
.feedback-modal-body::-webkit-scrollbar-thumb { background: rgba(92, 198, 195, 0.2); border-radius: 2px; }

.feedback-list {
    padding: 0.5rem 1.5rem;
}

/* Comment Item */
.comment-item {
    padding: 1rem 0;
    border-bottom: 1px solid var(--panel-border);
    animation: commentSlide 0.3s ease forwards;
}

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

@keyframes commentSlide {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.comment-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.comment-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--panel-accent-dim), rgba(99, 102, 241, 0.2));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--panel-accent);
}

.comment-author {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--panel-text);
}

.comment-time {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--panel-text-muted);
    margin-left: auto;
}

.comment-text {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--panel-text-muted);
    padding-left: calc(24px + 0.5rem);
}

/* Feedback Form */
.feedback-modal-form {
    padding: 0.75rem 1.5rem 1.25rem;
    border-top: 1px solid var(--panel-border);
}

.feedback-input-wrapper {
    margin-bottom: 0.75rem;
}

.feedback-input {
    width: 100%;
    padding: 0.85rem 1rem;
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.85rem;
    color: var(--panel-text);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    resize: none;
    min-height: 70px;
    transition: all 0.3s ease;
}

.feedback-input::placeholder {
    color: var(--panel-text-muted);
}

.feedback-input:focus {
    outline: none;
    border-color: #5CC6C3;
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 3px rgba(92, 198, 195, 0.15);
}

.feedback-actions {
    display: flex;
    gap: 0.5rem;
}

.feedback-name-wrapper {
    flex: 1;
}

.feedback-name-input {
    width: 100%;
    padding: 0.65rem 0.85rem;
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.8rem;
    color: var(--panel-text);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.feedback-name-input::placeholder {
    color: var(--panel-text-muted);
}

.feedback-name-input:focus {
    outline: none;
    border-color: #5CC6C3;
}

.feedback-submit {
    padding: 0.65rem 1.25rem;
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.8rem;
    font-weight: 500;
    color: #0a0a0f;
    background: linear-gradient(135deg, #5CC6C3, #4AA8A5);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.feedback-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px -5px rgba(92, 198, 195, 0.4);
}

.feedback-submit:active {
    transform: translateY(0);
}

.feedback-submit svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* ============================================
   COMMENT REACTIONS (shared)
   ============================================ */

.comment-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.5rem;
    padding-left: calc(24px + 0.5rem);
    position: relative;
}

.reaction-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    color: var(--panel-text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    font-family: inherit;
}

.reaction-pill:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.12);
}

.reaction-pill.my-reaction {
    background: rgba(92, 198, 195, 0.15);
    border-color: rgba(92, 198, 195, 0.3);
    color: #5CC6C3;
}

.reaction-pill.my-reaction:hover {
    background: rgba(92, 198, 195, 0.25);
}

.reaction-pill:disabled {
    cursor: default;
    opacity: 0.7;
}

.reaction-pill:disabled:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.06);
}

.reaction-count {
    font-size: 0.65rem;
    font-weight: 600;
}

/* Reaction tooltip */
.reaction-pill[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    padding: 0.3rem 0.6rem;
    font-size: 0.65rem;
    font-weight: 400;
    color: var(--panel-text);
    background: rgba(20, 20, 30, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    white-space: nowrap;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 20;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.reaction-pill[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: rgba(20, 20, 30, 0.95);
    z-index: 20;
    pointer-events: none;
}

/* Add reaction button */
.reaction-add-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: var(--panel-text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.reaction-add-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--panel-text);
}

/* Emoji picker */
.emoji-picker {
    display: none;
    flex-wrap: wrap;
    gap: 0.2rem;
    margin-top: 0.35rem;
    padding: 0.4rem;
    background: rgba(20, 20, 30, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    width: 100%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.emoji-picker.visible {
    display: flex;
}

.emoji-option {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    font-size: 1.1rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.emoji-option:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.1);
    transform: scale(1.15);
}

/* ============================================
   CO-OPEN SIDE-BY-SIDE MODE
   ============================================ */

.changelog-modal.co-open {
    left: calc(50% - 16px);
    transform: translate(-100%, -50%) scale(0.95);
}

.changelog-modal.co-open.open {
    transform: translate(-100%, -50%) scale(1);
}

.feedback-modal.co-open {
    left: calc(50% + 16px);
    transform: translate(0, -50%) scale(0.95);
}

.feedback-modal.co-open.open {
    transform: translate(0, -50%) scale(1);
}

.feedback-modal-overlay.co-open-hidden {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Feedback Dismiss Footer */
.feedback-modal-dismiss {
    padding: 0.75rem 1.5rem;
    border-top: 1px solid var(--panel-border);
    display: flex;
    justify-content: center;
}

.feedback-dismiss-btn {
    padding: 0.5rem 1.25rem;
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--panel-text-muted);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.feedback-dismiss-btn:hover {
    color: var(--panel-text);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .changelog-modal,
    .feedback-modal {
        width: calc(100% - 2rem);
        max-height: calc(100vh - 4rem);
    }
}

/* Remove old body margin classes (no longer needed) */
body.changelog-expanded,
body.changelog-minimized {
    margin-right: 0;
}
