:root {
  --header-height: 60px;
  --primary-color: #0e639c;
  --primary-hover: #1177bb;
  --dark-bg: #1e1e1e;
  --dark-panel: #252526;
  --dark-border: #333;
  --dark-text: #d4d4d4;
  --light-bg: #f5f5f5;
  --light-panel: #ffffff;
  --light-border: #ccc;
  --light-text: #333;
  --footer-bg: #252526;
  --footer-text: #858585;
  --ad-width: 300px;
}

/* Base Styles */
body {
  font-family: 'Fira Code', monospace;
  margin: 0;
  padding: 0;
  background-color: var(--dark-bg);
  color: var(--dark-text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header Styles */
.sticky-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--primary-color);
  color: white;
  height: var(--header-height);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

.logo {
  font-weight: bold;
  font-size: 1.2rem;
}

.mobile-logo {
  display: none;
}

.desktop-nav ul {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
}

.desktop-nav li {
  margin-left: 20px;
}

.desktop-nav a {
  color: white;
  text-decoration: none;
  font-weight: 500;
  transition: opacity 0.2s;
}

.desktop-nav a:hover {
  opacity: 0.8;
}

.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
}

.mobile-nav {
  display: none;
  background-color: var(--primary-hover);
  padding: 10px 0;
}

.mobile-nav.active {
  display: block;
}

.mobile-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mobile-nav li {
  padding: 10px 20px;
}

.mobile-nav a {
  color: white;
  text-decoration: none;
  display: block;
}

/* Main Content Layout */
.main-container {
  flex: 1;
  padding: 0;
  max-width: 100%;
}

.mobile-top-ad {
  display: none;
  padding: 10px;
  background-color: var(--dark-panel);
}

.editor-output-container {
  display: flex;
  flex-direction: row;
  gap: 0;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
  height: calc(100vh - var(--header-height));
}

/* Editor Section (45%) */
.editor-section {
  flex: 0 0 45%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Output Section (35%) */
.output-section {
  flex: 0 0 35%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  border-left: 1px solid var(--dark-border);
  border-right: 1px solid var(--dark-border);
}

/* Ad Section (20% but fixed 170px) */
.ad-section {
  flex: 0 0 var(--ad-width);
  min-width: 0;
  padding: 10px;
  background-color: var(--dark-panel);
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ad-slot {
  height: 250px;
  width: 300px;
  transform: scale(0.85);
  transform-origin: top left;
}

.ad-placeholder {
  background-color: #333;
  color: #858585;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  height: 100%;
  width: 100%;
  font-size: 14px;
}

.mobile-top-ad .ad-placeholder {
  height: 50px;
  width: 100%;
}

/* Editor Components */
.editor-container {
  background: var(--dark-bg);
  overflow: hidden;
  flex-grow: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.panel-header {
  background: var(--dark-panel);
  color: var(--dark-text);
  padding: 8px 15px;
  font-weight: bold;
  border-bottom: 1px solid var(--dark-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.right-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.editor-wrapper {
  position: relative;
  flex-grow: 1;
  overflow: hidden;
}

#code-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  font-family: 'Fira Code', monospace;
  font-size: 14px;
  line-height: 1.6;
  padding: 15px 15px 15px 60px;
  border: none;
  resize: none;
  background: transparent;
  color: transparent;
  caret-color: var(--dark-text);
  tab-size: 4;
  outline: none;
  white-space: pre;
  overflow: auto;
  z-index: 2;
  box-sizing: border-box;
}

#code-highlight {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 15px 15px 15px 60px;
  font-family: 'Fira Code', monospace;
  font-size: 14px;
  line-height: 1.5;
  background: var(--dark-bg);
  color: var(--dark-text);
  overflow: auto;
  pointer-events: none;
  z-index: 1;
  white-space: pre;
  box-sizing: border-box;
}

.output-container {
  background: var(--dark-bg);
  overflow: hidden;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

#output {
  flex-grow: 1;
  padding: 15px;
  font-family: 'Fira Code', monospace;
  font-size: 14px;
  white-space: pre-wrap;
  background: var(--dark-bg);
  color: var(--dark-text);
  overflow-y: auto;
  box-sizing: border-box;
}

.controls {
  display: flex;
  gap: 10px;
  padding: 15px;
  flex-wrap: wrap;
  background: var(--dark-panel);
  border-top: 1px solid var(--dark-border);
}

button {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'Fira Code', monospace;
  font-size: 14px;
  transition: background 0.2s;
}

button:hover {
  background: var(--primary-hover);
}

#clear-btn {
  background: #5a5a5a;
}

#clear-btn:hover {
  background: #6a6a6a;
}

.loading {
  display: none;
  color: #569cd6;
  font-style: italic;
  margin-top: 10px;
}

.error-line {
  background-color: rgba(255, 0, 0, 0.2);
}

.status {
  color: #569cd6;
  font-size: 12px;
}

.line-numbers {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  padding: 15px 5px;
  text-align: right;
  color: #858585;
  background-color: var(--dark-bg);
  border-right: 1px solid var(--dark-border);
  font-family: 'Fira Code', monospace;
  font-size: 14px;
  line-height: 1.5;
  z-index: 3;
  overflow: hidden;
  width: 50px;
  box-sizing: border-box;
  pointer-events: none;
}

.theme-selector {
  background-color: var(--dark-panel);
  color: var(--dark-text);
  border: 1px solid var(--dark-border);
  padding: 4px 8px;
  border-radius: 4px;
}

.font-size-control {
  display: flex;
  align-items: center;
  gap: 8px;
}

.font-size-control button {
  padding: 2px 8px;
  font-size: 12px;
}

.filename {
  margin-right: 10px;
}

#examples-dropdown {
  background-color: var(--dark-panel);
  color: var(--dark-text);
  border: 1px solid var(--dark-border);
  padding: 4px 8px;
  border-radius: 4px;
}

