/* Spec Review Page Custom Styling */

:root {
    --color-primary: #8257e5;
    --color-secondary: #00e6ff;
    --color-background-dark: #0a0a14;
    --color-glass-bg: rgba(255, 255, 255, 0.03);
    --color-glass-border: rgba(255, 255, 255, 0.08);
    --color-text-light: #e0e0ff;
    --color-text-muted: #8f8fa3;
    --color-accent: #ff6b81;
    --transition-speed: 0.25s;
    --sidebar-width: 380px;
    --selected-glow: rgba(0, 230, 255, 0.15);
}

/* Base resets & layouts for review page */
.review-body {
    background-color: var(--color-background-dark);
    color: var(--color-text-light);
    font-family: 'Outfit', 'Noto Sans KR', sans-serif;
    margin: 0;
    padding: 0;
    overflow: hidden; /* Main window is fixed, columns scroll */
    height: 100vh;
}

/* Outer layout wrapper */
.review-app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Top Toolbar */
.review-toolbar {
    background: rgba(10, 10, 20, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--color-glass-border);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
    gap: 15px;
    flex-wrap: wrap;
}

.toolbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: white;
}

.toolbar-brand img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.toolbar-brand h1 {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin: 0;
}

.toolbar-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Toolbar Buttons */
.tool-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--color-glass-border);
    border-top: 1px solid rgba(255, 255, 255, 0.12); /* Subtle top highlight */
    color: var(--color-text-light);
    padding: 9px 18px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-speed);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.tool-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    border-top-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.tool-btn.primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.25);
    color: white;
}

.tool-btn.primary:hover {
    box-shadow: 0 5px 15px rgba(0, 230, 255, 0.3);
    border-top-color: rgba(255, 255, 255, 0.4);
}

.btn-text-mobile {
    display: none;
}

.btn-text-desktop {
    display: inline;
}

/* Workspace Panels Split Layout */
.review-workspace {
    display: flex;
    flex: 1;
    overflow: hidden; /* Lock viewport */
    position: relative;
}

/* Left Pane - Document Reader */
.document-pane {
    flex: 1;
    overflow-y: auto;
    padding: 40px 5%;
    scroll-behavior: smooth;
    background: linear-gradient(180deg, rgba(10, 10, 20, 0.2) 0%, rgba(5, 5, 10, 0.5) 100%);
}

/* Styling Scrollbars */
.document-pane::-webkit-scrollbar,
.comments-pane-inner::-webkit-scrollbar {
    width: 8px;
}

.document-pane::-webkit-scrollbar-track,
.comments-pane-inner::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
}

.document-pane::-webkit-scrollbar-thumb,
.comments-pane-inner::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
}

.document-pane::-webkit-scrollbar-thumb:hover,
.comments-pane-inner::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Spec Document Formatting */
.spec-document {
    max-width: 800px;
    margin: 0 auto;
    padding-bottom: 100px;
}

.spec-document h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 10px;
    line-height: 1.3;
    color: white;
}

.spec-document .spec-meta {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    border-left: 2px solid var(--color-primary);
    padding-left: 15px;
    margin-bottom: 40px;
}

.spec-document .spec-meta p {
    margin-bottom: 5px;
}

.spec-document h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin-top: 50px;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 8px;
}

.spec-document h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-secondary);
    margin-top: 30px;
    margin-bottom: 15px;
}

.spec-document p {
    font-size: 0.98rem;
    color: #c4c4d4;
    line-height: 1.8;
    margin-bottom: 15px;
}

.spec-document ul, .spec-document ol {
    margin-bottom: 20px;
    padding-left: 20px;
}

.spec-document li {
    font-size: 0.98rem;
    color: #c4c4d4;
    line-height: 1.8;
    margin-bottom: 8px;
}

.spec-document code {
    font-family: monospace;
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    color: #ff8fa3;
    font-size: 0.9em;
}

.spec-document pre {
    background: #06060c;
    border: 1px solid var(--color-glass-border);
    padding: 20px;
    border-radius: 12px;
    overflow-x: auto;
    font-family: monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 20px 0;
    color: #a5a5c5;
}

