/* =============================================
   swiss-knife.css
   Azure DevOps Swiss-Knife – Corporate Style
   Based on viable.works design language
   ============================================= */

:root {
  /* ==================== Core Palette ==================== */
  --bg-body:          #0A0A0A;
  --bg-surface:       #1A1A1A;
  --bg-surface-alt:   #121212;
  --bg-hover:         #252525;
  
  --text-primary:     #FFFFFF;
  --text-secondary:   #CCCCCC;
  --text-muted:       #888888;
  
  --border:           #333333;
  --border-focus:     #6600CC;
  
  --accent:           #6600CC;
  --accent-hover:     #7A00FF;
  
  --success:          #00CC33;
  --info:             #00AAFF;
  --warning:          #FF8800;
  --error:            #FF0033;
  
  /* Traffic Light */
  --traffic-idle:     #666666;
  --traffic-success:  #00CC33;
  --traffic-warning:  #FF8800;
  --traffic-error:    #FF0033;
  
  /* Shadows */
  --shadow:           0 4px 20px rgba(0, 0, 0, 0.7);
  --shadow-focus:     0 0 0 3px rgba(102, 0, 204, 0.3);
}

/* ==================== GLOBAL RESET ==================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg-body);
  color: var(--text-secondary);
  font-family: "Segoe UI", system-ui, sans-serif;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ==================== HEADER (Fixed) ==================== */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 68px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 2rem;
  z-index: 1000;
  box-shadow: var(--shadow);
}

.header-left h1 {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text-primary);
}

.schema-link {
  color: var(--accent);
  font-size: 0.85rem;
  text-decoration: none;
}

.header-center, .header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* ==================== MAIN (Input + Output) ==================== */
main {
  margin-top: 68px;
  flex: 1;
  display: flex;
  overflow: hidden;
  padding: 12px;
  gap: 12px;
  min-height: calc(100vh - 68px - 340px);
}

/* ==================== GENERAL PANE ==================== */
.pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.pane-header {
  background: var(--bg-surface-alt);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.95rem;
}

/* ==================== ALL TEXTAREAS (Direct styling) ==================== */
textarea {
  flex: 1;
  background: #0F0F0F;
  color: #E0E0E0;
  font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", monospace;
  font-size: 0.92rem;
  line-height: 1.45;
  padding: 16px;
  border: none;
  resize: none;
  outline: none;
  overflow: auto;
}

textarea:focus {
  box-shadow: var(--shadow-focus);
}

/* Output is always readonly */
#output-textarea {
  background: #0F0F0F;
}

/* ==================== LOG TEXTAREA (ID-specific overrides) ==================== */
#log-textarea {
  background: #0A0A0A;
  color: #B0B0B0;
  line-height: 1.55;
  padding: 12px 16px;
  font-size: 0.88rem;
}

/* Log level coloring (applied via JS by wrapping lines in spans) */
#log-textarea .log-debug { color: #777777; }
#log-textarea .log-info  { color: #88CCFF; }
#log-textarea .log-warn  { color: #FFCC66; }
#log-textarea .log-error { color: #FF6666; }
#log-textarea .log-success { color: #66FF99; }

/* ==================== FOOTER (Resizable Log) ==================== */
.log-footer {
  height: 340px;
  min-height: 220px;
  max-height: 65vh;
  background: var(--bg-surface-alt);
  border-top: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  resize: vertical;
  overflow: hidden;
}

.log-header {
  background: var(--bg-surface);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 500;
  color: var(--text-primary);
}

button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 4px 12px;
  margin-left: 6px;
  border-radius: 4px;
  cursor: pointer;
}

button:hover {
  background: var(--bg-hover);
  color: white;
}

/* ==================== Traffic Light & Utilities ==================== */
.traffic-light {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface-alt);
  padding: 6px 14px;
  border-radius: 9999px;
  border: 1px solid var(--border);
}

.dot {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--traffic-idle);
}

.dot.success { background: var(--traffic-success); }
.dot.warning { background: var(--traffic-warning); }
.dot.error   { background: var(--traffic-error); }

.validation-badge {
  font-size: 0.8rem;
  padding: 2px 10px;
  border-radius: 9999px;
}

.validation-badge.valid {
  background: #003300;
  color: var(--success);
}

.pane-splitter {
  width: 6px;
  background: var(--border);
  cursor: col-resize;
  margin: 12px 0;
  border-radius: 9999px;
}

.pane-splitter:hover {
  background: var(--accent);
}

/* ==================== MODAL ==================== */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal.hidden { display: none; }

.modal-content {
    background: var(--bg-surface);
    width: 760px;           /* Significantly wider */
    max-width: 92vw;
    border-radius: 10px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.modal-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-body label {
    display: block;
    margin-bottom: 10px;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.95rem;
}

/* Wider and taller .env textarea */
#env-input {
    width: 100%;
    min-height: 280px;
    font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", monospace;
    font-size: 0.92rem;
    line-height: 1.55;
    padding: 16px;
    background: #0F0F0F;
    color: #E0E0E0;
    border: 1px solid var(--border);
    border-radius: 6px;
    resize: vertical;
    overflow: auto;
}

#env-input:focus {
    border-color: var(--accent);
    box-shadow: var(--shadow-focus);
}

/* Hint box */
.modal-hint {
    margin-top: 16px;
    padding: 14px 16px;
    background: var(--bg-surface-alt);
    border-radius: 6px;
    border-left: 4px solid var(--accent);
    font-size: 0.87rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.modal-footer {
    padding: 18px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.test-btn, .save-btn {
    padding: 9px 24px;
    border-radius: 6px;
    font-weight: 500;
}

.test-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.save-btn {
    background: var(--accent);
    color: white;
    border: none;
}

.test-btn:hover, .save-btn:hover {
    background: var(--accent-hover);
    color: white;
}