/* ===================================
   PAGES CONFIG
   =================================== */
/* ===================================
   BASE.CSS
   =================================== */

/* ===================================
   BASE.CSS - Reset, Body, Typography
   =================================== */

/* CSS Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

*::before,
*::after {
  box-sizing: inherit;
}

/* Base Elements */
html {
  font-size: 16px;
  line-height: 1.6;
  height: 100%;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
  --z-toast: 1080;
}

body {
  font-family: var(--font-family-base, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-semibold, 600);
  line-height: 1.2;
  margin-bottom: 0.5em;
  color: var(--text);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p {
  margin-bottom: 1rem;
  color: var(--text-muted);
}

a {
  color: var(--accent-primary);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
}

/* Form Elements */
input, textarea, select, button {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  border-radius: 0;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  border-radius: 0;
}

/* Remove default browser styling - Flat Design */
* {
  border-radius: 0 !important;
}

/* Remove all transitions for better performance */
* {
  transition: none !important;
  animation: none !important;
}

img {
  max-width: 100%;
  height: auto;
}

/* Focus Styles */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}
/* Screen-reader only content */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}


/* ===================================
   LAYOUT.CSS
   =================================== */

/* ===================================
   LAYOUT.CSS - Header, Footer, Grid, Section, Utilities
   =================================== */

/* ===================================
   CONTAINER
   =================================== */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0;
}

/* Footer container should have no padding and correct max-width */
.footer .container {
  padding: 0;
  max-width: 1200px;
}

.container-fluid {
  width: 100%;
  padding: 0 var(--space-5);
}

/* ===================================
   GRID SYSTEM
   =================================== */
.grid {
  display: grid;
  gap: var(--space-4);
}

.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid-cols-5 { grid-template-columns: repeat(5, 1fr); }
.grid-cols-6 { grid-template-columns: repeat(6, 1fr); }
.grid-cols-12 { grid-template-columns: repeat(12, 1fr); }

.grid-auto { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }

/* ===================================
   FLEXBOX LAYOUT
   =================================== */
.flex { display: flex; }

.flex-row { flex-direction: row; }
.flex-row-reverse { flex-direction: row-reverse; }
.flex-col { flex-direction: column; }
.flex-col-reverse { flex-direction: column-reverse; }

.flex-wrap { flex-wrap: wrap; }
.flex-nowrap { flex-wrap: nowrap; }

.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.items-center { align-items: center; }
.items-stretch { align-items: stretch; }

.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

.flex-1 { flex: 1 1 0%; }
.flex-none { flex: none; }

.flex-grow { flex-grow: 1; }
.flex-shrink-0 { flex-shrink: 0; }

/* ===================================
   SPACING UTILITIES
   =================================== */
.mx-auto { margin-left: auto; margin-right: auto; }
.my-auto { margin-top: auto; margin-bottom: auto; }

/* ===================================
   SIZING UTILITIES
   =================================== */
.w-full { width: 100%; }
.w-auto { width: auto; }

.h-full { height: 100%; }
.h-auto { height: auto; }
.h-screen { height: 100vh; }

.max-w-full { max-width: 100%; }
.max-w-none { max-width: none; }

/* ===================================
   DISPLAY UTILITIES
   =================================== */
.block { display: block; }
.inline-block { display: inline-block; }
.hidden { display: none; }

/* ===================================
   POSITION UTILITIES
   =================================== */
.static { position: static; }
.fixed { position: fixed; }
.absolute { position: absolute; }
.relative { position: relative; }

/* ===================================
   TEXT UTILITIES
   =================================== */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.text-xs { font-size: 12px; }
.text-sm { font-size: 14px; }
.text-base { font-size: 16px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 20px; }
.text-2xl { font-size: 24px; }
.text-3xl { font-size: 30px; }
.text-4xl { font-size: 36px; }
.text-5xl { font-size: 48px; }
.text-6xl { font-size: 60px; }

.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.leading-tight { line-height: 1.25; }
.leading-normal { line-height: 1.5; }

/* ===================================
   BORDER UTILITIES
   =================================== */
.border { border: 1px solid var(--border); }
.border-0 { border: 0; }
.border-t { border-top: 1px solid var(--border); }
.border-r { border-right: 1px solid var(--border); }
.border-b { border-bottom: 1px solid var(--border); }
.border-l { border-left: 1px solid var(--border); }

.rounded-none { border-radius: 0; }
.rounded { border-radius: 4px; }
.rounded-md { border-radius: 6px; }
.rounded-lg { border-radius: 8px; }
.rounded-xl { border-radius: 12px; }
.rounded-full { border-radius: 9999px; }

/* ===================================
   OVERFLOW UTILITIES
   =================================== */
.overflow-auto { overflow: auto; }
.overflow-hidden { overflow: hidden; }
.overflow-visible { overflow: visible; }
.overflow-x-auto { overflow-x: auto; }
.overflow-x-hidden { overflow-x: hidden; }
.overflow-y-auto { overflow-y: auto; }
.overflow-y-hidden { overflow-y: hidden; }

/* ===================================
   OPACITY UTILITIES
   =================================== */
.opacity-0 { opacity: 0; }
.opacity-100 { opacity: 1; }

/* ===================================
   CURSOR UTILITIES
   =================================== */
.cursor-auto { cursor: auto; }
.cursor-default { cursor: default; }
.cursor-pointer { cursor: pointer; }
.cursor-text { cursor: text; }
.cursor-help { cursor: help; }

/* Remove padding to body since footer is no longer fixed */
body {
  padding-top: var(--header-height);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden; /* Prevent horizontal scroll */
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ===================================
   HEADER & FOOTER
   =================================== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-header);
  background: #ffffff;
  border-bottom: 2px solid #e5e7eb;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  max-width: 1200px;
  margin: 0 auto;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  border-radius: 8px;
  position: relative;
  transition: all 0.3s ease;
}

.nav-link:hover {
  color: var(--accent-primary);
  background: rgba(241, 140, 142, 0.1);
  transform: translateY(-1px);
}

.nav-link:active {
  transform: translateY(0);
}

.nav-link[aria-current="page"] {
  color: var(--accent-primary);
  background: rgba(241, 140, 142, 0.08);
}

.nav-link::after {
  display: none;
}

.nav-link:hover::after {
  display: none;
}

.nav-link:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* ===================================
   SECTION LAYOUTS
   =================================== */
.section {
  padding: var(--space-16) 0;
}

.section-sm {
  padding: var(--space-8) 0;
}

.section-lg {
  padding: var(--space-24) 0;
}

