/* UAC Code Playground Styles */

.s_code_playground {
    background: #f8f9fa;
    padding: 30px 0;
}

.code-playground-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    min-height: 600px;
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Code Editor Section */
.code-editor-section {
    display: flex;
    flex-direction: column;
}

.editor-header {
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.editor-header h5 {
    color: #495057;
    font-weight: 600;
}

.editor-controls .btn {
    margin-left: 5px;
}

.code-editor-textarea {
    font-family: 'Courier New', 'Monaco', 'Menlo', monospace;
    font-size: 14px;
    line-height: 1.5;
    border: 1px solid #ced4da;
    border-radius: 8px;
    padding: 15px;
    resize: vertical;
    background-color: #f8f9fa;
    color: #212529;
    flex: 1;
    min-height: 500px;
}

.code-editor-textarea:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    background-color: white;
}

.code-editor-textarea::placeholder {
    color: #6c757d;
    font-style: italic;
}

/* Preview Section */
.preview-section {
    display: flex;
    flex-direction: column;
}

.preview-header {
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.preview-header h5 {
    color: #495057;
    font-weight: 600;
}

.preview-controls .btn {
    margin-left: 5px;
}

.preview-container {
    flex: 1;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #ced4da;
}

.preview-iframe {
    width: 100%;
    height: 100%;
    min-height: 500px;
    border: none;
    background: white;
    display: block;
}

.preview-error {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.preview-error .alert {
    margin: 0;
    max-width: 400px;
}

/* Status Bar */
.status-bar {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 10px 15px;
    border: 1px solid #e9ecef;
}

.status-info small {
    display: flex;
    align-items: center;
}

.status-info i {
    margin-right: 5px;
}

.status-actions {
    display: flex;
    align-items: center;
}

.s_code_playground .form-check-label {
    display: flex;
    align-items: center;
    margin-bottom: 0;
    cursor: pointer;
}

.s_code_playground .form-check-input {
    margin-right: 5px;
}

/* Tool Header */
.tool-header h2 {
    color: #495057;
    font-weight: 600;
    margin-bottom: 10px;
}

.tool-header p {
    color: #6c757d;
    font-size: 16px;
}

/* Button Styles - Scoped to Code Playground */
.s_code_playground .btn-primary {
    background-color: #007bff;
    border-color: #007bff;
}

.s_code_playground .btn-primary:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}

.s_code_playground .btn-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
}

.s_code_playground .btn-secondary:hover {
    background-color: #545b62;
    border-color: #545b62;
}

.s_code_playground .btn-info {
    background-color: #17a2b8;
    border-color: #17a2b8;
}

.s_code_playground .btn-info:hover {
    background-color: #117a8b;
    border-color: #117a8b;
}

.s_code_playground .btn-outline-secondary {
    color: #6c757d;
    border-color: #6c757d;
}

.s_code_playground .btn-outline-secondary:hover {
    background-color: #6c757d;
    border-color: #6c757d;
    color: white;
}

/* Responsive Design */
@media (max-width: 992px) {
    .code-playground-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .editor-header,
    .preview-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .editor-controls,
    .preview-controls {
        margin-top: 10px;
    }
    
    .status-bar .d-flex {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .status-actions {
        margin-top: 10px;
        width: 100%;
        justify-content: space-between;
    }
}

@media (max-width: 576px) {
    .s_code_playground {
        padding: 20px 0;
    }
    
    .code-playground-container {
        padding: 15px;
        margin: 0 10px;
    }
    
    .code-editor-textarea {
        font-size: 12px;
        min-height: 300px;
    }
    
    .preview-iframe {
        min-height: 300px;
    }
    
    .editor-controls .btn,
    .preview-controls .btn {
        padding: 5px 10px;
        font-size: 12px;
        margin-left: 3px;
    }
    
    .tool-header h2 {
        font-size: 24px;
    }
    
    .tool-header p {
        font-size: 14px;
    }
}

/* Loading Animation */
.preview-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
}

.preview-loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Toast Animations */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Fullscreen Mode */
.preview-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    background: white;
}

.preview-fullscreen .preview-iframe {
    width: 100%;
    height: calc(100vh - 60px);
}

.preview-fullscreen .preview-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: white;
    z-index: 10;
    padding: 15px;
    border-bottom: 1px solid #e9ecef;
}

/* Syntax Highlighting Hints */
.code-editor-textarea {
    tab-size: 2;
    -moz-tab-size: 2;
}

/* Focus States */
.code-editor-textarea:focus,
.preview-iframe:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
