/* Try It Editor Styles */

.tryit-container {
    display: flex;
    gap: 0;
    margin: 20px 0;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #1e1e1e;
    min-height: 400px;
}

.tryit-editor-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.tryit-preview-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
    min-width: 0;
}

.tryit-pane-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #2d2d2d;
    border-bottom: 1px solid #444;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
}

.tryit-preview-pane .tryit-pane-header {
    background: #04AA6D;
    border-bottom: 1px solid #03985a;
}

.tryit-editor-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.tryit-editor {
    width: 100%;
    height: 100%;
    min-height: 300px;
    padding: 15px;
    border: none;
    resize: none;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    background: #1e1e1e;
    color: #d4d4d4;
    tab-size: 2;
    outline: none;
}

.tryit-editor:focus {
    outline: none;
}

.tryit-preview-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #fff;
}

.tryit-preview-frame {
    width: 100%;
    height: 100%;
    min-height: 300px;
    border: none;
    background: #fff;
}

.tryit-run-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #04AA6D;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.tryit-run-btn:hover {
    background: #03985a;
}

.tryit-run-btn svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.tryit-reset-btn {
    padding: 6px 12px;
    background: transparent;
    color: #aaa;
    border: 1px solid #555;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.tryit-reset-btn:hover {
    background: #444;
    color: #fff;
    border-color: #666;
}

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

/* Language tabs */
.tryit-tabs {
    display: flex;
    background: #2d2d2d;
    border-bottom: 1px solid #444;
}

.tryit-tab {
    padding: 10px 20px;
    background: transparent;
    color: #888;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.tryit-tab:hover {
    color: #ccc;
    background: #353535;
}

.tryit-tab.active {
    color: #fff;
    background: #1e1e1e;
    border-bottom-color: #04AA6D;
}

/* Editor panels for tabs */
.tryit-editors-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.tryit-editor-panel {
    display: none;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.tryit-editor-panel.active {
    display: block;
}

.tryit-editor-panel .CodeMirror {
    height: 100% !important;
}

.tryit-editor-panel textarea {
    width: 100%;
    height: 100%;
    border: none;
    resize: none;
    background: #1e1e1e;
    color: #d4d4d4;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    padding: 15px;
}

/* Inline Try It Button */
.tryit-inline-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    margin: 10px 0;
    background: #04AA6D;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.tryit-inline-btn:hover {
    background: #03985a;
    color: white;
}

/* Modal for Try It Editor */
.tryit-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.tryit-modal.active {
    display: flex;
}

.tryit-modal-content {
    width: 100%;
    max-width: 1400px;
    height: 90vh;
    max-height: 800px;
    background: #1e1e1e;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.tryit-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #04AA6D;
    color: white;
}

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

.tryit-close-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: background 0.2s;
}

.tryit-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Modal header actions */
.tryit-modal-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tryit-newtab-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 4px;
    color: white;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.tryit-newtab-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.tryit-newtab-btn svg {
    flex-shrink: 0;
}

.tryit-modal-body {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* Success/Error messages in preview */
.tryit-success-msg {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 8px 16px;
    background: #04AA6D;
    color: white;
    border-radius: 4px;
    font-size: 13px;
    animation: fadeInOut 2s ease-in-out forwards;
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }

    10% {
        opacity: 1;
        transform: translateY(0);
    }

    80% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}

/* Responsive */
@media screen and (max-width: 900px) {

    .tryit-container,
    .tryit-modal-body {
        flex-direction: column;
    }

    .tryit-editor-pane,
    .tryit-preview-pane {
        width: 100%;
        min-height: 250px;
    }
}

/* Fullscreen page styles */
.tryit-fullpage {
    display: flex;
    height: 100vh;
    background: #1e1e1e;
}

.tryit-fullpage .tryit-editor-pane {
    border-right: 1px solid #444;
}

.tryit-fullpage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: #04AA6D;
    color: white;
}

.tryit-fullpage-header h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
}

.tryit-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: white;
    text-decoration: none;
    font-size: 14px;
    opacity: 0.9;
}

.tryit-back-link:hover {
    opacity: 1;
}

/* Line numbers */
.tryit-line-numbers {
    position: absolute;
    left: 0;
    top: 0;
    padding: 15px 10px;
    text-align: right;
    background: #252525;
    color: #666;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    user-select: none;
    border-right: 1px solid #333;
}