.section-xl {
  padding: var(--space-32) 0;
}

.section-header {
  text-align: center;
  margin-bottom: var(--space-12);
}

.section-title {
  font-size: var(--font-size-4xl);
  font-weight: var(--font-weight-bold);
  color: var(--text);
  margin: 0 0 var(--space-4);
}

.section-subtitle {
  font-size: var(--font-size-lg);
  color: var(--text-muted);
  margin: 0;
  max-width: 600px;
  margin: 0 auto;
}

.section-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-5);
}

/* ===================================
   MAIN LAYOUT
   =================================== */
main {
  flex: 1;
}


/* ===================================
   THEME.CSS
   =================================== */

/* ===================================
   THEME - RED & WHITE (with Dark Mode)
   =================================== */
:root {
  /* ===================================
     BASE PALETTE - Light Mode
     =================================== */
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --text: #000000;
  --text-muted: #666666;
  
  /* ===================================
     PRIMARY RED PALETTE
     =================================== */
  --red-50: #FFF5F3;
  --red-500: #F18C8E;  /* Primary brand color */
  --red-600: #DC2626;
  
  /* ===================================
     SEMANTIC COLORS
     =================================== */
  --primary: var(--red-500);
  --primary-hover: var(--red-600);
  --accent: var(--red-500);
  --accent-hover: var(--red-600);
  
  --success: #15803D;
  --success-hover: #166534;
  --warning: #D97706;
  --warning-hover: #B45309;
  --error: var(--red-600);
  --error-hover: var(--red-700);
  --info: #2563EB;
  --info-hover: #1D4ED8;
  
  /* ===================================
     NEUTRAL COLORS
     =================================== */
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  
  /* ===================================
     SYSTEM COLORS
     =================================== */
  --border: var(--gray-200);
  --divider: var(--gray-300);
  --hover: var(--red-50);
  --focus: var(--primary);
  --disabled: var(--gray-400);
  
  /* ===================================
     COMPONENT COLORS
     =================================== */
  --btn-primary-bg: var(--primary);
  --btn-secondary-bg: #F9FAFB;
  --btn-danger-bg: var(--error);
  
  --link: var(--primary);
  --link-hover: var(--primary-hover);
  
  /* ===================================
     OPACITY COLORS
     =================================== */
  --primary-opacity-10: rgba(232, 92, 65, 0.1);
  --primary-opacity-20: rgba(232, 92, 65, 0.2);
  --primary-opacity-30: rgba(232, 92, 65, 0.3);
  
  /* ===================================
     GRADIENTS
     =================================== */
  --gradient-primary: linear-gradient(135deg, var(--red-500) 0%, var(--red-600) 100%);
  --gradient-accent: linear-gradient(135deg, var(--red-500) 0%, #FF6B5B 100%);
  --gradient-success: linear-gradient(135deg, var(--success) 0%, var(--success-hover) 100%);
  --gradient-warning: linear-gradient(135deg, var(--warning) 0%, var(--warning-hover) 100%);
  --gradient-error: linear-gradient(135deg, var(--error) 0%, var(--error-hover) 100%);
  --gradient-surface: linear-gradient(135deg, var(--bg) 0%, var(--red-50) 100%);
  
  /* ===================================
     SHADOWS - Minimized for Performance
     =================================== */
  --shadow-xs: none;
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: none;
  --shadow-xl: none;
  --shadow-2xl: none;
  --shadow-inner: none;
  --shadow-colored: none;
  
  /* ===================================
     TYPOGRAPHY
     =================================== */
  --font-family-base: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  --font-family-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.875rem;
  
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  
  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;
  
  /* ===================================
     SPACING
     =================================== */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  
  /* Aliases for convenience */
  --space-xs: var(--space-1);
  --space-sm: var(--space-2);
  --space-md: var(--space-4);
  --space-lg: var(--space-6);
  --space-xl: var(--space-8);
  --space-2xl: var(--space-12);
  --space-3xl: var(--space-16);
  
  /* ===================================
     BORDER RADIUS
     =================================== */
  --radius-none: 0;
  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;
  --radius-full: 9999px;
  
  /* ===================================
     TRANSITIONS - Disabled for Performance
     =================================== */
  --transition-fast: 0s;
  --transition-normal: 0s;
  
  /* Status backgrounds */
  --success-bg: rgba(34, 197, 94, 0.1);
  --warning-bg: rgba(245, 158, 11, 0.1);
  --error-bg: rgba(239, 68, 68, 0.1);
  --info-bg: rgba(59, 130, 246, 0.1);
  
  /* ===================================
     Z-INDEX
     =================================== */
  --z-dropdown: 1020;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-header: 1030;
  --z-footer: 1010;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
  --z-toast: 1080;
  --z-maximum: 9999;
  
  /* ===================================
     EFFECTS
     =================================== */
  --focus-ring: 0 0 0 2px var(--primary-opacity-20);
  --header-height: 64px;
  --border-width: 1px;
  
  /* ===================================
     LEGACY MAPPINGS (for backward compatibility)
     =================================== */
  --accent-primary: var(--primary);
  --text-secondary: var(--text-muted);
  --toast-success: var(--success);
  --toast-warning: var(--warning);
  --toast-error: var(--error);
  --toast-info: var(--info);
  
  --color-primary: var(--primary);
  --color-primary-hover: var(--primary-hover);
  --color-accent: var(--accent);
  --color-accent-hover: var(--accent-hover);
  --color-success: var(--success);
  --color-success-hover: var(--success-hover);
  --color-warning: var(--warning);
  --color-warning-hover: var(--warning-hover);
  --color-error: var(--error);
  --color-error-hover: var(--error-hover);
  --color-info: var(--info);
  --color-info-hover: var(--info-hover);
  
  --bg-primary: var(--bg);
  --bg-secondary: var(--surface);
  --bg-glass: rgba(255, 255, 255, 0.95);
  --bg-overlay: var(--primary-opacity-10);
  --bg-gradient: var(--gradient-surface);
  --bg-gradient-alt: linear-gradient(135deg, var(--surface) 0%, var(--border) 100%);
  
  --text-primary: var(--text);
  --text-secondary: var(--text-muted);
  --text-inverse: #ffffff;
  --text-disabled: var(--disabled);
  
  --border-color: var(--border);
  --border-focus: var(--focus);
  --border-error: var(--error);
  --border-success: var(--success);
  --border-warning: var(--warning);
}

/* ===================================
   THEME APPLICATION
   =================================== */
body {
  color: var(--text);
}

/* Glass effect - Disabled for Performance */
.glass {
  background: rgba(255, 255, 255, 0.95);
}

.glass-light {
  background: rgba(255, 255, 255, 0.8);
}

/* Focus styles */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* ===================================
   SCROLLBAR - Simplified
   =================================== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #F3F4F6;
}

