/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }
  
  html, body {
    width: 100%;
    height: 100%;
    overflow: hidden; /* Prevent body scrolling */
  }
  
  body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-main);
    color: var(--text-color);
    transition: background 0.4s, color 0.4s;
    display: flex;
    flex-direction: column;
    height: 100vh;
  }
  
  /* CSS Variables for Themes */
  body.dark {
    --bg-main: #1e1e1e;
    --bg-secondary: #2d2d2d;
    --bg-panel: #2d2d2d;
    --bg-header: #3c3c3c;
    --text-color: #e0e0e0;
    --shadow-color: rgba(0, 0, 0, 0.5);
    --accent-color: #bb86fc;
    --accent-hover: #3700b3;
    --input-bg: #3c3c3c;
  }
  
  body.light {
    --bg-main: #f5f5f5;
    --bg-secondary: #ffffff;
    --bg-panel: #ffffff;
    --bg-header: #e0e0e0;
    --text-color: #333333;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --accent-color: #6200ee;
    --accent-hover: #3700b3;
    --input-bg: #ffffff;
  }
  
  body.solarized {
    --bg-main: #fdf6e3;
    --bg-secondary: #eee8d5;
    --bg-panel: #eee8d5;
    --bg-header: #93a1a1;
    --text-color: #657b83;
    --shadow-color: rgba(0, 0, 0, 0.2);
    --accent-color: #b58900;
    --accent-hover: #cb4b16;
    --input-bg: #fdf6e3;
  }
  
  body.dracula {
    --bg-main: #282a36;
    --bg-secondary: #44475a;
    --bg-panel: #44475a;
    --bg-header: #6272a4;
    --text-color: #f8f8f2;
    --shadow-color: rgba(0, 0, 0, 0.5);
    --accent-color: #ff79c6;
    --accent-hover: #bd93f9;
    --input-bg: #6272a4;
  }
  
  body.monokai {
    --bg-main: #272822;
    --bg-secondary: #383830;
    --bg-panel: #3e3d32;
    --bg-header: #75715e;
    --text-color: #f8f8f2;
    --shadow-color: rgba(0, 0, 0, 0.5);
    --accent-color: #f92672;
    --accent-hover: #e91e63;
    --input-bg: #49483e;
  }
  
  body.github-dark {
    --bg-main: #0d1117;
    --bg-secondary: #161b22;
    --bg-panel: #161b22;
    --bg-header: #21262d;
    --text-color: #c9d1d9;
    --shadow-color: rgba(255, 255, 255, 0.1);
    --accent-color: #58a6ff;
    --accent-hover: #1f6feb;
    --input-bg: #161b22;
  }
  
  /* Remove Outline for All Interactive Elements */
  button, select, input, textarea {
    outline: none;
  }
  
  button:focus, select:focus, input:focus, textarea:focus {
    box-shadow: 0 0 0 2px var(--accent-color);
  }
  
  /* FPS Counter Styles */
  .fps-counter {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg-panel);
    color: var(--text-color);
    padding: 8px 12px;
    border-radius: 4px;
    box-shadow: 0 2px 4px var(--shadow-color);
    font-size: 0.9rem;
    z-index: 1000;
    transition: background 0.4s, color 0.4s;
  }
  
  .fps-counter.hidden {
    display: none;
  }
  
  /* Header Styles */
  header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: var(--bg-secondary);
    box-shadow: 0 2px 5px var(--shadow-color);
    transition: background 0.4s;
  }
  
  .header-content {
    display: flex;
    flex-direction: column;
  }
  
  .title-group h1 {
    color: var(--text-color);
    font-size: 2rem;
    margin-bottom: 5px;
  }
  
  .title-group h2 {
    color: var(--text-color);
    font-size: 1rem;
    font-weight: normal;
  }
  
  /* Header Actions */
  .header-actions button {
    background: var(--bg-panel);
    color: var(--text-color);
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.3s, color 0.3s;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 2px 4px var(--shadow-color);
  }
  
  .header-actions button:hover {
    background: var(--accent-hover);
    color: #ffffff;
  }
  
  .header-actions button:focus {
    box-shadow: 0 0 0 2px var(--accent-color);
  }
  
  /* Controls Styles */
  .controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
    padding: 10px 20px;
    gap: 10px;
    box-shadow: 0 2px 5px var(--shadow-color);
    transition: background 0.4s;
  }
  
  .button-group {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  
  .controls button {
    background: var(--bg-panel);
    color: var(--text-color);
    border: none;
    border-radius: 4px;
    padding: 8px 14px;
    cursor: pointer;
    transition: background 0.3s, color 0.3s;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 2px 4px var(--shadow-color);
  }
  
  .controls button:hover {
    background: var(--accent-hover);
    color: #ffffff;
  }
  
  .controls button:focus {
    box-shadow: 0 0 0 2px var(--accent-color);
  }
  
  .controls button.secondary {
    background: #af3434;
  }
  
  .controls button.secondary:hover {
    background: #942f2f;
  }
  
  /* Dropdown Styles */
  .dropdown {
    position: relative;
    display: inline-block;
  }
  
  .dropbtn {
    background: var(--bg-panel);
    color: var(--text-color);
    padding: 8px 14px;
    font-size: 0.9rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 2px 4px var(--shadow-color);
    transition: background 0.3s, color 0.3s;
  }
  
  .dropbtn:hover {
    background: var(--accent-hover);
    color: #ffffff;
  }
  
  .dropdown-content {
    display: none;
    position: absolute;
    background: var(--bg-panel);
    min-width: 160px;
    box-shadow: 0px 8px 16px var(--shadow-color);
    z-index: 1;
    border-radius: 4px;
  }
  
  .dropdown-content button {
    width: 100%;
    background: none;
    color: var(--text-color);
    padding: 12px 16px;
    text-align: left;
    border: none;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
  }
  
  .dropdown-content button:hover {
    background: var(--accent-hover);
    color: #ffffff;
  }
  
  .dropdown:hover .dropdown-content {
    display: block;
  }
  
  /* Search Bar Styles */
  .search-group {
    position: relative;
    display: flex;
    align-items: center;
  }
  
  .search-group input {
    padding: 8px 30px 8px 10px;
    border: 1px solid #444444;
    border-radius: 4px;
    background: var(--input-bg);
    color: var(--text-color);
    transition: background 0.4s, color 0.4s;
  }
  
  .search-group i {
    position: absolute;
    right: 10px;
    color: #888888;
  }
  
  /* Sidebar Styles */
  .sidebar {
    width: 200px;
    background: var(--bg-secondary);
    box-shadow: 2px 0 5px var(--shadow-color);
    transition: background 0.4s, box-shadow 0.4s;
    display: flex;
    flex-direction: column;
  }
  
  .sidebar-header {
    padding: 15px;
    background: var(--bg-header);
    text-align: center;
    font-size: 1.1rem;
    color: var(--text-color);
  }
  
  #sidebar-files-list {
    list-style-type: none;
    padding: 10px;
    overflow-y: auto;
    flex: 1;
  }
  
  #sidebar-files-list li {
    padding: 8px 12px;
    margin-bottom: 5px;
    background: var(--bg-panel);
    color: var(--text-color);
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.3s, color 0.3s;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  
  #sidebar-files-list li:hover {
    background: var(--accent-hover);
    color: #ffffff;
  }
  
  #sidebar-files-list li.active {
    background: var(--accent-color);
    color: #ffffff;
  }
  
  #sidebar-files-list li .delete-sidebar-file {
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 0.9rem;
  }
  
  #sidebar-files-list li .delete-sidebar-file:hover {
    color: #ff4d4d;
  }
  
  /* Editor Preview Container */
  .editor-preview-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: 100%;
  }
  
  /* Tabs Styles */
  .tabs {
    background: var(--bg-secondary);
    border-bottom: 1px solid #444444;
    overflow-x: auto;
  }
  
  .tabs ul {
    list-style-type: none;
    display: flex;
    flex-wrap: nowrap;
  }
  
  .tabs ul li {
    padding: 10px 20px;
    cursor: pointer;
    background: var(--bg-secondary);
    color: var(--text-color);
    /* Removed border-right for cleaner look */
    transition: background 0.3s, color 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    /* Removed outline and borders */
  }
  
  .tabs ul li.active {
    background: var(--bg-panel);
    color: var(--accent-color);
  }
  
  .tabs ul li:hover {
    background: var(--accent-hover);
    color: #ffffff;
  }
  
  .tabs ul li .delete-tab {
    background: transparent;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    font-size: 0.8rem;
    display: none;
  }
  
  .tabs ul li:hover .delete-tab {
    display: inline;
  }
  
  .tabs ul li .delete-tab:hover {
    color: #ff4d4d;
  }
  
  /* Modal Styles */
  .modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1001;
    justify-content: center;
    align-items: center;
  }
  
  .modal-content {
    background: var(--bg-panel);
    color: var(--text-color);
    padding: 20px 30px;
    border-radius: 8px;
    box-shadow: 0 4px 20px var(--shadow-color);
    width: 90%;
    max-width: 500px;
    position: relative;
    transition: background 0.4s, color 0.4s;
  }
  
  .modal-content h2 {
    margin-bottom: 20px;
    text-align: center;
  }
  
  .form-group {
    margin-bottom: 20px;
  }
  
  .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
  }
  
  .form-group select,
  .form-group input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #444444;
    border-radius: 4px;
    background: var(--input-bg);
    color: var(--text-color);
    transition: background 0.4s, color 0.4s;
  }
  
  .form-group input[type="range"] {
    width: 100%;
  }
  
  #font-size-value {
    display: block;
    margin-top: 5px;
    text-align: right;
    font-size: 0.9rem;
    color: var(--text-color);
  }
  
  .close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 1.5rem;
    color: #ffffff;
    cursor: pointer;
    transition: color 0.3s;
  }
  
  body.light .close,
  body.solarized .close,
  body.dracula .close,
  body.monokai .close,
  body.github-dark .close {
    color: #333333;
  }
  
  .shortcut-info {
    font-size: 0.9rem;
    color: #888888;
  }
  
  /* Keyboard Shortcuts Modal */
  .shortcuts-list {
    list-style-type: none;
    padding-left: 0;
  }
  
  .shortcuts-list li {
    margin-bottom: 10px;
  }
  
  /* Main Container Styles */
  .main-container {
    display: flex;
    flex: 1;
    height: calc(100vh - 160px); /* Adjusted for header and controls height */
    transition: background 0.4s;
    position: relative; /* For positioning the instruction text */
  }
  
  /* Sidebar Styles Already Defined Above */
  
  /* Editor Preview Container Styles */
  .editor-preview-container {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: 100%;
  }
  
  /* Editor Container Styles */
  .editor-container {
    display: flex;
    flex-direction: column;
    flex: 2;
    overflow-y: auto;
    background: var(--bg-panel);
    padding: 10px;
    transition: background 0.4s;
  }
  
  .editor-panel {
    display: none;
    flex-direction: column;
    margin: 10px 0;
    background: var(--bg-panel);
    border-radius: 4px;
    box-shadow: 0 2px 5px var(--shadow-color);
    overflow: hidden;
    transition: background 0.4s;
  }
  
  .editor-panel.active {
    display: flex;
  }
  
  .editor-panel .panel-header {
    background: var(--bg-header);
    padding: 10px;
    font-size: 0.95rem;
    color: var(--text-color);
    border-bottom: 1px solid #444444;
    transition: background 0.4s;
  }
  
  /* Enhanced CodeMirror Styles */
  .CodeMirror {
    height: auto;
    min-height: 300px;
    font-family: "Source Code Pro", monospace;
    font-size: 14px; /* Default font size */
    border: none; /* Remove default border */
  }
  
  .CodeMirror-scroll {
    overflow: auto;
  }
  
  .CodeMirror-linenumbers {
    padding: 0 10px 0 5px;
    color: #888888;
    background-color: transparent; /* Remove background */
    border-right: none; /* Remove border */
  }
  
  .CodeMirror-cursor {
    border-left: 1px solid var(--accent-color) !important;
  }
  
  .CodeMirror-gutters {
    background: transparent; /* Remove gutter background */
    border-right: none; /* Remove gutter border */
  }
  
  .CodeMirror-guttermarker {
    color: #999999;
  }
  
  .CodeMirror-line {
    padding: 0 5px;
  }
  
  /* Preview Container Styles */
  .preview-container {
    flex: 1.5; /* Increased from 1 to 1.5 to make it bigger */
    display: flex;
    flex-direction: column;
    margin: 10px;
    background: var(--bg-panel);
    border-radius: 4px;
    box-shadow: 0 2px 5px var(--shadow-color);
    overflow: hidden;
    transition: background 0.4s;
    height: 100%;
  }
  
  .preview-header {
    background: var(--bg-header);
    padding: 10px;
    font-size: 0.95rem;
    color: var(--text-color);
    border-bottom: 1px solid #444444;
    transition: background 0.4s;
  }
  
  /* Dynamic Preview Iframes */
  .preview-iframe {
    flex: 1;
    width: 100%;
    border: none;
    background: #ffffff;
    height: 100%;
    overflow: auto;
    transition: background 0.4s;
    border-radius: 0 0 4px 4px; /* Rounded corners at bottom */
    box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
  }
  
  /* Scrollbar Styling for Editor and Preview */
  .editor-container,
  .preview-container,
  #sidebar-files-list {
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) var(--bg-panel);
  }
  
  .editor-container::-webkit-scrollbar,
  .preview-container::-webkit-scrollbar,
  #sidebar-files-list::-webkit-scrollbar {
    width: 12px;
  }
  
  .editor-container::-webkit-scrollbar-track,
  .preview-container::-webkit-scrollbar-track,
  #sidebar-files-list::-webkit-scrollbar-track {
    background: var(--bg-panel);
    border-radius: 6px;
  }
  
  .editor-container::-webkit-scrollbar-thumb,
  .preview-container::-webkit-scrollbar-thumb,
  #sidebar-files-list::-webkit-scrollbar-thumb {
    background-color: var(--accent-color);
    border-radius: 6px;
    border: 3px solid var(--bg-panel);
  }
  
  /* Responsive Enhancements */
  @media (max-width: 1200px) {
    .main-container {
      flex-direction: row;
    }
  
    .preview-container {
      flex: 1.5;
    }
  }
  
  @media (max-width: 900px) {
    .main-container {
      flex-direction: column;
      height: auto;
    }
    
    .sidebar {
      width: 100%;
      height: 150px;
      flex-shrink: 0;
    }
  
    .sidebar-header {
      text-align: left;
      padding: 10px 15px;
    }
  
    #sidebar-files-list {
      flex: 1;
      padding: 10px 15px;
      display: flex;
      flex-direction: column;
      overflow-y: auto;
    }
  
    #sidebar-files-list li {
      justify-content: space-between;
    }
  
    .editor-preview-container {
      flex: none;
    }
  
    .preview-container {
      height: 50vh;
      width: 100%;
    }
  }
  
  /* Modals Transition */
  .modal-content {
    animation: fadeIn 0.3s ease-in-out;
  }
  
  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
  }
  
  /* CodeMirror Customizations */
  .CodeMirror {
    font-family: "Source Code Pro", monospace;
    font-size: 14px;
  }
  
  body.light .CodeMirror {
    background: #ffffff;
    color: #333333;
  }
  
  body.dark .CodeMirror {
    background: #2c2c2c;
    color: #e0e0e0;
  }
  
  body.solarized .CodeMirror {
    background: #fdf6e3;
    color: #657b83;
  }
  
  body.dracula .CodeMirror {
    background: #282a36;
    color: #f8f8f2;
  }
  
  body.monokai .CodeMirror {
    background: #49483e;
    color: #f8f8f2;
  }
  
  body.github-dark .CodeMirror {
    background: #0d1117;
    color: #c9d1d9;
  }
  
  /* Notification Container Styles */
  #notification-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1002; /* Above other elements */
  }
  
  /* Individual Notification Styles */
  .notification {
    background-color: rgba(0, 0, 0, 0.8);
    color: #ffffff;
    padding: 12px 20px;
    margin-top: 10px;
    border-radius: 4px;
    min-width: 200px;
    max-width: 300px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    opacity: 0;
    transform: translateX(100%);
    animation: slideIn 0.5s forwards, fadeOut 0.5s 2.5s forwards;
  }
  
  /* Slide In Animation */
  @keyframes slideIn {
    to {
      opacity: 1;
      transform: translateX(0);
    }
  }
  
  /* Fade Out Animation */
  @keyframes fadeOut {
    to {
      opacity: 0;
      transform: translateX(100%);
    }
  }
  
  /* Success Notification */
  .notification.success {
    background-color: #4caf50; /* Green */
  }
  
  /* Error Notification */
  .notification.error {
    background-color: #f44336; /* Red */
  }
  
  /* Info Notification */
  .notification.info {
    background-color: #2196f3; /* Blue */
  }
  
  /* Sidebar and Preview Integration */
  .sidebar {
    transition: width 0.3s;
  }
  
  .sidebar:hover {
    width: 220px;
  }
  
  .sidebar-header h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
  }
  
  #sidebar-files-list li {
    transition: background 0.3s, color 0.3s;
  }
  
  /* Additional Enhancements */
  button, .dropbtn {
    border: none;
    cursor: pointer;
  }
  
  button i, .dropbtn i {
    margin-right: 5px;
  }
  
  input[type="text"], select, textarea {
    border: 1px solid #444444;
    border-radius: 4px;
  }
  
  input[type="text"]:focus, select:focus, textarea:focus {
    border-color: var(--accent-color);
  }
  
  .shortcut-info {
    font-size: 0.9rem;
    color: #888888;
  }
  