/* =============================================================================
   script-editor.css - Script Editor Component Styles
   ============================================================================= */

/* Create Content Container */
.create-content {
    flex: 1;
    padding: 0px 20px 20px 20px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* Script Editor Card */
.script-editor-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* Script Editor Header */
.script-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-shrink: 0;
}

.script-editor-header h2 {
    margin: 0;
    color: #585858;
    font-size: 1.5em;
}

/* Editor Controls */
.editor-controls {
    display: flex;
    gap: 8px;
}

.editor-controls .control-btn {
    font-size: 12px;
    padding: 6px 12px;
    margin-left: 8px;
}

/* Script Editor Content */
.script-editor-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.script-editor-content.collapsed {
    flex: 0 0 auto;
    max-height: 100px;
    overflow: hidden;
}

.script-editor-content.expanded {
    flex: 1;
    max-height: none;
}

/* Editor Info Box */
.editor-info {
    background: #f7fafc;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 4px solid #585858;
    flex-shrink: 0;
}

.editor-info p {
    margin: 0 0 8px 0;
    color: #4a5568;
    font-size: 14px;
}

.editor-info p:last-child {
    margin-bottom: 0;
}

.editor-info code {
    background: #e2e8f0;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    color: #2d3748;
}

/* Editor Wrapper */
.editor-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* Script Textarea (fallback when CodeMirror not loaded) */
.script-textarea {
    width: 100%;
    flex: 1;
    min-height: 200px;
    padding: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.5;
    background: #f8f9fa;
    color: #2d3748;
    resize: none;
    transition: border-color 0.3s ease;
}

.script-textarea:focus {
    outline: none;
    border-color: #585858;
    background: rgba(255, 255, 255, 0.95) !important;
    box-shadow: 0 0 0 3px rgba(140, 216, 90, 0.1);
}

.script-textarea::placeholder {
    color: #a0aec0;
    font-style: italic;
}

/* Editor Status */
.editor-status {
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    flex-shrink: 0;
}

/* =============================================================================
   CODEMIRROR INTEGRATION
   ============================================================================= */

.codemirror-container {
    flex: 1;
    min-height: 0;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.3s ease;
    display: flex;
    flex-direction: column;
}

.codemirror-container:focus-within {
    border-color: #585858;
    box-shadow: 0 0 0 3px rgba(140, 216, 90, 0.1);
}

.CodeMirror {
    height: 100% !important;
    flex: 1 !important;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.5;
}

.CodeMirror-scroll {
    height: 100% !important;
    min-height: 100% !important;
    max-height: none !important;
    overflow-y: auto !important;
}

.CodeMirror-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    background: white;
    height: 100vh !important;
}

.CodeMirror-fullscreen .CodeMirror-scroll {
    max-height: none;
    height: 100vh;
}

/* CodeMirror Hints */
.CodeMirror-hints {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 200px;
    overflow-y: auto;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    z-index: 1000;
}

.CodeMirror-hint {
    padding: 6px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f7fafc;
}

.CodeMirror-hint:last-child {
    border-bottom: none;
}

.CodeMirror-hint.CodeMirror-hint-active,
.CodeMirror-hint:hover {
    background: #f7fafc;
    color: #2d3748;
}

/* Hint Type Indicators */
.hint-indicator {
    color: #7c3aed;
    font-weight: 600;
}

.hint-param {
    color: #38b2ac;
    font-weight: 600;
}

.hint-keyword {
    color: #3182ce;
    font-weight: 600;
}

/* Custom CodeMirror Theme Overrides */
.cm-s-material .CodeMirror {
    background-color: #1f1f1f !important;
}

.cm-s-material .CodeMirror-gutters {
    background: #f7fafc;
    border-right: 1px solid #e2e8f0;
}

.cm-s-material .CodeMirror-linenumber {
    color: #a0aec0;
}

.cm-s-material .CodeMirror-cursor {
    border-left: 2px solid #585858;
}

.cm-s-material .CodeMirror-selected {
    background: rgba(140, 216, 90, 0.1);
}

/* Collapsed/Expanded States */
.script-editor-content.collapsed .codemirror-container {
    max-height: 60px;
    overflow: hidden;
    flex: 0 0 60px;
}

.script-editor-content.collapsed .CodeMirror {
    min-height: 60px;
    height: 60px !important;
    flex: none !important;
}

.script-editor-content.collapsed .CodeMirror-scroll {
    min-height: 60px;
    max-height: 60px;
    overflow-y: hidden !important;
}

.script-editor-content.expanded .CodeMirror {
    flex: 1 !important;
}

.script-editor-content.expanded .CodeMirror-scroll {
    overflow-y: auto !important;
}

.script-editor-content.expanded .codemirror-container {
    max-height: none;
    flex: 1;
}

/* Error Highlighting */
.CodeMirror-lint-marker-error {
    background: #f56565;
    border-radius: 2px;
    cursor: pointer;
}

.CodeMirror-lint-tooltip {
    background: #1c2c1a;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 12px;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Issue Styling */
.issue-severity {
    background: currentColor;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    min-width: 50px;
    text-align: center;
}

.issue-message {
    flex: 1;
}

.issue-line {
    color: #718096;
    font-size: 11px;
}