::-webkit-scrollbar-thumb {
  background: #D1D5DB;
  border-radius: 0;
}

::-webkit-scrollbar-thumb:hover {
  background: #9CA3AF;
}

/* ===================================
   SCROLLBAR STABILIZER - Prevent layout shift
   =================================== */
html {
  scrollbar-gutter: stable; /* Reserve space for scrollbar */
}

/* Alternative for browsers that don't support scrollbar-gutter */
@supports not (scrollbar-gutter: stable) {
  html {
    margin-left: calc(100vw - 100%);
    margin-right: 0;
  }
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--gray-300) var(--gray-100);
}


/* ===================================
   BUTTONS.CSS
   =================================== */

/* ===================================
   FLAT BUTTONS - RED PRIMARY THEME
   =================================== */

/* Base Button - Flat Design */
.btn {
  background: var(--red-500);
  color: white;
  border: none;
  border-radius: 0;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  outline: none;
  position: relative;
  overflow: hidden;
}

.btn:hover {
  background: #dc2626;
}

.btn:active {
  background: #b91c1c;
}

/* Remove all pseudo-elements and decorative effects */
.btn::before,
.btn::after {
  display: none !important;
}

.btn:hover::before,
.btn:hover::after,
.btn:active::before,
.btn:active::after {
  display: none !important;
}

/* Button States */
.btn:focus-visible {
  outline: 2px solid var(--red-500);
  outline-offset: 2px;
}

.btn:disabled {
  background: var(--border);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.6;
}

/* Button Variants - Flat Design */
.btn-secondary {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #e5e7eb;
}

.btn-secondary:hover {
  background: var(--red-500);
  color: white;
  border-color: var(--red-500);
}

.btn-tertiary {
  background: transparent;
  color: var(--red-500);
  border: 2px solid var(--red-500);
}

.btn-tertiary:hover {
  background: var(--red-500);
  color: white;
}

/* Size Variants */
.btn-small {
  padding: 8px 16px;
  font-size: 13px;
  min-height: 32px;
  border-radius: 0;
}

.btn-large {
  padding: 14px 28px;
  font-size: 16px;
  min-height: 48px;
  border-radius: 0;
}

/* Icon Button */
.btn-icon {
  padding: 10px;
  min-height: 40px;
  min-width: 40px;
  border-radius: 0;
}

.btn-icon.btn-small {
  padding: 8px;
  min-height: 32px;
  min-width: 32px;
}

.btn-icon.btn-large {
  padding: 14px;
  min-height: 48px;
  min-width: 48px;
}

/* Specific Button Overrides - Flat Design */
.content .buttons .btn {
  background: var(--red-500);
  color: white;
  border: none;
  border-radius: 0;
  padding: 12px 24px;
  font-weight: 600;
  transition: background-color 0.15s ease;
}

.content .buttons .btn:hover {
  background: #dc2626;
}

.content-actions .btn {
  background: var(--red-500);
  color: white;
  border: none;
  border-radius: 0;
  padding: 12px 24px;
  font-weight: 600;
  transition: background-color 0.15s ease;
}

.content-actions .btn:hover {
  background: #dc2626;
}

/* Button Icon Styling */
.btn i {
  font-size: 16px;
}

/* ===================================
   SIDEBAR - FLAT DESIGN
   =================================== */

/* Sidebar Container */
.sidebar {
  flex: 0 1 auto;
  width: auto;
  min-width: 200px;
  max-width: 500px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Sidebar Header - Flat Design */
.sidebar-header {
  display: flex;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  height: 48px;
  align-items: center;
}

.sidebar-header .btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: 0;
  background: var(--red-500);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  height: 32px;
  position: relative;
  overflow: hidden;
  min-width: 0;
  flex: 1;
}

.sidebar-header .btn i {
  font-size: 14px;
}

.sidebar-header .btn span {
  display: none;
}

.sidebar-header .btn:hover {
  background: #E76E70 !important;
  color: white !important;
}

/* Specific for Open Folder button */
#openFolderBtn:hover {
  background: #E76E70 !important;
  color: white !important;
}

.sidebar-header .btn:active {
  background: #D95A5C;
}

.sidebar-header .btn.secondary {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #e5e7eb;
}

.sidebar-header .btn.secondary:hover {
  background: var(--red-500);
  color: white;
  border-color: var(--red-500);
}

/* Sidebar Body */
.sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

/* Sidebar Search - Flat Design */
.sidebar-search {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.sidebar-search input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text);
  font-size: 14px;
  font-family: var(--font-family-base);
  outline: none;
  border-radius: 0;
}

.sidebar-search input:focus {
  border-color: var(--red-500);
  background: var(--surface);
}

.sidebar-search input::placeholder {
  color: var(--text-muted);
}

/* File Tree - Flat Design */
.file-tree {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-xs);
  user-select: none;
  line-height: 1.5;
}

/* Tree Container */
.file-tree ul.tree {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Folder Structure */
.file-tree .folder {
  position: relative;
  cursor: pointer;
}

.file-tree .folder > .label {
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  border: 1px solid transparent;
}

.file-tree .folder > .label::before {
  content: '\f105';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  margin-right: var(--space-1);
  font-size: 8px;
  transition: transform 0.2s ease;
}

.file-tree .folder.open > .label::before {
  transform: rotate(90deg);
}

.file-tree .folder > .label:hover {
  background: var(--bg-secondary);
}

/* Folder Children */
.file-tree .folder > ul {
  margin-left: var(--space-4);
  border-left: 1px solid var(--border);
  padding-left: var(--space-3);
  margin-top: var(--space-1);
  display: none;
}

.file-tree .folder.open > ul {
  display: block;
}

/* File Items */
.file-tree .file {
  cursor: pointer;
}

.file-tree .file > .label {
  display: flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  color: var(--text-muted);
  border: 1px solid transparent;
}

/* Common Hover States */
.file-tree .folder > .label:hover,
.file-tree .file > .label:hover {
  background: var(--bg-secondary);
  color: var(--text);
}

/* Active State */
.file-tree .file.selected > .label {
  background: var(--accent-primary);
  color: var(--text-inverse);
  border-color: var(--accent-primary);
  font-weight: 500;
}

/* File Type Colors */
.file-tree .file[data-ext="html"] > .label { color: var(--accent-primary); }
.file-tree .file[data-ext="css"] > .label { color: var(--success); }
.file-tree .file[data-ext="js"] > .label { color: var(--warning); }
.file-tree .file[data-ext="json"] > .label { color: var(--info); }
.file-tree .file[data-ext="md"] > .label { color: var(--text-muted); }

/* Empty State */
.file-tree-empty {
  padding: var(--space-4);
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
}

/* Loading State */
.file-tree-loading {
  padding: var(--space-4);
  text-align: center;
  color: var(--text-muted);
}

/* Resize Handle - Flat Design */
.resize-handle {
  width: 2px;
  background: var(--border);
  cursor: col-resize;
  position: relative;
}

.resize-handle:hover {
  background: var(--accent-primary);
}

.resize-handle:active {
  background: var(--accent-hover);
}

/* Scrollbar Styling - Flat Design */
.sidebar-body::-webkit-scrollbar {
  width: 8px;
}

.sidebar-body::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

.sidebar-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 0;
}

