/* assets/css/examples_viewer.css */

/* Import Roboto Mono font */
@import url('https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@400;500&display=swap');

.examples-viewer-container {
    margin: 2rem auto;
    max-width: 1400px;
    padding: 0 1rem;
    width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

/* Button group for example selection */
.examples-btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background-color: #f5f5f5;
    border-radius: 8px;
}

.examples-btn-group button,
.examples-btn-group .example-btn {
    background-color: #ffffff;
    border: 2px solid #ddd;
    color: #333;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.examples-btn-group button:hover,
.examples-btn-group .example-btn:hover {
    background-color: #f0f0f0;
    border-color: #FF6C00;
    transform: translateY(-2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.examples-btn-group button.active,
.examples-btn-group .example-btn.active {
    background-color: #FF6C00 !important;
    color: #ffffff !important;
    border-color: #FF6C00 !important;
    box-shadow: 0 4px 6px rgba(255, 108, 0, 0.3) !important;
}

/* Example display area */
.example-display {
    border: 2px solid #ddd;
    border-radius: 8px;
    background-color: #ffffff;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}

.example-content {
    display: none !important;
}

.example-content.active {
    display: block !important;
}

.example-header {
    background-color: #2c3e50;
    color: #ffffff;
    padding: 1.5rem;
    border-bottom: 3px solid #FF6C00;
}

.example-header h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.example-header .puzzle-info {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.9rem;
    opacity: 0.9;
}

.example-header .puzzle-info span {
    display: inline-block;
}

.example-header .puzzle-info a {
    color: #FF6C00;
    text-decoration: none;
    font-weight: 500;
}

.example-header .puzzle-info a:hover {
    text-decoration: underline;
}

/* Top section: Puzzle + Rules */
.example-top-section {
    display: flex;
    gap: 2rem;
    padding: 2rem;
    background-color: #f9f9f9;
    border-bottom: 2px solid #e0e0e0;
}

.example-puzzle-image {
    flex: 0 0 280px;
}

.example-puzzle-image img {
    width: 100%;
    height: auto;
    border-radius: 4px;
    border: 2px solid #ddd;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.example-rules {
    flex: 1;
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 6px;
    border-left: 4px solid #FF6C00;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.example-rules h4 {
    margin: 0 0 1rem 0;
    color: #2c3e50;
    font-size: 1.1rem;
}

.example-rules ul {
    margin: 0;
    padding-left: 1.5rem;
    list-style-type: disc;
}

.example-rules li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
    color: #555;
}

/* Split-screen section: Analysis + Full Output */
.example-split-section {
    display: flex;
    position: relative;
    min-height: 600px;
    max-height: none;
    overflow: visible;
    width: 100%;
}

/* Left column: Analysis */
.example-analysis {
    flex: 0 0 45%;
    min-width: 0;
    padding: 0;
    overflow-y: visible;
    border-right: 3px solid #e0e0e0;
    background-color: #ffffff;
}

.example-analysis h4 {
    margin: 0;
    padding: 1.5rem 2rem;
    color: #2c3e50;
    font-size: 1.2rem;
    border-bottom: 2px solid #FF6C00;
    position: sticky;
    top: 0;
    background-color: #ffffff;
    z-index: 10;
    box-sizing: border-box;
}

.example-analysis p {
    padding: 2rem;
    line-height: 1.8;
    color: #333;
    text-align: justify;
    margin: 0;
}

/* Hover-enabled text spans */
.highlight-trigger {
    background-color: #fff3cd;
    padding: 2px 4px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 2px dotted #FF6C00;
}

.highlight-trigger:hover {
    background-color: #ffc107;
    color: #000;
    border-bottom-style: solid;
}

/* Right column: Full Output */
.example-full-output {
    flex: 0 0 55%;
    min-width: 0;
    padding: 0;
    overflow-y: auto;
    background-color: #f8f9fa;
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 55%;
}

.example-full-output h4 {
    margin: 0;
    padding: 1.5rem 2rem;
    color: #2c3e50;
    font-size: 1.2rem;
    border-bottom: 2px solid #17a2b8;
    position: sticky;
    top: 0;
    background-color: #f8f9fa;
    z-index: 10;
    box-sizing: border-box;
}

.output-content {
    padding: 2rem;
    line-height: 1.8;
    color: #333;
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
    font-family: 'Roboto Mono', 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    max-width: 100%;
    box-sizing: border-box;
}

.output-content * {
    white-space: pre-wrap !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
}

/* Specific styling for output sections in GRPO/Thought Cloning examples */
.output-section {
    margin-bottom: 2rem;
    padding: 1rem;
    background-color: #ffffff;
    border-left: 4px solid #17a2b8;
    border-radius: 4px;
}

.output-section strong {
    display: block;
    margin-bottom: 0.5rem;
    color: #2c3e50;
    font-size: 1rem;
}

/* Highlightable spans in the output */
.output-highlight {
    transition: all 0.3s ease;
    display: inline;
    padding: 2px 0;
}

/* Highlighted state when triggered by hover */
.output-highlight.highlighted {
    background-color: #fff9e6;
    box-shadow: 0 0 0 4px #fff9e6;
    border-radius: 3px;
}

/* Scrollbar styling for better UX */
.example-analysis::-webkit-scrollbar,
.example-full-output::-webkit-scrollbar {
    width: 8px;
}

.example-analysis::-webkit-scrollbar-track,
.example-full-output::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.example-analysis::-webkit-scrollbar-thumb,
.example-full-output::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.example-analysis::-webkit-scrollbar-thumb:hover,
.example-full-output::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Mobile responsiveness */
@media (max-width: 1024px) {
    .example-split-section {
        flex-direction: column;
        max-height: none;
        position: relative;
    }

    .example-analysis {
        flex: 1;
        border-right: none;
        border-bottom: 3px solid #e0e0e0;
        max-height: 400px;
        overflow-y: auto;
        position: relative;
    }

    .example-full-output {
        flex: 1;
        max-height: 500px;
        position: relative;
        width: 100%;
    }

    .example-top-section {
        flex-direction: column;
    }

    .example-puzzle-image {
        flex: 0 0 auto;
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .examples-btn-group {
        flex-direction: column;
    }

    .examples-btn-group button,
    .examples-btn-group .example-btn {
        width: 100%;
    }

    .example-top-section {
        flex-direction: column;
        padding: 1rem;
    }

    .example-puzzle-image {
        flex: 0 0 auto;
        max-width: 100%;
    }

    .example-header h3 {
        font-size: 1.25rem;
    }

    .example-split-section {
        min-height: auto;
    }

    .example-analysis,
    .example-full-output {
        padding: 0;
        max-height: 300px;
    }

    .example-analysis p,
    .output-content {
        padding: 1rem;
    }
}

/* Category-specific button colors (optional) */
.examples-btn-group button[data-category="gpt5"],
.examples-btn-group .example-btn[data-category="gpt5"] {
    border-left: 4px solid #4CAF50;
}

.examples-btn-group button[data-category="grpo"],
.examples-btn-group .example-btn[data-category="grpo"] {
    border-left: 4px solid #2196F3;
}

.examples-btn-group button[data-category="thought_cloning"],
.examples-btn-group .example-btn[data-category="thought_cloning"] {
    border-left: 4px solid #9C27B0;
}