/* Python Editor Specific Styles */

.tool-container {
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 20px;
}

.tool-header {
    text-align: center;
    margin-bottom: 30px;
}

.tool-header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tool-header p {
    color: #6b7280;
    font-size: 1.1rem;
}

/* Editor Card */
.editor-card {
    background: white;
    border-radius: 30px;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

.dark-mode .editor-card {
    background: #1f2937;
    border-color: #374151;
}

/* Editor Header */
.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    flex-wrap: wrap;
    gap: 15px;
}

.dark-mode .editor-header {
    background: #111827;
    border-bottom-color: #374151;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.header-left h3 {
    font-size: 1.1rem;
    color: #111827;
    margin: 0;
}

.dark-mode .header-left h3 {
    color: #f9fafb;
}

.header-left h3 i {
    color: #3b82f6;
    margin-right: 8px;
}

.badge {
    padding: 4px 12px;
    background: #e5e7eb;
    border-radius: 60px;
    font-size: 0.85rem;
    color: #6b7280;
}

.dark-mode .badge {
    background: #374151;
    color: #9ca3af;
}

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.action-btn {
    width: 40px;
    height: 40px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 60px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.dark-mode .action-btn {
    background: #1f2937;
    border-color: #374151;
    color: #9ca3af;
}

.action-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    transform: translateY(-2px);
}

/* Editor Content */
.editor-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 20px;
    min-height: 500px;
}