.sidebar-body::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}


/* ===================================
   CARDS.CSS
   =================================== */

/* ===================================
   CARD COMPONENTS
   =================================== */
.card {
  background: var(--surface);
  border: 2px solid var(--border);
  padding: var(--space-6);
  position: relative;
  overflow: hidden;
}

.card:hover {
  border-color: var(--accent-primary);
}

.card-header {
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  color: var(--text);
  margin: 0 0 var(--space-2);
  line-height: var(--line-height-tight);
}

.card-subtitle {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin: 0;
  line-height: var(--line-height-normal);
}

.card-body {
  flex: 1;
}

.card-footer {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

/* Card Variants */
.card-interactive {
  cursor: pointer;
}

.card-bordered {
  border: 2px solid var(--border);
}

.card-bordered:hover {
  border-color: var(--accent-primary);
}

.card-outlined {
  border: 1px solid var(--divider);
  background: transparent;
}

.card-outlined:hover {
  background: var(--surface);
  border-color: var(--border);
}

/* Card Sizes */
.card-sm {
  padding: var(--space-4);
}

.card-sm .card-title {
  font-size: var(--font-size-lg);
}

.card-lg {
  padding: var(--space-8);
}

.card-lg .card-title {
  font-size: var(--font-size-2xl);
}

.card-xl {
  padding: var(--space-10);
}

.card-xl .card-title {
  font-size: var(--font-size-3xl);
}

/* Card States */
.card-loading {
  opacity: 0.6;
  pointer-events: none;
}

.card-loading::after {
  display: none;
}


.card-error {
  border-color: var(--btn-danger-bg);
  background: rgba(220, 38, 38, 0.05);
}

.card-success {
  border-color: var(--toast-success);
  background: rgba(22, 163, 74, 0.05);
}

.card-warning {
  border-color: var(--toast-warning);
  background: rgba(245, 158, 11, 0.05);
}

.card-info {
  border-color: var(--toast-info);
  background: rgba(37, 99, 235, 0.05);
}

/* Card Actions */
.card-actions {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.card-actions-right {
  margin-left: auto;
}

.card-actions-vertical {
  flex-direction: column;
  align-items: stretch;
}

.card-actions-vertical .btn {
  justify-content: center;
}


/* ===================================
   FORMS.CSS
   =================================== */

/* ===================================
   FORM COMPONENTS
   =================================== */
.form {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-row {
  display: flex;
  gap: var(--space-4);
  align-items: flex-end;
}

.form-row .form-group {
  flex: 1;
}

.form-inline {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.form-inline .form-group {
  flex: 1;
  min-width: 200px;
}

/* Form Labels */
.form-label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--text);
  line-height: var(--line-height-normal);
  display: block;
}

.form-label.required::after {
  content: ' *';
  color: var(--btn-danger-bg);
}

.form-label-description {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  font-weight: var(--font-weight-normal);
  margin-top: var(--space-1);
}

/* Form Inputs - Flat Design */
.form-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 2px solid #E9ECEF;
  font-size: var(--font-size-sm);
  font-family: var(--font-family-base);
  color: var(--text);
  background: #FFFFFF;
  outline: none;
  border-radius: 0;
  box-shadow: none;
  transition: border-color 0.15s ease;
}

.form-input:focus {
  border-color: var(--accent-primary);
  box-shadow: none;
}

.form-input:hover:not(:focus) {
  border-color: var(--divider);
}

.form-input:disabled {
  background: var(--bg);
  color: var(--disabled);
  cursor: not-allowed;
  opacity: 0.6;
}

.form-input:invalid {
  border-color: var(--accent-primary);
}

.form-input.success {
  border-color: #15803D;
}

/* Input Sizes */
.form-input-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-xs);
}

.form-input-lg {
  padding: var(--space-4) var(--space-5);
  font-size: var(--font-size-base);
}

/* Textarea - Flat Design */
.form-textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 2px solid #E9ECEF;
  font-size: var(--font-size-sm);
  font-family: var(--font-family-base);
  color: var(--text);
  background: #FFFFFF;
  transition: border-color 0.15s ease;
  outline: none;
  resize: vertical;
  min-height: 100px;
  border-radius: 0;
  box-shadow: none;
}

.form-textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: none;
}

.form-textarea:hover:not(:focus) {
  border-color: var(--divider);
}

.form-textarea:disabled {
  background: var(--bg);
  color: var(--disabled);
  cursor: not-allowed;
  opacity: 0.6;
}

/* Select - Flat Design */
.form-select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 2px solid #E9ECEF;
  font-size: var(--font-size-sm);
  font-family: var(--font-family-base);
  color: var(--text);
  background: #FFFFFF;
  transition: border-color 0.15s ease;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
  padding-right: calc(var(--space-4) + 16px);
  border-radius: 0;
  box-shadow: none;
}

.form-select:focus {
  border-color: var(--accent-primary);
  box-shadow: none;
}

.form-select:hover:not(:focus) {
  border-color: var(--divider);
}

.form-select:disabled {
  background: var(--bg);
  color: var(--disabled);
  cursor: not-allowed;
  opacity: 0.6;
}

/* Checkbox & Radio - Flat Design */
.form-checkbox,
.form-radio {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  position: relative;
}

.form-checkbox input,
.form-radio input {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s ease;
  appearance: none;
  position: relative;
  margin: 0;
  border-radius: 0;
}

.form-checkbox input:checked {
  background: var(--btn-primary-bg);
  border-color: var(--btn-primary-bg);
}