/* Interactive Review Blocks */
.review-block {
    position: relative;
    border-left: 3px solid transparent;
    padding-left: 15px;
    margin-bottom: 8px;
    border-radius: 0 8px 8px 0;
    transition: all var(--transition-speed);
    cursor: pointer;
}

.review-block:hover {
    background: rgba(130, 87, 229, 0.04);
    border-left-color: rgba(130, 87, 229, 0.4);
    padding-left: 18px;
}

/* Selected Active State */
.review-block.selected {
    background: rgba(0, 230, 255, 0.06);
    border-left-color: var(--color-secondary);
    box-shadow: 0 0 20px var(--selected-glow);
    padding-left: 20px;
}

/* Review block dynamic indicators */
.block-badge {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--color-glass-border);
    color: var(--color-text-muted);
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 10px;
    opacity: 0;
    transition: opacity var(--transition-speed);
    pointer-events: none;
}

.review-block:hover .block-badge {
    opacity: 1;
}

.review-block.has-comments .block-badge {
    opacity: 1;
    background: rgba(0, 230, 255, 0.1);
    border-color: rgba(0, 230, 255, 0.3);
    color: var(--color-secondary);
    font-weight: 600;
}

.review-block.selected .block-badge {
    opacity: 1;
    background: var(--color-secondary);
    border-color: var(--color-secondary);
    color: black;
    font-weight: 700;
}

/* Right Pane - Comment Sidebar */
.comments-pane {
    width: var(--sidebar-width);
    background: rgba(12, 12, 22, 0.95);
    border-left: 1px solid var(--color-glass-border);
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    z-index: 5;
    transition: transform var(--transition-speed) ease-in-out;
}

.comments-pane-inner {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
    padding: 25px;
}

/* Comments Header */
.comments-pane-header {
    border-bottom: 1px solid var(--color-glass-border);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.comments-pane-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Empty State */
.comments-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: var(--color-text-muted);
    padding: 40px 20px;
}

.comments-empty-state i {
    font-size: 3rem;
    margin-bottom: 20px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.comments-empty-state p {
    font-size: 0.9rem;
    line-height: 1.6;
}

/* Active Workspace Context (Selected Block Info) */
.selected-block-preview {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--color-glass-border);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
    font-size: 0.85rem;
}

.selected-block-preview h5 {
    color: var(--color-secondary);
    font-weight: 700;
    margin-bottom: 6px;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.selected-block-preview p {
    color: var(--color-text-muted);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}

/* Comments List */
.comments-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 25px;
}

.comment-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--color-glass-border);
    border-radius: 12px;
    padding: 15px;
    position: relative;
    animation: slideIn 0.25s ease-out;
}

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

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

.comment-author {
    font-size: 0.88rem;
    font-weight: 700;
    color: white;
}

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

.comment-body {
    font-size: 0.9rem;
    color: #c4c4d4;
    line-height: 1.5;
    word-break: break-all;
    white-space: pre-line;
}

.comment-delete-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 1rem;
    opacity: 0;
    transition: opacity var(--transition-speed), color var(--transition-speed);
}

.comment-card:hover .comment-delete-btn {
    opacity: 1;
}

.comment-delete-btn:hover {
    color: var(--color-accent);
}

/* Comments Input Form */
.comment-form {
    border-top: 1px solid var(--color-glass-border);
    padding-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.comment-form input,
.comment-form textarea {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--color-glass-border);
    color: white;
    padding: 10px 12px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    transition: all var(--transition-speed);
}

.comment-form input:focus,
.comment-form textarea:focus {
    outline: none;
    border-color: var(--color-secondary);
    background: rgba(0, 0, 0, 0.5);
}

.comment-form button {
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    border: none;
    color: white;
    padding: 12px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.comment-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 230, 255, 0.3);
}

/* Floating Action Button for Mobile Comment Trigger */
.mobile-comments-toggle {
    display: none;
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: white;
    border: none;
    box-shadow: 0 10px 25px rgba(130, 87, 229, 0.4);
    cursor: pointer;
    z-index: 100;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: transform var(--transition-speed);
}

.mobile-comments-toggle.active {
    transform: rotate(90deg);
}

.mobile-comments-toggle .badge-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--color-accent);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 10px;
    padding: 2px 6px;
    border: 2px solid var(--color-background-dark);
}