/* Code Section */
.code-section {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* CodeMirror Customization - LIGHT MODE */
.CodeMirror {
    height: 450px;
    border-radius: 20px;
    font-family: 'Fira Code', monospace;
    font-size: 14px;
    line-height: 1.6;
    border: 2px solid #e5e7eb;
    background: #f9fafb !important;
    color: #111827 !important;
}

.CodeMirror-gutters {
    background: #f9fafb !important;
    border-right: 1px solid #e5e7eb !important;
}

.CodeMirror-linenumber {
    color: #6b7280 !important;
}

/* LIGHT MODE SYNTAX COLORS */
.cm-s-default .cm-keyword { color: #3b82f6 !important; font-weight: bold; }
.cm-s-default .cm-string { color: #10b981 !important; }
.cm-s-default .cm-string-2 { color: #10b981 !important; }
.cm-s-default .cm-number { color: #f59e0b !important; }
.cm-s-default .cm-def { color: #8b5cf6 !important; }
.cm-s-default .cm-comment { color: #6b7280 !important; font-style: italic; }
.cm-s-default .cm-variable { color: #111827 !important; }
.cm-s-default .cm-variable-2 { color: #3b82f6 !important; }
.cm-s-default .cm-operator { color: #ef4444 !important; }
.cm-s-default .cm-builtin { color: #8b5cf6 !important; }

/* DARK MODE - COMPLETELY DIFFERENT COLORS */
.dark-mode .CodeMirror {
    background: #1e1e1e !important;
    color: #d4d4d4 !important;
    border-color: #374151 !important;
}

.dark-mode .CodeMirror-gutters {
    background: #1e1e1e !important;
    border-right-color: #374151 !important;
}

.dark-mode .CodeMirror-linenumber {
    color: #6b7280 !important;
}

.dark-mode .cm-s-default .cm-keyword { color: #569cd6 !important; font-weight: bold; }
.dark-mode .cm-s-default .cm-string { color: #ce9178 !important; }
.dark-mode .cm-s-default .cm-string-2 { color: #ce9178 !important; }
.dark-mode .cm-s-default .cm-number { color: #b5cea8 !important; }
.dark-mode .cm-s-default .cm-def { color: #9cdcfe !important; }
.dark-mode .cm-s-default .cm-comment { color: #6a9955 !important; font-style: italic; }
.dark-mode .cm-s-default .cm-variable { color: #d4d4d4 !important; }
.dark-mode .cm-s-default .cm-variable-2 { color: #9cdcfe !important; }
.dark-mode .cm-s-default .cm-operator { color: #d4d4d4 !important; }
.dark-mode .cm-s-default .cm-builtin { color: #dcdcaa !important; }

/* Output Section */
.output-section {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 0 5px;
}

.output-header span {
    font-size: 0.9rem;
    color: #6b7280;
}

.output-header span i {
    color: #10b981;
    margin-right: 5px;
}

.output-controls {
    display: flex;
    gap: 8px;
}

.run-btn {
    padding: 6px 16px;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 60px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.run-btn:hover {
    background: #059669;
    transform: translateY(-2px);
}

.run-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.clear-output-btn {
    width: 36px;
    height: 36px;
    background: transparent;
    border: 2px solid #e5e7eb;
    border-radius: 60px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dark-mode .clear-output-btn {
    border-color: #374151;
    color: #9ca3af;
}

.clear-output-btn:hover {
    border-color: #ef4444;
    color: #ef4444;
}

.output-container {
    flex: 1;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 20px;
    overflow: auto;
    min-height: 400px;
}

.dark-mode .output-container {
    background: #111827;
    border-color: #374151;
}

.output {
    padding: 20px;
    margin: 0;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #111827;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.dark-mode .output {
    color: #f9fafb;
}

.output.error {
    color: #ef4444;
}

.output.success {
    color: #10b981;
}

/* Info Bar */
.info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    flex-wrap: wrap;
    gap: 15px;
}

.dark-mode .info-bar {
    background: #111827;
    border-top-color: #374151;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #6b7280;
    font-size: 0.9rem;
}

.info-item i {
    font-size: 1rem;
}

.info-item i.fa-clock {
    color: #f59e0b;
}

.info-item i.fa-code {
    color: #3b82f6;
}

.info-item i.fa-font {
    color: #8b5cf6;
}

.info-item span span {
    font-weight: 600;
    color: #111827;
}

.dark-mode .info-item span span {
    color: #f9fafb;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(5px);
}

.loading-content {
    background: white;
    padding: 40px;
    border-radius: 30px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
}

.dark-mode .loading-content {
    background: #1f2937;
    color: #f9fafb;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-content h3 {
    margin-bottom: 10px;
    color: #111827;
}

.dark-mode .loading-content h3 {
    color: #f9fafb;
}

.loading-content p {
    color: #6b7280;
    margin-bottom: 20px;
}

.dark-mode .loading-content p {
    color: #9ca3af;
}

.loading-progress {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
    margin: 20px 0;
}

.loading-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    width: 0%;
    transition: width 0.3s ease;
}

.loading-tip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: #f3f4f6;
    border-radius: 60px;
    font-size: 0.9rem;
    color: #6b7280;
    text-align: left;
}

.dark-mode .loading-tip {
    background: #374151;
    color: #9ca3af;
}

.loading-tip i {
    color: #f59e0b;
    font-size: 1.2rem;
}

.loading-tip span {
    flex: 1;
}

/* Info Section */
.info-section {
    background: #f9fafb;
    border-radius: 30px;
    padding: 30px;
    margin: 30px 0;
    border: 1px solid #e5e7eb;
}

.dark-mode .info-section {
    background: #111827;
    border-color: #374151;
}

.info-section h3 {
    font-size: 1.3rem;
    margin: 20px 0 15px;
    color: #111827;
}

.dark-mode .info-section h3 {
    color: #f9fafb;
}

.info-section h3:first-child {
    margin-top: 0;
}

.info-section p {
    color: #6b7280;
    line-height: 1.6;
    margin-bottom: 15px;
}

.dark-mode .info-section p {
    color: #9ca3af;
}

.info-section ul {
    list-style: none;
    padding: 0;
}

.info-section ul li {
    padding: 8px 0;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dark-mode .info-section ul li {
    color: #9ca3af;
}

.tip-box {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 20px;
    background: #f0f9ff;
    border-radius: 20px;
    margin-top: 20px;
    border: 1px solid #bae6fd;
}

.dark-mode .tip-box {
    background: #1e3a5f;
    border-color: #2563eb;
}

.tip-box i {
    font-size: 1.5rem;
    color: #f59e0b;
    margin-top: 2px;
}

.tip-box div {
    color: #0369a1;
    font-size: 0.95rem;
    line-height: 1.5;
}

.dark-mode .tip-box div {
    color: #bae6fd;
}

.tip-box strong {
    color: #111827;
}

.dark-mode .tip-box strong {
    color: #f9fafb;
}

kbd {
    background: #e5e7eb;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.8rem;
    font-family: monospace;
    border: 1px solid #d1d5db;
}

.dark-mode kbd {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .tool-header h1 {
        font-size: 2rem;
    }
    
    .editor-content {
        grid-template-columns: 1fr;
    }
    
    .CodeMirror,
    .output-container {
        height: 350px;
    }
    
    .editor-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .header-actions {
        width: 100%;
        justify-content: center;
    }
    
    .info-bar {
        flex-direction: column;
        align-items: flex-start;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Input Dialog */
.input-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(5px);
}

.input-dialog-content {
    background: white;
    padding: 30px;
    border-radius: 30px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.dark-mode .input-dialog-content {
    background: #1f2937;
    color: #f9fafb;
}

.input-dialog-content h4 {
    margin-bottom: 15px;
    color: #111827;
}

.dark-mode .input-dialog-content h4 {
    color: #f9fafb;
}

.input-dialog-content h4 i {
    color: #3b82f6;
    margin-right: 8px;
}

.input-dialog-content p {
    color: #6b7280;
    margin-bottom: 15px;
}

.input-field {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e5e7eb;
    border-radius: 60px;
    font-size: 1rem;
    margin-bottom: 20px;
    background: white;
    color: #111827;
}

.dark-mode .input-field {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}

.input-field:focus {
    outline: none;
    border-color: #3b82f6;
}

.input-dialog-buttons {
    display: flex;
    gap: 10px;
}

.input-submit {
    flex: 2;
    padding: 12px;
    background: #3b82f6;
    color: white;
    border: none;
    border-radius: 60px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.input-submit:hover {
    background: #2563eb;
}

.input-cancel {
    flex: 1;
    padding: 12px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 60px;
    color: #111827;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dark-mode .input-cancel {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
}

.input-cancel:hover {
    background: #e5e7eb;
}

.dark-mode .input-cancel:hover {
    background: #4b5563;
}

/* Terminal-style input */
.input-prompt {
    color: #10b981;
    font-weight: 500;
}

.input-line {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 5px 0;
}

.input-cursor {
    color: #3b82f6;
    font-weight: bold;
    font-size: 1.2rem;
}

.input-field {
    background: transparent;
    border: none;
    border-bottom: 2px solid #3b82f6;
    color: inherit;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    padding: 4px 8px;
    width: 300px;
    outline: none;
}

.dark-mode .input-field {
    color: #f9fafb;
    border-bottom-color: #10b981;
}

.input-value {
    color: #f59e0b;
    display: inline-block;
    margin-left: 20px;
}

.output {
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.8;
}

/* Terminal-style output */
.output {
    font-family: 'Fira Code', monospace;
    line-height: 1.8;
    padding: 15px;
}

.output-line {
    color: #10b981;
    margin: 2px 0;
}

.input-prompt-line {
    color: #3b82f6;
    margin-top: 10px;
    font-weight: 500;
}

.input-line {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 5px 0 10px 0;
}

.prompt-arrow {
    color: #f59e0b;
    font-weight: bold;
    font-size: 1.1rem;
}

.terminal-input {
    background: transparent;
    border: none;
    border-bottom: 2px solid #3b82f6;
    color: inherit;
    font-family: 'Fira Code', monospace;
    font-size: 0.95rem;
    padding: 5px 10px;
    width: 300px;
    outline: none;
}

.dark-mode .terminal-input {
    border-bottom-color: #10b981;
    color: #f9fafb;
}

.input-value-line {
    color: #f59e0b;
    margin: 5px 0;
}

.input-value-line .prompt {
    color: #6b7280;
}

.input-value-line .value {
    color: #10b981;
    font-weight: 500;
}

.error {
    color: #ef4444 !important;
}

.success {
    color: #10b981 !important;
}

/* Scrollbar for output */
.output-container {
    overflow-y: auto;
    max-height: 400px;
}

.output-container::-webkit-scrollbar {
    width: 8px;
}

.output-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.output-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.output-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Terminal-style input and output */
.output-line {
    color: #10b981;
    margin: 2px 0;
    font-family: 'Fira Code', monospace;
}

.input-prompt {
    color: #3b82f6;
    margin-top: 10px;
    font-weight: 500;
    font-family: 'Fira Code', monospace;
}

.input-line {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 5px 0 15px;
}

.prompt-arrow {
    color: #f59e0b;
    font-weight: bold;
    font-size: 1.2rem;
}

.terminal-input {
    background: transparent;
    border: none;
    border-bottom: 2px solid #3b82f6;
    color: inherit;
    font-family: 'Fira Code', monospace;
    font-size: 0.95rem;
    padding: 5px 10px;
    width: 300px;
    outline: none;
    transition: border-color 0.3s;
}

.dark-mode .terminal-input {
    border-bottom-color: #10b981;
    color: #f9fafb;
}

.terminal-input:focus {
    border-bottom-color: #8b5cf6;
}

.input-value {
    color: #f59e0b;
    margin: 5px 0 10px;
    font-family: 'Fira Code', monospace;
}

.input-value .prompt {
    color: #6b7280;
}

.input-value .typed-value {
    color: #10b981;
    font-weight: 500;
    margin-left: 10px;
}

.error {
    color: #ef4444 !important;
}

.success {
    color: #10b981 !important;
}

/* Scrollbar styling */
.output-container {
    overflow-y: auto;
    max-height: 400px;
    padding: 10px;
    background: #f9fafb;
    border-radius: 20px;
}

.dark-mode .output-container {
    background: #111827;
}

.output-container::-webkit-scrollbar {
    width: 8px;
}

.output-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.output-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.output-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}