.form-checkbox input:checked::after {
  content: '\f00c';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #FFFFFF;
  font-size: 10px;
}

.form-radio input:checked {
  background: var(--btn-primary-bg);
  border-color: var(--btn-primary-bg);
}

.form-radio input:checked::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 6px;
  height: 6px;
  background: #FFFFFF;
}

.form-checkbox input:focus,
.form-radio input:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.form-checkbox input:disabled,
.form-radio input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Switch */
.form-switch {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
}

.form-switch input {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--border);
  cursor: pointer;
  transition: background-color 0.15s ease;
  appearance: none;
  margin: 0;
  border-radius: 0;
  box-shadow: none;
}

.form-switch input::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: #FFFFFF;
  transition: transform 0.15s ease;
  box-shadow: none;
}

.form-switch input:checked {
  background: var(--btn-primary-bg);
}

.form-switch input:checked::after {
  transform: translateX(20px);
}

.form-switch input:focus {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.form-switch input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Form Help Text */
.form-help {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
  line-height: var(--line-height-normal);
}

.form-error {
  font-size: var(--font-size-xs);
  color: var(--btn-danger-bg);
  margin-top: var(--space-1);
  line-height: var(--line-height-normal);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.form-success {
  font-size: var(--font-size-xs);
  color: var(--toast-success);
  margin-top: var(--space-1);
  line-height: var(--line-height-normal);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

/* Form Actions */
.form-actions {
  display: flex;
  gap: var(--space-4);
  align-items: center;
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border);
}

.form-actions-right {
  margin-left: auto;
}

.form-actions-center {
  justify-content: center;
}

.form-actions-stacked {
  flex-direction: column;
  gap: var(--space-3);
}


/* ===================================
   NOTIFICATIONS.CSS
   =================================== */

/* ===================================
   TOAST NOTIFICATIONS - Disabled for performance
   =================================== */
.toast-container {
  position: fixed;
  top: calc(56px + var(--space-4));
  right: var(--space-4);
  z-index: var(--z-toast);
  display: none; /* Hide all toasts by default */
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}

/* Only show button-related toasts */
.toast-container.button-toast {
  display: flex;
}

.toast {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 0;
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 300px;
  max-width: 400px;
  pointer-events: all;
}


.toast.success {
  border-left: 4px solid var(--toast-success);
}

.toast.error {
  border-left: 4px solid var(--error);
}

.toast.warning {
  border-left: 4px solid var(--warning);
}

.toast.info {
  border-left: 4px solid var(--info);
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast.success .toast-icon {
  color: var(--toast-success);
}

.toast.error .toast-icon {
  color: var(--error);
}

.toast.warning .toast-icon {
  color: var(--warning);
}

.toast.info .toast-icon {
  color: var(--info);
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: var(--font-weight-semibold);
  color: var(--text);
  margin-bottom: 2px;
}

.toast-message {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--space-1);
  border-radius: 0;
}

.toast-close:hover {
  color: var(--text);
  background: var(--bg-secondary);
}


/* ===================================
   ANIMATIONS.CSS
   =================================== */

/* ===================================
   ANIMATION COMPONENTS - DISABLED FOR PERFORMANCE
   =================================== */

/* All animations disabled for better performance on low-spec devices */
.loading-shimmer,
.shimmer-effect,
.spin-animation,
.fade-in,
.fade-out,
.slide-in,
.slide-up,
.fade-in-up {
  animation: none !important;
}


/* ===================================
   UTILITIES.CSS
   =================================== */

/* ===================================
   UTILITY COMPONENTS
   =================================== */

/* Focus Indicators */
.focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Skip to content link for accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--accent);
  color: white;
  padding: 8px;
  text-decoration: none;
  z-index: var(--z-tooltip);
}

.skip-link:focus {
  top: 6px;
}

/* Transitions - Disabled for Performance */
.fade-in,
.fade-out,
.slide-up {
  animation: none !important;
}

/* Skeleton Loading - Simplified */
.skeleton {
  background: #f0f0f0;
}

/* Ripple Effect - Disabled for Performance */
.ripple::before {
  display: none;
}


/* ===================================
   PAGES CONFIG
   =================================== */

/* ===================================
   CONFIG PAGE - BODY & CONTENT ONLY
   =================================== */

/* Performance optimizations for low-spec laptops */
* {
  box-shadow: none !important;
  text-shadow: none !important;
  transform: translateZ(0);
  will-change: auto;
  backface-visibility: hidden;
}

/* Prevent body scrolling on config page */
html, body {
  overflow: hidden;
  height: 100%;
  /* Reduce repaints */
  contain: layout style paint;
}

/* Config Layout - Override main from layout.css */
main .layout {
  display: flex;
  flex-direction: row; /* Override column from layout.css */
  height: calc(100vh - var(--header-height) - 80px);
  overflow-y: auto; /* Make layout scrollable */
  /* Hardware acceleration */
  transform: translateZ(0);
  contain: layout;
}

/* Fixed sidebar width for config page */
.sidebar {
  width: 280px !important;
  min-width: 280px !important;
  max-width: 280px !important;
  flex-shrink: 0 !important;
  flex-grow: 0 !important;
  /* Optimize rendering */
  contain: layout;
  transform: translateZ(0);
}

/* Container inside layout */
.layout > .container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-5);
  display: flex;
  flex: 1;
  background: var(--surface);
  /* Performance optimization */
  contain: layout;
}


/* Breadcrumb */
.content-header {
  padding: var(--space-4) var(--space-6);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  height: 48px; /* Same as sidebar header */
}