#copy-output-btn {
  padding: 4px 8px;
  font-size: 12px;
}

/* Content Section */
.content-section {
  max-width: 1400px;
  margin: 40px auto;
  padding: 0 20px;
  padding: 0 20px;
  color: var(--dark-text);
}

.content-section h2 {
  color: #569cd6;
  margin-bottom: 20px;
  font-size: 1.8rem;
}

.content-section h3 {
  color: #569cd6;
  margin: 25px 0 15px;
  font-size: 1.4rem;
}

.content-section p {
  line-height: 1.6;
  margin-bottom: 15px;
}

.content-section ul, 
.content-section ol {
  padding-left: 20px;
  margin-bottom: 20px;
  line-height: 1.6;
}

.content-section li {
  margin-bottom: 8px;
}

.tips-section {
  margin-top: 40px;
}

.tips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.tip-card {
  background: var(--dark-panel);
  padding: 20px;
  border-radius: 8px;
  transition: transform 0.2s;
}

.tip-card:hover {
  transform: translateY(-5px);
}

.tip-card i {
  font-size: 2rem;
  color: #569cd6;
  margin-bottom: 15px;
}

.tip-card h4 {
  margin: 10px 0;
  color: #d4d4d4;
}

.tip-card p {
  margin: 0;
  font-size: 0.95rem;
}

/* Footer Styles */
.site-footer {
  background-color: var(--footer-bg);
  color: var(--footer-text);
  padding: 40px 0 20px;
}

.footer-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

.footer-content {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  margin-bottom: 20px;
}

.footer-section {
  flex: 1;
  min-width: 250px;
  margin-bottom: 20px;
  padding: 0 15px;
}

.footer-section h3 {
  color: white;
  margin-bottom: 15px;
  font-size: 1.1rem;
}

.footer-section p {
  margin: 0 0 10px;
  line-height: 1.6;
}

.footer-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-section li {
  margin-bottom: 8px;
}

.footer-section a {
  color: var(--footer-text);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-section a:hover {
  color: white;
}

.social-icons {
  display: flex;
  gap: 15px;
}

.social-icons a {
  color: var(--footer-text);
  font-size: 1.2rem;
  transition: color 0.2s;
}

.social-icons a:hover {
  color: white;
}

.footer-bottom {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid #333;
  font-size: 0.9rem;
}

/* Light Theme */
body.light-theme {
  background-color: var(--light-bg);
  color: var(--light-text);
}

body.light-theme .editor-container,
body.light-theme .output-container {
  background: var(--light-panel);
}

body.light-theme .panel-header {
  background: #e5e5e5;
  color: var(--light-text);
  border-bottom: 1px solid var(--light-border);
}

body.light-theme #code-highlight,
body.light-theme #output {
  background: var(--light-panel);
  color: var(--light-text);
}

body.light-theme .line-numbers {
  background-color: #f0f0f0;
  color: #999;
  border-right: 1px solid var(--light-border);
}

body.light-theme .mobile-top-ad,
body.light-theme .ad-section {
  background-color: #f0f0f0;
}

body.light-theme .ad-placeholder {
  background-color: #e0e0e0;
  color: #666;
}

body.light-theme .content-section {
  color: var(--light-text);
}

body.light-theme .tip-card {
  background: #f0f0f0;
}

body.light-theme .tip-card h4 {
  color: #333;
}

/* Responsive Styles */
@media (max-width: 1200px) {
  .editor-section {
    flex: 0 0 50%;
  }
  .output-section {
    flex: 0 0 calc(50% - var(--ad-width));
  }
}

@media (max-width: 992px) {
  .editor-output-container {
    flex-direction: column;
    height: auto;
  }
  
  .mobile-top-ad {
    display: block;
  }
  
  .editor-section, 
  .output-section {
    flex: none;
    width: 100%;
    border-right: none;
  }
  
  .editor-wrapper {
    height: 300px !important;
  }
  
  #code-input, 
  #code-highlight {
    height: 300px !important;
  }
  
  .output-container {
    height: 250px !important;
  }
  
  .ad-section {
    display: none;
  }
  
  .controls {
    padding: 15px !important;
    border-top: none;
    border-bottom: 1px solid var(--dark-border);
  }
}

@media (max-width: 768px) {
  .desktop-logo {
    display: none;
  }
  
  .mobile-logo {
    display: inline;
  }
  
  .desktop-nav {
    display: none;
  }
  
  .mobile-menu-toggle {
    display: block;
  }
  
  .controls {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .footer-section {
    flex: 100%;
  }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--dark-panel);
}

::-webkit-scrollbar-thumb {
  background: #454545;
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: #555;
}

body.light-theme ::-webkit-scrollbar-track {
  background: #e5e5e5;
}

body.light-theme ::-webkit-scrollbar-thumb {
  background: #ccc;
}

body.light-theme ::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}