/* HTML Code Runner - Multi Language Version */
.html-runner-wrapper {
    width: 100%;
    max-width: 100%;
    margin: 20px 0;
    box-sizing: border-box;
}

.html-runner-container {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    transition: all 0.3s ease;
    position: relative;
}

/* Fullscreen Mode */
.html-runner-fullscreen {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 0 !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    z-index: 9999 !important;
}

.admin-bar .html-runner-fullscreen {
    top: 32px !important;
    height: calc(100vh - 32px) !important;
}

.html-runner-header {
    background: linear-gradient(135deg, #4a90e2, #357abd);
    color: white;
    padding: 1rem;
    text-align: center;
    font-weight: 600;
    font-size: 1.4rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    width: 100%;
    box-sizing: border-box;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.html-runner-header h3 {
    margin: 0;
    flex: 1;
    text-align: center;
    font-size: 1.3rem;
}

.html-runner-header-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.html-runner-main {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    box-sizing: border-box;
    min-height: 500px;
    width: 100% !important;
    max-width: 100% !important;
    flex-wrap: nowrap;
}

.html-runner-fullscreen .html-runner-main {
    height: calc(100% - 80px);
    min-height: auto;
}

.html-runner-editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 45%;
    min-height: 400px;
    width: 100%;
}

.html-runner-fullscreen .html-runner-editor-container {
    min-height: 100%;
    height: 100%;
}

/* Code Tabs */
.code-tabs {
    display: flex;
    background: #2c3e50;
    border-radius: 6px 6px 0 0;
    overflow: hidden;
}

.code-tab {
    flex: 1;
    background: #34495e;
    color: #ecf0f1;
    border: none;
    padding: 0.8rem 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.9rem;
}

.code-tab:hover {
    background: #3d566e;
}

.code-tab.active {
    background: #4a90e2;
    color: white;
}

.tab-content {
    display: none;
    flex: 1;
}

.tab-content.active {
    display: flex;
}

.html-runner-textarea {
    flex: 1;
    width: 100%;
    resize: none;
    padding: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    border: 2px solid #ccc;
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-sizing: border-box;
    background: #1e1e1e;
    color: #d4d4d4;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
    line-height: 1.4;
    min-height: 350px;
}

.html-runner-fullscreen .html-runner-textarea {
    min-height: 100%;
    font-size: 1rem;
}

.html-runner-textarea:focus {
    border-color: #4a90e2;
    outline: none;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.html-runner-buttons {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.5rem;
    justify-content: flex-start;
    flex-wrap: wrap;
    width: 100%;
}

.html-runner-btn {
    border: none;
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 5px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    font-weight: 500;
}

.html-runner-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.15);
}

.html-runner-primary {
    background-color: #4a90e2;
}

.html-runner-primary:hover {
    background-color: #357abd;
}

.html-runner-secondary {
    background-color: #6c757d;
}

.html-runner-secondary:hover {
    background-color: #545b62;
}

.html-runner-info {
    background-color: #17a2b8;
}

.html-runner-info:hover {
    background-color: #138496;
}

.html-runner-warning {
    background-color: #ffc107;
    color: #212529;
}

.html-runner-warning:hover {
    background-color: #e0a800;
}

.html-runner-help {
    background-color: #6f42c1;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    padding: 0;
}

.html-runner-help:hover {
    background-color: #5a359c;
    transform: scale(1.1);
}

.html-runner-preview-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 45%;
    min-height: 400px;
    width: 100%;
}

.html-runner-fullscreen .html-runner-preview-container {
    min-height: 100%;
    height: 100%;
}

/* Fixed Preview Header - Better Visibility */
.preview-header {
    background: #4a90e2 !important;
    color: white !important;
    padding: 0.8rem 1rem !important;
    border-radius: 6px 6px 0 0 !important;
    margin-bottom: 0 !important;
    border-bottom: 2px solid #357abd !important;
}

.preview-header h4 {
    margin: 0 !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    color: white !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1) !important;
}

.html-runner-iframe {
    flex: 1;
    border: 2px solid #4a90e2;
    border-top: none;
    border-radius: 0 0 6px 6px;
    background: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    width: 100%;
    min-height: 400px;
}

.html-runner-fullscreen .html-runner-iframe {
    min-height: 100%;
}

/* Help Modal Styles */
.html-runner-help-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.html-runner-help-modal.active {
    display: flex;
}