.breadcrumb {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

/* Right Content - Enhanced */
.content {
  padding: 0;
  background: var(--bg-secondary);
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* Content Controls - Flat Design */
.content .controls {
  background: var(--surface);
  padding: var(--space-6);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* Input Wrapper for Inline Indicators - Flat Design */
.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
}

.input-wrapper input {
  flex: 1;
  padding: var(--space-4) var(--space-4);
  padding-right: var(--space-12);
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  font-size: var(--font-size-base);
  color: var(--text);
  border-radius: 0;
  font-family: var(--font-family-base);
  /* Faster transitions for low-spec devices */
  transition: border-color 0.1s ease, background-color 0.1s ease;
  /* Remove expensive properties */
  box-shadow: none !important;
  position: relative;
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
}

.input-wrapper input:hover {
  border-color: var(--accent-primary);
  background: var(--surface);
}

.input-wrapper input:focus {
  background: var(--surface);
  outline: none;
  border-color: var(--accent-primary);
}

.input-wrapper input::placeholder {
  color: var(--text-muted);
  transition: opacity 0.15s ease;
}

.input-wrapper input:focus::placeholder {
  opacity: 0.7;
}

/* Flat Inline Char Count */
.char-count {
  position: absolute !important;
  right: var(--space-3) !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  font-size: var(--font-size-xs);
  font-family: var(--font-family-mono);
  color: var(--text-muted);
  pointer-events: none;
  transition: color 0.15s ease;
}

/* Box Design for All Char Counts - High Specificity */
input-wrapper .char-count#campaignIdCharCount,
input-wrapper .char-count#subjectCharCount,
input-wrapper .char-count#linkCharCount,
#campaignIdCharCount.char-count,
#subjectCharCount.char-count,
#linkCharCount.char-count {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: var(--space-1) !important;
  padding: var(--space-1) var(--space-2) !important;
  background: var(--bg-secondary) !important;
  border: 1px solid var(--border) !important;
  border-radius: 0 !important;
  font-weight: 600 !important;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease !important;
  min-width: 30px !important;
}

/* Default state - Abu-abu saat baru dibuka */
#campaignIdCharCount:not(.applied):not(.saved),
#subjectCharCount:not(.applied):not(.saved),
#linkCharCount:not(.applied):not(.saved) {
  background: var(--bg-secondary) !important;
  border-color: var(--border) !important;
  color: var(--text-muted) !important;
}

/* Applied state - Kuning ketika di apply */
#campaignIdCharCount.applied,
#subjectCharCount.applied,
#linkCharCount.applied {
  background: var(--warning-bg) !important;
  border-color: var(--warning) !important;
  color: var(--warning) !important;
}

/* Saved state - Hijau ketika di save */
#campaignIdCharCount.saved,
#subjectCharCount.saved,
#linkCharCount.saved {
  background: var(--success-bg) !important;
  border-color: var(--success) !important;
  color: var(--success) !important;
}

/* Hover effects */
#campaignIdCharCount:hover,
#subjectCharCount:hover,
#linkCharCount:hover {
  opacity: 0.8;
}

.input-wrapper:focus-within .char-count {
  color: var(--accent-primary);
}

/* Don't apply focus styles to boxed char counts */
.input-wrapper:focus-within #campaignIdCharCount,
.input-wrapper:focus-within #subjectCharCount,
.input-wrapper:focus-within #linkCharCount {
  color: inherit;
}

/* Flat Inline Checkmark */
.checkmark {
  position: absolute;
  right: var(--space-10);
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--success);
  font-size: var(--font-size-sm);
  opacity: 0;
  transition: opacity 0.15s ease;
  background: var(--surface);
  border: 2px solid var(--success);
  border-radius: 0;
}

.checkmark.show {
  opacity: 1;
}

.char-count.at-limit {
  color: var(--error);
}

@keyframes shake {
  0%, 100% { transform: translateY(-50%) translateX(0); }
  25% { transform: translateY(-50%) translateX(-2px); }
  75% { transform: translateY(-50%) translateX(2px); }
}

@keyframes pulse {
  0% { transform: translateY(-2px) scale(1); }
  50% { transform: translateY(-2px) scale(1.05); }
  100% { transform: translateY(-2px) scale(1); }
}

@keyframes slideIn {
  from { 
    opacity: 0;
    transform: translateY(-8px);
  }
  to { 
    opacity: 1;
    transform: translateY(-2px);
  }
}

/* Enhanced tooltip animations */
.content .field .validation-tooltip,
.content .field .warning-tooltip,
.content .field .mismatch-tooltip {
  animation: slideIn 0.2s ease-out;
}

.content .field .validation-tooltip.pulse,
.content .field .warning-tooltip.pulse,
.content .field .mismatch-tooltip.pulse {
  animation: pulse 1s ease-in-out, slideIn 0.2s ease-out;
}

/* Campaign Count Indicator - Flat Design */
.campaign-count-indicator {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 0;
  font-family: var(--font-family-mono);
  font-size: var(--font-size-xs);
  font-weight: 600;
  color: var(--text-muted);
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

/* Default state - Abu-abu saat baru dibuka */
.campaign-count-indicator:not(.low):not(.complete) {
  background: var(--bg-secondary);
  border-color: var(--border);
  color: var(--text-muted);
}

/* Applied state - Kuning ketika di apply (class 'low') */
.campaign-count-indicator.low {
  background: var(--warning-bg);
  border-color: var(--warning);
  color: var(--warning);
}

/* Saved state - Hijau ketika di save (class 'complete') */
.campaign-count-indicator.complete {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--success);
}

/* Hover effects - Flat */
.campaign-count-indicator:hover {
  opacity: 0.8;
}

/* Remove all animations and pseudo-elements */
.campaign-count-indicator::before {
  display: none;
}

/* Campaign ID field special styling */
.input-wrapper.campaign-id-field {
  position: relative;
}

.input-wrapper.campaign-id-field::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: var(--error);
  border-radius: 0;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: -1;
}

.input-wrapper.campaign-id-field.past-date-warning::before {
  opacity: 0.3;
}

/* Campaign ID label with warning */
.content .field.campaign-id-field > label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  position: relative;
}

/* ===================================
   UNIFIED TOOLTIP SYSTEM - Standardized Size & Position
   =================================== */

/* Base tooltip styles - All tooltips inherit these */
.content .field .warning-tooltip,
.content .field .validation-tooltip,
.content .field .mismatch-tooltip {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 8px;
  padding: 6px 10px; /* Standardized padding */
  background: #dc2626; /* Default red color */
  color: white;
  font-size: 11px; /* Standardized font size */
  font-weight: 500;
  border-radius: 0;
  white-space: nowrap; /* Prevent text wrapping */
  width: auto; /* Auto width based on content */
  min-width: fit-content; /* Minimum width to fit content */
  max-width: 300px; /* Maximum width for long messages */
  box-sizing: border-box;
  opacity: 0; /* Hidden by default */
  transform: translateY(-4px); /* Slight upward offset when hidden */
  transition: all 0.2s ease; /* Smooth transition */
  z-index: 10; /* Base z-index */
  pointer-events: none; /* Don't interfere with input */
  text-align: left; /* Standardized text alignment */
  line-height: 1.3; /* Standardized line height */
}

/* Hard guard: when no file is active, never show tooltip remnants. */
body.tooltips-disabled .content .field .warning-tooltip,
body.tooltips-disabled .content .field .validation-tooltip,
body.tooltips-disabled .content .field .mismatch-tooltip {
  display: none !important;
  opacity: 0 !important;
  transform: translateY(-4px) !important;
}