/* Dialog Customization (Import Modal) */
dialog {
    background: rgba(15, 15, 25, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.6);
    color: var(--color-text-light);
    margin: auto;
    z-index: 1000;
}

dialog::backdrop {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

dialog h3 {
    margin-top: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

dialog p {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    line-height: 1.6;
    margin-bottom: 20px;
}

dialog .dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 25px;
}

.file-drop-area {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.01);
    transition: all var(--transition-speed);
}

.file-drop-area:hover {
    border-color: var(--color-secondary);
    background: rgba(0, 230, 255, 0.02);
}

.file-drop-area i {
    font-size: 2.5rem;
    color: var(--color-text-muted);
    margin-bottom: 12px;
}

.file-drop-area p {
    margin: 0;
    font-size: 0.9rem;
}

.file-drop-area input[type="file"] {
    display: none;
}

/* Image formatting in specification */
.spec-document img {
    max-width: 100%;
    border-radius: 12px;
    border: 1px solid var(--color-glass-border);
    margin: 25px 0;
    display: block;
}

/* Render diagrams beautifully */
.audio-flow-diagram {
    font-family: monospace;
    white-space: pre;
    background-color: #06060c !important;
    border: 1px solid var(--color-glass-border);
    border-radius: 12px;
    padding: 15px;
    overflow-x: auto;
    font-size: 0.85rem;
    color: #a5a5c5;
    margin: 20px 0;
    line-height: 1.4;
}

/* Eterna Welcome Banner & 3D Previews */
.eterna-welcome-banner {
    background: rgba(130, 87, 229, 0.06);
    border: 1px solid rgba(130, 87, 229, 0.2);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.eterna-welcome-avatar {
    background: rgba(130, 87, 229, 0.1);
    border: 1px solid rgba(130, 87, 229, 0.2);
    width: 45px;
    height: 45px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: var(--color-secondary);
    flex-shrink: 0;
}

.renders-preview-container {
    display: flex;
    gap: 15px;
    margin: 15px 0;
    align-items: flex-start;
}

.render-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.render-item img {
    margin: 0 !important; /* Override default margins */
    border-radius: 8px;
    width: 100%;
    height: auto;
    display: block;
}

.render-item p {
    font-size: 0.82rem;
    text-align: center;
    margin-top: 10px;
    color: var(--color-text-muted);
    word-break: keep-all;
}

/* Media Query Responsiveness for Split Workspace */
@media (max-width: 900px) {
    .review-toolbar {
        padding: 10px 15px;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        justify-content: space-between !important;
        align-items: center !important;
    }

    .review-workspace {
        flex-direction: column;
    }

    .document-pane {
        padding: 30px 20px;
        flex: 1;
    }

    /* Transform sidebar to a slide-in bottom drawer on mobile */
    .comments-pane {
        width: 100%;
        height: 60vh;
        position: fixed;
        bottom: 0;
        left: 0;
        border-left: none;
        border-top: 1px solid var(--color-glass-border);
        transform: translateY(100%);
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
    }

    .comments-pane.open {
        transform: translateY(0);
    }

    .mobile-comments-toggle {
        display: flex;
    }

    .toolbar-actions {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        gap: 6px !important;
        width: auto !important;
        margin-top: 0 !important;
        align-items: center !important;
    }
    
    .tool-btn {
        width: auto !important;
        justify-content: center !important;
        padding: 8px 10px !important;
        font-size: 0.8rem !important;
        border-radius: 8px !important;
        white-space: nowrap !important;
    }

    .btn-text-desktop {
        display: none !important;
    }

    .btn-text-mobile {
        display: inline !important;
    }

    .eterna-welcome-banner {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 10px;
    }

    .renders-preview-container {
        flex-direction: column;
        gap: 20px;
        width: 100%;
    }

    .render-item {
        width: 100%;
    }

    .render-item p {
        font-size: 0.88rem;
    }

    .spec-document h1 {
        font-size: 1.6rem;
        margin-bottom: 8px;
    }
    
    .spec-document h2 {
        font-size: 1.3rem;
        margin-top: 30px;
    }
    
    .spec-document h3 {
        font-size: 1.1rem;
        margin-top: 20px;
    }
}