.html-runner-help-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.html-runner-help-header {
    background: linear-gradient(135deg, #4a90e2, #357abd);
    color: white;
    padding: 1.5rem;
    border-radius: 12px 12px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.html-runner-help-header h3 {
    margin: 0;
    font-size: 1.4rem;
}

.html-runner-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

.html-runner-close-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.html-runner-help-body {
    padding: 2rem;
}

.html-runner-help-section {
    margin-bottom: 2rem;
}

.html-runner-help-section:last-child {
    margin-bottom: 0;
}

.html-runner-help-section h4 {
    color: #4a90e2;
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    border-bottom: 2px solid #f0f2f5;
    padding-bottom: 0.5rem;
}

.html-runner-help-section ol,
.html-runner-help-section ul {
    padding-left: 1.5rem;
    margin: 0;
}

.html-runner-help-section li {
    margin-bottom: 0.8rem;
    line-height: 1.6;
    color: #555;
}

.html-runner-help-section strong {
    color: #4a90e2;
}

kbd {
    background: #f1f3f4;
    border: 1px solid #dadce0;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.85em;
    font-family: monospace;
    color: #1a73e8;
}

/* Message Styles - Fixed Top Position */
.html-runner-message {
    position: fixed !important;
    top: 20px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    z-index: 10000 !important;
    min-width: 300px !important;
    max-width: 80% !important;
    text-align: center !important;
    padding: 15px 25px !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3) !important;
    animation: messageSlideIn 0.3s ease !important;
    display: none;
}

.admin-bar .html-runner-message {
    top: 60px !important;
}

@keyframes messageSlideIn {
    from { 
        opacity: 0; 
        transform: translateX(-50%) translateY(-20px); 
    }
    to { 
        opacity: 1; 
        transform: translateX(-50%) translateY(0); 
    }
}

.html-runner-message.success {
    background: #4CAF50 !important;
    color: white !important;
    border: 2px solid #45a049 !important;
}

.html-runner-message.error {
    background: #f44336 !important;
    color: white !important;
    border: 2px solid #da190b !important;
}

.html-runner-message.info {
    background: #2196F3 !important;
    color: white !important;
    border: 2px solid #0b7dda !important;
}

/* Fullscreen message adjustment */
.html-runner-fullscreen .html-runner-message {
    top: 20px !important;
}

.admin-bar .html-runner-fullscreen .html-runner-message {
    top: 60px !important;
}

/* WordPress Theme Compatibility */
.entry-content .html-runner-wrapper,
.post-content .html-runner-wrapper,
.wp-block-post-content .html-runner-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .html-runner-main {
        min-height: 450px;
    }
}

@media (max-width: 992px) {
    .html-runner-main {
        flex-wrap: wrap;
    }
    
    .html-runner-editor-container,
    .html-runner-preview-container {
        min-width: 100%;
        min-height: 300px;
    }
}

@media (max-width: 768px) {
    .html-runner-main {
        flex-direction: column;
        gap: 1rem;
        min-height: auto;
        padding: 0.75rem;
    }
    
    .html-runner-buttons {
        justify-content: center;
    }
    
    .html-runner-header {
        padding: 0.75rem;
        font-size: 1.2rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .html-runner-header h3 {
        font-size: 1.1rem;
    }
    
    .code-tab {
        padding: 0.6rem 0.5rem;
        font-size: 0.8rem;
    }
    
    .html-runner-message {
        min-width: 250px !important;
        padding: 15px 20px !important;
        font-size: 14px !important;
    }
    
    .preview-header {
        padding: 0.6rem 0.8rem !important;
    }
    
    .preview-header h4 {
        font-size: 0.9rem !important;
    }
}

@media (max-width: 480px) {
    .html-runner-main {
        padding: 0.5rem;
        gap: 0.5rem;
    }
    
    .html-runner-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.8rem;
        flex: 1;
        min-width: 80px;
    }
    
    .code-tab {
        font-size: 0.75rem;
        padding: 0.5rem 0.3rem;
    }
    
    .html-runner-message {
        min-width: 200px !important;
        padding: 12px 16px !important;
        font-size: 13px !important;
    }
    
    .preview-header {
        padding: 0.5rem 0.6rem !important;
    }
    
    .preview-header h4 {
        font-size: 0.85rem !important;
    }
}