/* Additional guard: during page initialization, hide all tooltips */
body.initializing .content .field .warning-tooltip,
body.initializing .content .field .validation-tooltip,
body.initializing .content .field .mismatch-tooltip {
  display: none !important;
  opacity: 0 !important;
  transform: translateY(-4px) !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Extra aggressive guard: hide tooltips with any opacity during initialization */
body.initializing .content .field [class*="tooltip"] {
  display: none !important;
  opacity: 0 !important;
  transform: translateY(-4px) !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Base tooltip arrow */
.content .field .warning-tooltip::before,
.content .field .validation-tooltip::before,
.content .field .mismatch-tooltip::before {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 12px; /* Standardized arrow position */
  width: 8px;
  height: 8px;
  background: #dc2626; /* Default red color */
  transform: rotate(45deg);
}

/* Mismatch tooltip specific styles */
.content .field .mismatch-tooltip {
  background: #eab308; /* Yellow color for mismatch */
  color: #000; /* Black text for yellow background */
  z-index: 12; /* Higher priority than warning */
}

.content .field .mismatch-tooltip::before {
  background: #eab308; /* Yellow color for arrow */
}

/* Warning tooltip specific styles */
.content .field .warning-tooltip {
  background: #eab308; /* Yellow color for warning */
  color: #000; /* Black text for yellow background */
  z-index: 11;
}

.content .field .warning-tooltip::before {
  background: #eab308; /* Yellow color for arrow */
}

/* Validation tooltip specific styles */
.content .field .validation-tooltip {
  background: #dc2626; /* Red color for validation */
  color: white;
  z-index: 12; /* Highest priority */
}

.content .field .validation-tooltip::before {
  background: #dc2626; /* Red color for arrow */
}

/* Green tooltip for today's date */
.content .field.today-warning .warning-tooltip {
  background: #22c55e; /* Green color for today */
  color: #fff; /* White text for green background */
}

.content .field.today-warning .warning-tooltip::before {
  background: #22c55e; /* Green color for arrow */
}

/* Red tooltip for validation errors (using warning tooltip) */
.content .field.validation-error .warning-tooltip {
  background: #dc2626; /* Red color for validation */
  color: white;
}

.content .field.validation-error .warning-tooltip::before {
  background: #dc2626; /* Red color for arrow */
}

/* Visible states */
.content .field.past-date-warning .warning-tooltip,
.content .field.today-warning .warning-tooltip,
.content .field.validation-error .warning-tooltip,
.content .field.mismatch-error .mismatch-tooltip {
  opacity: 1;
  transform: translateY(0);
}

/* Flat Field Styling */
.content .field {
  margin-bottom: var(--space-5);
}

.content .field label {
  display: block;
  margin-bottom: var(--space-2);
  font-weight: 600;
  font-size: var(--font-size-sm);
  color: var(--text);
}

.content .field .control {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* === CodeMirror Editor Styling === */
.editor-container {
  position: relative;
  width: 100%;
  height: 100%;
  /* Performance optimization */
  contain: layout;
}

/* Hide original textarea */
.editor-container textarea#editor {
  display: none !important;
}

/* CodeMirror container */
.CodeMirror {
  height: 400px !important;
  width: 100% !important;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.5;
  background: #272822 !important;
  color: #f8f8f2 !important;
  border: none;
  outline: none;
  /* Performance optimizations */
  transform: translateZ(0);
  will-change: auto;
  contain: layout style;
}

/* Remove any default textbox appearance */
.CodeMirror textarea {
  display: none !important;
}

/* Editor scrollbars */
.CodeMirror-scrollbar-filler,
.CodeMirror-gutter-filler {
  background-color: #272822;
}

/* Line numbers */
.CodeMirror-linenumber {
  color: #75715e !important;
  min-width: 3em;
  text-align: right;
}

/* Selected line */
.CodeMirror-selected {
  background: #49483e !important;
}

/* Cursor */
.CodeMirror-cursor {
  border-left: 1px solid #f8f8f2 !important;
}

/* Matching tags */
.CodeMirror-matchingtag {
  background: rgba(255, 255, 255, 0.1) !important;
}

/* Fold gutter */
.CodeMirror-foldgutter {
  width: 1em;
}

.CodeMirror-foldgutter-open,
.CodeMirror-foldgutter-folded {
  color: #75715e;
  cursor: pointer;
}

.CodeMirror-foldgutter-open:after {
  content: "\f107";
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
}

.CodeMirror-foldgutter-folded:after {
  content: "\f105";
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
}

/* Search dialog */
.CodeMirror-dialog {
  background: #272822 !important;
  color: #f8f8f2 !important;
  border: 1px solid #49483e !important;
}

.CodeMirror-dialog input {
  background: #1e1f1c !important;
  color: #f8f8f2 !important;
  border: 1px solid #49483e !important;
}

/* === Link field mismatch tooltip */
.content .field.link-field > label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  position: relative;
}

/* Subject field special styling */
.input-wrapper.subject-field {
  position: relative;
}

.input-wrapper.subject-field::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, var(--accent-primary) 0%, transparent 100%);
  opacity: 0;
  transition: opacity var(--transition-fast);
  pointer-events: none;
  z-index: -1;
}

.input-wrapper.subject-field:focus-within::before {
  opacity: 0.05;
}

/* Character limit indicator - Flat Design */
.char-count.near-limit {
  color: var(--warning);
  background: var(--warning-bg);
  border-color: var(--warning);
}

.char-count.at-limit {
  color: var(--error);
  background: var(--error-bg);
  border-color: var(--error);
  animation: shake 0.5s;
}

@keyframes shake {
  0%, 100% { transform: translateY(-50%) translateX(0); }
  25% { transform: translateY(-50%) translateX(-2px); }
  75% { transform: translateY(-50%) translateX(2px); }
}

@keyframes pulse {
  0% { transform: translateY(-2px) scale(1); }
  50% { transform: translateY(-2px) scale(1.05); }
  100% { transform: translateY(-2px) scale(1); }
}

@keyframes slideIn {
  from { 
    opacity: 0;
    transform: translateY(-8px);
  }
  to { 
    opacity: 1;
    transform: translateY(-2px);
  }
}

/* Enhanced tooltip animations */
.content .field .validation-tooltip,
.content .field .warning-tooltip,
.content .field .mismatch-tooltip {
  animation: slideIn 0.2s ease-out;
}

