﻿/* ==================== Code Editor Page Styles ==================== */

.code-editor-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--bg-primary, #1e1e1e);
    color: var(--text-primary, #d4d4d4);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* ==================== Header ==================== */
.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--bg-secondary, #252526);
    border-bottom: 1px solid var(--border-color, #3e3e42);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 100;
}

.header-left h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color, #007acc);
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.editor-main {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* ==================== Sidebar ==================== */
.editor-sidebar {
    width: 250px;
    background: var(--bg-sidebar, #252526);
    border-right: 1px solid var(--border-color, #3e3e42);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, width 0.3s ease;
    overflow-y: auto;
}

.editor-sidebar.hide {
    transform: translateX(-100%);
    width: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color, #3e3e42);
    background: var(--bg-secondary, #2d2d30);
}

.sidebar-header h4 {
 margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary, #cccccc);
}

.btn-icon {
    padding: 6px 10px;
    background: transparent;
    border: 1px solid var(--border-color, #3e3e42);
    color: var(--text-primary, #d4d4d4);
    border-radius: 4px;
 cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85rem;
}

.btn-icon:hover {
    background: var(--primary-color, #007acc);
    border-color: var(--primary-color, #007acc);
color: #fff;
}

.file-list {
    padding: 8px 0;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    position: relative;
}

.file-item:hover {
    background: var(--bg-hover, #2a2d2e);
}

.file-item.active {
    background: var(--bg-active, #37373d);
    border-left-color: var(--primary-color, #007acc);
}

.file-item i {
    color: var(--icon-color, #858585);
    font-size: 0.9rem;
}

.file-item span {
    flex: 1;
    font-size: 0.9rem;
 overflow: hidden;
text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-delete {
    opacity: 0;
    padding: 4px 8px;
    background: transparent;
    border: none;
    color: var(--danger-color, #f48771);
    cursor: pointer;
transition: all 0.2s ease;
    font-size: 0.8rem;
}

.file-item:hover .btn-delete {
  opacity: 1;
}

.btn-delete:hover {
    color: #ff0000;
    transform: scale(1.2);
}

.btn-toggle-sidebar {
  position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    padding: 10px 12px;
    background: var(--bg-secondary, #252526);
    border: 1px solid var(--border-color, #3e3e42);
    border-radius: 4px;
    color: var(--text-primary, #d4d4d4);
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
}

.btn-toggle-sidebar:hover {
    background: var(--primary-color, #007acc);
    border-color: var(--primary-color, #007acc);
    color: #fff;
}

/* ==================== Editor Content ==================== */
.editor-content {
  flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.editor-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 15px;
    background: var(--bg-secondary, #252526);
    border-bottom: 1px solid var(--border-color, #3e3e42);
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-toolbar {
    padding: 6px 12px;
    background: var(--bg-tertiary, #2d2d30);
    border: 1px solid var(--border-color, #3e3e42);
    color: var(--text-primary, #d4d4d4);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
  font-size: 0.85rem;
}

.btn-toolbar:hover:not(:disabled) {
    background: var(--primary-color, #007acc);
    border-color: var(--primary-color, #007acc);
    color: #fff;
}

.btn-toolbar:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.file-info {
    font-size: 0.85rem;
    color: var(--text-secondary, #858585);
    display: flex;
    align-items: center;
    gap: 8px;
}

.separator {
    color: var(--border-color, #3e3e42);
}

/* ==================== ACE Editor ==================== */
.ace-editor-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#aceEditor {
    width: 100%;
    height: 100%;
    min-height: 500px; /* ✨ ADD: Đảm bảo editor có chiều cao tối thiểu */
    font-size: 14px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
    position: relative; /* ✨ ADD: Đảm bảo positioning đúng */
}

.ace-editor-wrapper {
    flex: 1;
    position: relative;
    overflow: hidden;
    min-height: 500px; /* ✨ ADD: Đảm bảo wrapper có chiều cao */
}

.ace_highlight-marker {
    position: absolute;
  background-color: rgba(255, 255, 0, 0.3);
    z-index: 20;
}

.ace_warning-marker {
    position: absolute;
    background-color: rgba(241, 216, 23, 0.3);
    border-bottom: 2px solid #F1D817;
    z-index: 20;
}

/* ==================== ACE Editor Breakpoints ==================== */
.ace_breakpoint {
    position: absolute;
left: 0;
    right: 0;
    background-color: rgba(255, 0, 0, 0.15);
 border-top: 1px solid rgba(255, 0, 0, 0.4);
    border-bottom: 1px solid rgba(255, 0, 0, 0.4);
}

.ace_gutter-cell.ace_breakpoint {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='6' fill='%23e51400'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 2px center;
}

.ace_gutter-cell.ace_breakpoint.ace_disabled {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='6' fill='%23888' opacity='0.5'/%3E%3C/svg%3E");
}

/* ==================== ACE Editor Code Folding ==================== */
.ace_fold-widget {
  cursor: pointer;
    color: var(--icon-color, #858585);
}

.ace_fold-widget:hover {
    color: var(--primary-color, #007acc);
}

.ace_fold-widget.ace_closed {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='M5 5 L11 8 L5 11 Z' fill='%23858585'/%3E%3C/svg%3E");
}

.ace_fold-widget.ace_open {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16'%3E%3Cpath d='M5 5 L11 5 L8 11 Z' fill='%23858585'/%3E%3C/svg%3E");
}

/* ==================== ACE Editor Search Box ==================== */
.ace_search {
    background-color: var(--bg-secondary, #252526);
border: 1px solid var(--border-color, #3e3e42);
    border-top: 0 none;
    max-width: 325px;
    overflow: hidden;
    margin: 0;
    padding: 4px;
    padding-right: 6px;
    padding-bottom: 0;
    position: absolute;
  top: 0px;
  z-index: 99;
    white-space: normal;
}

.ace_search.left {
    border-left: 0 none;
    border-radius: 0px 0px 5px 0px;
left: 0;
}

.ace_search.right {
    border-radius: 0px 0px 0px 5px;
    border-right: 0 none;
    right: 0;
}

/* ==================== Debug Mode Styles ==================== */
.debug-mode .ace_gutter {
    background-color: rgba(255, 200, 0, 0.1);
}

.debug-mode .ace_gutter-cell {
    cursor: pointer;
}

.debug-mode .ace_gutter-cell:hover {
    background-color: rgba(255, 200, 0, 0.2);
}

/* ==================== Current Line Highlight ==================== */
.ace_marker-layer .ace_active-line {
    background: rgba(0, 122, 204, 0.1);
}

.ace_dark .ace_marker-layer .ace_active-line {
    background: rgba(255, 255, 255, 0.05);
}

/* ==================== Selection Highlight ==================== */
.ace_marker-layer .ace_selection {
 background: var(--primary-color, #007acc);
    opacity: 0.3;
}

/* ==================== Status Bar ==================== */
.editor-status-bar {
 display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 15px;
    background: var(--bg-status, #007acc);
    color: #fff;
    font-size: 0.8rem;
    border-top: 1px solid var(--border-color, #3e3e42);
}

.status-left,
.status-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ==================== Output Panel ==================== */
.editor-output {
    width: 400px;
    background: var(--bg-secondary, #252526);
border-left: 1px solid var(--border-color, #3e3e42);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, width 0.3s ease;
}

.editor-output.hide {
    transform: translateX(100%);
    width: 0;
}

.output-tabs {
    display: flex;
    align-items: center;
    padding: 8px 15px;
    background: var(--bg-tertiary, #2d2d30);
    border-bottom: 1px solid var(--border-color, #3e3e42);
  gap: 5px;
}

.tab {
    padding: 8px 16px;
    background: transparent;
    border: none;
    color: var(--text-secondary, #858585);
    cursor: pointer;
  transition: all 0.3s ease;
    font-size: 0.85rem;
    border-radius: 4px;
}

.tab:hover {
    background: var(--bg-hover, #2a2d2e);
    color: var(--text-primary, #d4d4d4);
}

.tab.active {
    background: var(--primary-color, #007acc);
    color: #fff;
}

.btn-clear-output {
    margin-left: auto;
}

.output-content {
    flex: 1;
overflow-y: auto;
    padding: 15px;
}

.output-text {
    margin: 0;
    padding: 0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
    font-size: 0.85rem;
  color: var(--text-primary, #d4d4d4);
    white-space: pre-wrap;
  word-wrap: break-word;
}

/* Console Output */
.console-output {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
  font-size: 0.85rem;
}

.console-line {
    display: flex;
    align-items: center;
  gap: 10px;
    padding: 6px 0;
  border-bottom: 1px solid var(--border-color, #3e3e42);
}

.console-line.info {
    color: var(--info-color, #4ec9b0);
}

.console-line.warning {
    color: var(--warning-color, #dcdcaa);
}

.console-line.error {
    color: var(--danger-color, #f48771);
}

.timestamp {
    color: var(--text-muted, #858585);
    font-size: 0.75rem;
}

/* Errors List */
.errors-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.error-item {
    display: flex;
 align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: var(--bg-error, rgba(244, 135, 113, 0.1));
    border-left: 3px solid var(--danger-color, #f48771);
    border-radius: 4px;
}

.error-item i {
    color: var(--danger-color, #f48771);
    font-size: 1.1rem;
    margin-top: 2px;
}

.error-details {
    flex: 1;
}

.error-message {
    font-size: 0.9rem;
    color: var(--text-primary, #d4d4d4);
    margin-bottom: 4px;
}

.error-location {
    font-size: 0.75rem;
    color: var(--text-muted, #858585);
}

.no-errors {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
 padding: 40px;
    color: var(--success-color, #89d185);
    text-align: center;
}

.no-errors i {
    font-size: 3rem;
  margin-bottom: 15px;
}

.no-errors p {
    margin: 0;
 font-size: 1rem;
}

.btn-toggle-output {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    padding: 10px 12px;
    background: var(--bg-secondary, #252526);
    border: 1px solid var(--border-color, #3e3e42);
    border-radius: 4px;
    color: var(--text-primary, #d4d4d4);
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
}

.btn-toggle-output:hover {
  background: var(--primary-color, #007acc);
    border-color: var(--primary-color, #007acc);
  color: #fff;
}

/* ==================== Widgets ==================== */
.editor-calendar-widget,
.editor-tickets-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
 width: 350px;
background: var(--bg-secondary, #252526);
    border: 1px solid var(--border-color, #3e3e42);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

/* ==================== Confirm Dialog ==================== */
.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
 justify-content: center;
    z-index: 2000;
 animation: fadeIn 0.2s ease;
}

.confirm-dialog {
    background: var(--bg-secondary, #252526);
    border: 1px solid var(--border-color, #3e3e42);
 border-radius: 8px;
    width: 90%;
    max-width: 450px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease;
}

.confirm-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color, #3e3e42);
}

.confirm-header h4 {
margin: 0;
    font-size: 1.2rem;
    color: var(--text-primary, #d4d4d4);
}

.confirm-body {
  padding: 20px;
}

.confirm-body p {
 margin: 0;
    color: var(--text-secondary, #cccccc);
    line-height: 1.6;
}

.confirm-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color, #3e3e42);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
 cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--primary-color, #007acc);
color: #fff;
}

.btn-primary:hover {
    background: #005a9e;
}

.btn-secondary {
    background: var(--bg-tertiary, #2d2d30);
    color: var(--text-primary, #d4d4d4);
    border: 1px solid var(--border-color, #3e3e42);
}

.btn-secondary:hover {
    background: var(--bg-hover, #2a2d2e);
}

/* ==================== Animations ==================== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
opacity: 0;
    }
    to {
 transform: translateY(0);
        opacity: 1;
    }
}

/* ==================== Responsive Design ==================== */
@media (max-width: 1024px) {
    .editor-sidebar {
        position: absolute;
        top: 0;
        left: 0;
        height: 100%;
   z-index: 50;
    }
    
    .editor-output {
        position: absolute;
        top: 0;
      right: 0;
height: 100%;
        z-index: 50;
    }
}

@media (max-width: 768px) {
    .header-right {
        gap: 8px;
    }
    
    .btn-theme,
 .btn-settings {
        padding: 6px 12px;
        font-size: 0.8rem;
 }
  
    .editor-sidebar {
 width: 200px;
    }
    
    .editor-output {
        width: 100%;
    }
    
    .confirm-dialog {
        width: 95%;
      margin: 10px;
    }
}

@media (max-width: 480px) {
    .header-left h3 {
        font-size: 1rem;
    }

    .btn-toolbar {
     padding: 5px 10px;
        font-size: 0.75rem;
    }
    
    .editor-sidebar {
        width: 180px;
    }
    
    .editor-calendar-widget,
    .editor-tickets-widget {
        width: calc(100% - 20px);
 left: 10px;
        right: 10px;
 }
}

/* ==================== Dark/Light Theme Variables ==================== */
:root {
    /* Dark Theme (Default) */
    --bg-primary: #1e1e1e;
    --bg-secondary: #252526;
    --bg-tertiary: #2d2d30;
    --bg-sidebar: #252526;
    --bg-hover: #2a2d2e;
    --bg-active: #37373d;
    --bg-status: #007acc;
    --bg-error: rgba(244, 135, 113, 0.1);
    
    --text-primary: #d4d4d4;
    --text-secondary: #cccccc;
    --text-muted: #858585;
    
    --border-color: #3e3e42;
    --primary-color: #007acc;
    --danger-color: #f48771;
    --success-color: #89d185;
    --warning-color: #dcdcaa;
    --info-color: #4ec9b0;
    --icon-color: #858585;
}


/* ==================== Scrollbar Styling ==================== */
.editor-sidebar::-webkit-scrollbar,
.output-content::-webkit-scrollbar,
.file-list::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.editor-sidebar::-webkit-scrollbar-track,
.output-content::-webkit-scrollbar-track,
.file-list::-webkit-scrollbar-track {
    background: var(--bg-secondary, #252526);
}
.ace_paren {
    color: gray !important; 
}
.ace_support.ace_function {
    color: rgb(255, 0, 255) !important; /* Hồng sáng */
}

.ace_string {
    color: red !important;  
}


.editor-sidebar::-webkit-scrollbar-thumb,
.output-content::-webkit-scrollbar-thumb,
.file-list::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary, #424242);
    border-radius: 5px;
}

.editor-sidebar::-webkit-scrollbar-thumb:hover,
.output-content::-webkit-scrollbar-thumb:hover,
.file-list::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color, #007acc);
}
#editor {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace !important;
    font-size: 14px;
    line-height: 1.5;
}

.ace_editor * {
    font-family: inherit !important;
    letter-spacing: normal !important;
}
    