.content .field .validation-tooltip.pulse,
.content .field .warning-tooltip.pulse,
.content .field .mismatch-tooltip.pulse {
  animation: pulse 1s ease-in-out, slideIn 0.2s ease-out;
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */

/* Large Desktops (1600px and up) */
@media (min-width: 1600px) {
  .container {
    max-width: 1500px;
  }
  
  .sidebar {
    width: 320px !important;
    min-width: 320px !important;
    max-width: 320px !important;
  }
}

/* Desktops (1200px to 1599px) */
@media (max-width: 1599px) and (min-width: 1200px) {
  .container {
    max-width: 1200px;
  }
  
  .sidebar {
    width: 280px !important;
    min-width: 280px !important;
    max-width: 280px !important;
  }
}

/* Small Desktops/Landscape Tablets (1024px to 1199px) */
@media (max-width: 1199px) and (min-width: 1024px) {
  .container {
    max-width: 100%;
    padding: 0 var(--space-4);
  }
  
  .footer .container {
    padding: 0;
  }
  
  .sidebar {
    width: 260px !important;
    min-width: 260px !important;
    max-width: 260px !important;
  }
  
  .content {
    padding: var(--space-4);
  }
  
  .controls {
    gap: var(--space-3);
  }
  
  .field {
    margin-bottom: var(--space-3);
  }
}

/* Tablets (768px to 1023px) */
@media (max-width: 1023px) and (min-width: 768px) {
  main .layout {
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - var(--header-height) - 60px);
  }
  
  .sidebar {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    height: 200px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  
  .sidebar-body {
    height: calc(200px - 48px);
  }
  
  .resize-handle {
    display: none;
  }
  
  .content {
    padding: var(--space-4);
    flex: 1;
  }
  
  .controls {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }
  
  .field {
    margin-bottom: var(--space-3);
  }
  
  .input-group {
    flex-direction: column;
    gap: var(--space-2);
  }
  
  .input-group .input {
    width: 100%;
  }
}

/* Mobile Phones (480px to 767px) */
@media (max-width: 767px) and (min-width: 480px) {
  main .layout {
    flex-direction: column;
    height: calc(100vh - var(--header-height) - 60px);
  }
  
  .footer .container {
    padding: 0;
  }
  
  .container {
    padding: 0 var(--space-3);
  }
  
  .sidebar {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    height: 180px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  
  .sidebar-header {
    padding: var(--space-2);
  }
  
  .sidebar-header .btn {
    padding: 6px 12px;
    font-size: 12px;
    height: 28px;
  }
  
  .sidebar-body {
    height: calc(180px - 40px);
    padding: var(--space-2);
  }
  
  .resize-handle {
    display: none;
  }
  
  .content {
    padding: var(--space-3);
  }
  
  .content-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
  }
  
  .breadcrumb {
    font-size: var(--font-size-sm);
  }
  
  .campaign-count-indicator {
    font-size: var(--font-size-xs);
  }
  
  .controls {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }
  
  .field {
    margin-bottom: var(--space-3);
  }
  
  .field label {
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-1);
  }
  
  .input-wrapper {
    padding: var(--space-2);
  }
  
  .input-wrapper input,
  .input-wrapper textarea {
    font-size: var(--font-size-sm);
    padding: var(--space-2);
  }
  
  .char-count {
    font-size: 10px;
    padding: 2px 6px;
  }
  
  .checkmark {
    font-size: 12px;
  }
  
  .btn {
    padding: 8px 16px;
    font-size: 13px;
    min-height: 36px;
  }
  
  .buttons {
    flex-direction: column;
    gap: var(--space-2);
  }
  
  .buttons .btn {
    width: 100%;
  }
}

/* Small Mobile Phones (max-width: 479px) */
@media (max-width: 479px) {
  main .layout {
    flex-direction: column;
    height: calc(100vh - var(--header-height) - 60px);
  }
  
  .footer .container {
    padding: 0;
  }
  
  .sidebar {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    height: 160px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  
  .sidebar-header {
    padding: var(--space-1) var(--space-2);
  }
  
  .sidebar-header .btn {
    padding: 4px 8px;
    font-size: 11px;
    height: 24px;
  }
  
  .sidebar-header .btn i {
    font-size: 12px;
  }
  
  .sidebar-body {
    height: calc(160px - 32px);
    padding: var(--space-1);
  }
  
  .file-tree {
    font-size: 10px;
  }
  
  .file-tree .folder > .label,
  .file-tree .file > .label {
    padding: 2px 4px;
  }
  
  .resize-handle {
    display: none;
  }
  
  .content {
    padding: var(--space-2);
  }
  
  .content-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-1);
    margin-bottom: var(--space-2);
  }
  
  .breadcrumb {
    font-size: var(--font-size-xs);
  }
  
  .campaign-count-indicator {
    font-size: 10px;
  }
  
  .controls {
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }
  
  .field {
    margin-bottom: var(--space-2);
  }
  
  .field label {
    font-size: var(--font-size-xs);
    margin-bottom: 2px;
  }
  
  .input-wrapper {
    padding: var(--space-1);
  }
  
  .input-wrapper input,
  .input-wrapper textarea {
    font-size: var(--font-size-xs);
    padding: var(--space-1);
  }
  
  .char-count {
    font-size: 9px;
    padding: 1px 4px;
  }
  
  .checkmark {
    font-size: 10px;
  }
  
  .btn {
    padding: 6px 12px;
    font-size: 12px;
    min-height: 32px;
  }
  
  .buttons {
    flex-direction: column;
    gap: var(--space-1);
  }
  
  .buttons .btn {
    width: 100%;
  }
}

/* Responsive Design - Mobile */
@media (max-width: 767px) {
  body {
    padding-top: var(--header-height);
  }

  main .layout {
    flex-direction: column;
    height: calc(100vh - var(--header-height) - 60px);
  }

  .config-panel,
  .preview-panel {
    height: 50%;
    min-height: 50%;
  }
}

@media (max-width: 479px) {
  main .layout {
    flex-direction: column;
    height: calc(100vh - var(--header-height) - 60px);
  }

  .config-panel,
  .preview-panel {
    height: 50%;
    min-height: 50%;
  }
}

/* Ultra-wide screens (2560px and up) */
@media (min-width: 2560px) {
  .container {
    max-width: 2000px;
  }
  
  .sidebar {
    width: 360px !important;
    min-width: 360px !important;
    max-width: 360px !important;
  }
  
  .controls {
    gap: var(--space-6);
  }
  
  .field {
    margin-bottom: var(--space-5);
  }
}
