/*
 * GLUMP Prompt Studio - 2012 Skeuomorphic Style Sheet
 * Typography: Roboto (Body) and Inconsolata (Monospace Prompt/Code Elements)
 */

@import url('https://fonts.googleapis.com/css2?family=Inconsolata:wght@400;600;700&family=Roboto:wght@300;400;500;700&display=swap');

/* --- Theme Variables --- */
:root {
  --font-body: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: 'Inconsolata', Consolas, "Liberation Mono", Courier, monospace;

  /* 2012 Skeuomorphic Palette */
  --bg-app: #e2e5ea; /* OS X Mountain Lion style light linen/gray background */
  --panel-bg: #f5f6f8; /* Soft silver panel face */
  --panel-border: #a6aab3; /* Well-defined metal border */
  --panel-border-light: #ffffff; /* Inner bevel highlight */
  --text-dark: #333333;
  --text-light: #f5f5f5;
  --text-muted: #666666;

  /* Button Gradients */
  --btn-default-top: #ffffff;
  --btn-default-bottom: #e0e2e5;
  --btn-default-border: #a1a5ad;

  --btn-primary-top: #5cb85c;
  --btn-primary-bottom: #419641;
  --btn-primary-border: #357ebd;

  --btn-blue-top: #428bca;
  --btn-blue-bottom: #3071a9;
  --btn-blue-border: #2b669a;

  --btn-danger-top: #d9534f;
  --btn-danger-bottom: #c9302c;
  --btn-danger-border: #ac2925;

  /* Header Gradient */
  --hdr-top: #4c5a6d;
  --hdr-bottom: #2c3540;
  --hdr-border: #1b2128;
}

/* --- Base Rules --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-app);
  color: var(--text-dark);
  font-size: 13px;
  line-height: 1.4;
  height: 100vh;
  overflow: hidden;
  padding: 0;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
}

/* --- Container App (Desktop Window Framework) --- */
#glump-app {
  width: 100%;
  height: 100vh;
  background-color: var(--panel-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* --- 2012 Glossy Header Bar --- */
header.app-header {
  background: linear-gradient(to bottom, var(--hdr-top) 0%, var(--hdr-bottom) 100%);
  border-bottom: 1px solid var(--hdr-border);
  height: 48px;
  padding: 0 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  user-select: none;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Retro metallic text logo */
.brand-logo {
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 -1px 1px rgba(0, 0, 0, 0.8);
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-logo i {
  color: #3498db;
  text-shadow: 0 0 5px rgba(52, 152, 219, 0.6);
}

.brand-version {
  background: linear-gradient(to bottom, #7f8c8d 0%, #95a5a6 100%);
  border: 1px solid #7f8c8d;
  color: #fff;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  text-shadow: 0 1px 0 rgba(0,0,0,0.2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.3);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* --- Main Split Window Layout --- */
.main-container {
  flex: 1;
  display: flex;
  overflow: hidden;
  background-color: #d1d4d9; /* OS X style gutter background */
  padding: 6px;
  gap: 6px;
}

/* --- Left Sidebar (Category & Explorer Pane) --- */
aside.sidebar {
  width: 260px;
  background-color: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), inset 0 1px 0 #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Sidebar Title/Grip */
.sidebar-header {
  background: linear-gradient(to bottom, #f0f2f5 0%, #e0e2e6 100%);
  border-bottom: 1px solid var(--panel-border);
  padding: 8px 12px;
  font-weight: 700;
  color: #4a505b;
  text-shadow: 0 1px 0 #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.search-container {
  padding: 8px 10px;
  border-bottom: 1px solid #d4d7dd;
  background-color: #ebecf0;
}

.search-input {
  width: 100%;
  padding: 5px 8px;
  padding-left: 24px;
  font-size: 12px;
  border: 1px solid #b3b7c0;
  border-radius: 12px; /* Classic capsule search style */
  background: #ffffff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23666' class='bi bi-search' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z'/%3E%3C/svg%3E") no-repeat 8px center;
  outline: none;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
  transition: border-color 0.15s ease;
}

.search-input:focus {
  border-color: #3498db;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.1), 0 0 3px rgba(52, 152, 219, 0.4);
}

.sidebar-scrollable {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Category Selection Blocks */
.category-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.category-group-title {
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 700;
  color: #7f8c8d;
  padding-left: 6px;
  margin-bottom: 2px;
  letter-spacing: 0.5px;
}

.sidebar-btn {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: none;
  padding: 6px 8px;
  border-radius: 4px;
  font-family: var(--font-body);
  font-size: 12px;
  color: #333333;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 500;
  transition: none;
}

.sidebar-btn:hover {
  background: linear-gradient(to bottom, #ffffff 0%, #e1e3e8 100%);
  border-color: #b3b7c0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  color: #000000;
}

.sidebar-btn:active {
  background: linear-gradient(to bottom, #d2d5db 0%, #e8ebf0 100%);
  border-color: #989ca6;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.15);
}

.sidebar-btn.active {
  background: linear-gradient(to bottom, #54a0ff 0%, #2e86de 100%);
  border-color: #1b62b3;
  color: #ffffff;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 1px 3px rgba(0,0,0,0.1);
}

.sidebar-btn .badge {
  background-color: #dcdde1;
  color: #2f3640;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
}

.sidebar-btn.active .badge {
  background-color: rgba(255,255,255,0.25);
  color: #ffffff;
}

.sidebar-separator {
  border-top: 1px solid #d4d7dd;
  margin: 4px 2px;
}

/* Prompt List Items */
.prompt-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.prompt-item {
  border: 1px solid #dcdde1;
  border-radius: 4px;
  background-color: #ffffff;
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
  transition: none;
}

.prompt-item:hover {
  border-color: #a1a5ad;
  background: linear-gradient(to bottom, #ffffff 0%, #f1f2f5 100%);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.prompt-item:active {
  background: linear-gradient(to bottom, #dbdee2 0%, #cbd0d6 100%);
  border-color: #8a8e96;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.15);
}

.prompt-item.active {
  background: linear-gradient(to bottom, #f0f4f9 0%, #d9e5f3 100%);
  border-color: #70a0d0;
  box-shadow: inset 0 1px 0 #ffffff, 0 1px 3px rgba(0,0,0,0.08);
  position: relative;
}

.prompt-item-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 12px;
  color: #2f3640;
}

.prompt-item-header i {
  color: #7f8c8d;
}

.prompt-item.active .prompt-item-header i {
  color: #3498db;
}

.prompt-item-desc {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer {
  padding: 8px;
  border-top: 1px solid var(--panel-border);
  background-color: #ebecf0;
}

/* --- Right Workspace (Main Content Pane) --- */
main.workspace {
  flex: 1;
  background-color: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), inset 0 1px 0 #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Workspace Empty State */
.workspace-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #7f8c8d;
  gap: 12px;
  text-align: center;
  padding: 20px;
}

.workspace-empty i {
  font-size: 48px;
  color: #bdc3c7;
  text-shadow: 0 1px 0 #ffffff;
}

.workspace-empty h3 {
  font-size: 18px;
  font-weight: 500;
  text-shadow: 0 1px 0 #ffffff;
}

.workspace-empty p {
  font-size: 12px;
  max-width: 320px;
}

/* Workspace Header Block */
.workspace-header {
  background: linear-gradient(to bottom, #ffffff 0%, #edf0f5 100%);
  border-bottom: 1px solid var(--panel-border);
  padding: 12px 15px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.workspace-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.workspace-title-section {
  display: flex;
  align-items: center;
  gap: 8px;
}

.workspace-title-icon {
  font-size: 18px;
  color: #34495e;
  background-color: #d1d8e0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  border: 1px solid #b3b7c0;
  box-shadow: inset 0 1px 0 #fff, 0 1px 2px rgba(0,0,0,0.05);
}

.workspace-title {
  font-size: 16px;
  font-weight: 700;
  color: #2c3e50;
  text-shadow: 0 1px 0 #ffffff;
}

.workspace-meta-tag {
  background-color: #dcdde1;
  color: #2f3640;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 3px;
  border: 1px solid #b2bec3;
  text-shadow: 0 1px 0 rgba(255,255,255,0.4);
}

.workspace-actions {
  display: flex;
  gap: 6px;
}

.workspace-desc {
  font-size: 12px;
  color: var(--text-muted);
  text-shadow: 0 1px 0 #ffffff;
}

.workspace-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 2px;
}

.workspace-tag-pill {
  font-size: 9px;
  font-weight: 600;
  background-color: #f1f2f6;
  border: 1px solid #ced6e0;
  color: #57606f;
  padding: 1px 5px;
  border-radius: 3px;
}

/* --- Tabs Styling (2012 jQuery UI Cupertino Theme Style) --- */
.tab-container {
  display: flex;
  background-color: #e0e2e6;
  border-bottom: 1px solid var(--panel-border);
  padding: 6px 10px 0 10px;
  gap: 4px;
  user-select: none;
}

.tab-btn {
  background: linear-gradient(to bottom, #edf0f4 0%, #dbdee3 100%);
  border: 1px solid var(--panel-border);
  border-bottom: none;
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
  padding: 4px 10px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  color: #555c66;
  cursor: pointer;
  margin-bottom: -1px;
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: none;
  height: 24px;
}

.tab-btn:hover {
  background: linear-gradient(to bottom, #ffffff 0%, #e2e4e8 100%);
  color: #000000;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.tab-btn:active {
  background: #dcdde2;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);
  color: #333333;
}

.tab-btn.active {
  background: var(--panel-bg);
  border-color: var(--panel-border);
  border-bottom-color: transparent;
  color: #2c3e50;
  font-weight: 700;
  z-index: 3;
  box-shadow: none;
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background-color: var(--panel-bg);
}

/* Tab Panels */
.tab-panel {
  display: none;
  flex: 1;
  overflow: hidden;
}

.tab-panel.active {
  display: flex;
}

/* --- Panel Layouts --- */

/* Tab A: Playground / Active Runner (Split Column View) */
.playground-split {
  flex: 1;
  display: flex;
  overflow: hidden;
  background-color: #d1d4d9;
  padding: 6px;
  gap: 6px;
}

.playground-variables-panel {
  flex: 4; /* Left column */
  background-color: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  box-shadow: inset 0 1px 0 #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.playground-preview-panel {
  flex: 6; /* Right column */
  background-color: #2c3540; /* Dark slate terminal background */
  border: 1px solid #1c2229;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: inset 0 3px 10px rgba(0,0,0,0.4);
}

.panel-title-bar {
  background: linear-gradient(to bottom, #f0f2f5 0%, #edf0f3 100%);
  border-bottom: 1px solid var(--panel-border);
  padding: 6px 12px;
  font-weight: 700;
  font-size: 11px;
  color: #4a505b;
  text-shadow: 0 1px 0 #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-title-bar.dark {
  background: linear-gradient(to bottom, #34495e 0%, #2c3e50 100%);
  border-bottom: 1px solid #1c2229;
  color: #ffffff;
  text-shadow: 0 -1px 0 rgba(0,0,0,0.4);
}

.panel-scrollable {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

/* Variable Fields UI */
.variables-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.variable-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.variable-label {
  font-weight: 700;
  font-size: 11px;
  color: #4a505b;
  display: flex;
  align-items: center;
  gap: 5px;
}

.variable-placeholder-mono {
  font-family: var(--font-mono);
  background-color: #dfe4ea;
  color: #2f3542;
  padding: 1px 2px;
  border-radius: 2px;
  font-size: 10px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1), inset 0 1px 0 #ffffff;
}

.variable-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #b3b7c0;
  border-radius: 3px;
  background-color: #ffffff;
  outline: none;
  font-family: var(--font-body);
  font-size: 12px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}

.variable-input:focus {
  border-color: #3498db;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.08), 0 0 3px rgba(52,152,219,0.3);
}

.variable-textarea {
  resize: vertical;
  min-height: 50px;
}

.no-variables-alert {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #7f8c8d;
  height: 100%;
  gap: 10px;
  padding: 20px;
  text-align: center;
}

.no-variables-alert i {
  font-size: 32px;
  color: #bdc3c7;
}

/* Dark Terminal Codeblock (Compiled Prompt Box) */
.compiled-preview-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.compiled-text-box {
  flex: 1;
  width: 100%;
  background-color: #1e252f;
  border: 1px solid #121820;
  border-radius: 3px;
  color: #f1f2f6;
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 10px;
  resize: none;
  outline: none;
  line-height: 1.5;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.5);
  overflow-y: auto;
  white-space: pre-wrap;
}

/* System Prompt Label Block */
.system-prompt-label-block {
  font-size: 11px;
  color: #a4b0be;
  margin-bottom: 6px;
  font-family: var(--font-body);
  display: flex;
  align-items: center;
  gap: 5px;
}

.system-prompt-box-mini {
  background-color: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ced6e0;
  font-family: var(--font-mono);
  padding: 6px;
  border-radius: 3px;
  font-size: 11px;
  margin-bottom: 10px;
  max-height: 60px;
  overflow-y: auto;
}

/* Tab B: Editor / Form Template View */
.editor-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 15px 15px 0 15px;
}

#prompt-editor-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 15px;
  flex: 1;
  overflow-y: auto;
  padding-right: 6px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group.full-width {
  grid-column: span 2;
}

.form-label {
  font-weight: 700;
  color: #4a505b;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #b3b7c0;
  border-radius: 3px;
  background-color: #ffffff;
  outline: none;
  font-family: var(--font-body);
  font-size: 12px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: #3498db;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.08), 0 0 3px rgba(52,152,219,0.3);
}

.form-textarea {
  resize: vertical;
  min-height: 120px;
}

.form-textarea.code-font {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  background-color: #fdfdfd;
}

.editor-footer {
  margin-top: auto;
  padding: 15px 0;
  border-top: 1px solid var(--panel-border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background-color: var(--panel-bg);
  z-index: 10;
}

/* --- Skeuomorphic Button Styles --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 3px;
  cursor: pointer;
  user-select: none;
  outline: none;
  transition: all 0.05s ease;
  height: 28px;
}

/* Standard Silver Button */
.btn-default {
  background: linear-gradient(to bottom, var(--btn-default-top) 0%, var(--btn-default-bottom) 100%);
  border: 1px solid var(--btn-default-border);
  color: #333333;
  text-shadow: 0 1px 0 #ffffff;
  box-shadow: inset 0 1px 0 #ffffff, 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-default:hover {
  background: linear-gradient(to bottom, #ffffff 0%, #d1d4d8 100%);
  border-color: #92969f;
}

.btn-default:active, .btn-default.active {
  background: #dbdee2;
  border-color: #92969f;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);
}

/* Primary Green Button */
.btn-primary {
  background: linear-gradient(to bottom, var(--btn-primary-top) 0%, var(--btn-primary-bottom) 100%);
  border: 1px solid var(--btn-primary-border);
  color: #ffffff;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover {
  background: linear-gradient(to bottom, #6cd46c 0%, #3e8f3e 100%);
}

.btn-primary:active {
  background: #3e8f3e;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Blue Action Button */
.btn-blue {
  background: linear-gradient(to bottom, var(--btn-blue-top) 0%, var(--btn-blue-bottom) 100%);
  border: 1px solid var(--btn-blue-border);
  color: #ffffff;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-blue:hover {
  background: linear-gradient(to bottom, #5cb85c 0%, #285e8e 100%); /* Blue gradient hover */
  background: linear-gradient(to bottom, #509ce7 0%, #285e8e 100%);
}

.btn-blue:active {
  background: #285e8e;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Danger Red Button */
.btn-danger {
  background: linear-gradient(to bottom, var(--btn-danger-top) 0%, var(--btn-danger-bottom) 100%);
  border: 1px solid var(--btn-danger-border);
  color: #ffffff;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-danger:hover {
  background: linear-gradient(to bottom, #e8635f 0%, #b8231f 100%);
}

.btn-danger:active {
  background: #b8231f;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-mini {
  height: 22px;
  padding: 2px 8px;
  font-size: 11px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none !important;
}

/* --- Modals Overlay Framework --- */
.modal-overlay {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.4);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

/* Skeuomorphic Modal Window Box */
.modal-window {
  background-color: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  width: 90%;
  max-width: 550px;
  box-shadow: 0 15px 35px rgba(0,0,0,0.35), inset 0 1px 0 #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modal-slide-down 0.2s ease-out;
}

@keyframes modal-slide-down {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  background: linear-gradient(to bottom, #f0f2f5 0%, #d4d7dd 100%);
  border-bottom: 1px solid var(--panel-border);
  padding: 8px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.modal-title {
  font-weight: 700;
  color: #34495e;
  text-shadow: 0 1px 0 #ffffff;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 16px;
  color: #7f8c8d;
  cursor: pointer;
  transition: color 0.1s ease;
  display: flex;
  align-items: center;
}

.modal-close-btn:hover {
  color: #e74c3c;
}

.modal-body {
  padding: 15px;
  overflow-y: auto;
  max-height: 70vh;
}

.modal-footer {
  background-color: #ebecf0;
  border-top: 1px solid var(--panel-border);
  padding: 10px 15px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Modals Custom Sub-Layouts */
.modal-window.large {
  max-width: 700px;
}

/* Modals Vertical tab layout inside Settings */
.modal-tab-layout {
  display: flex;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  background-color: #ffffff;
  min-height: 350px;
}

.modal-tab-sidebar {
  width: 160px;
  background-color: #ebecf0;
  border-right: 1px solid var(--panel-border);
  padding: 6px 0 6px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.modal-tab-btn {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: none;
  padding: 6px 10px;
  border-radius: 3px 0 0 3px;
  font-family: var(--font-body);
  font-size: 12px;
  color: #4b525f;
  cursor: pointer;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.modal-tab-btn:hover {
  background-color: #dcdde1;
}

.modal-tab-btn.active {
  background: #f5f6f8;
  border: 1px solid var(--panel-border);
  border-right: 1px solid #f5f6f8;
  color: #2c3e50;
  font-weight: 700;
  margin-right: -1px;
  position: relative;
  z-index: 5;
}

.modal-tab-content {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  background-color: #f5f6f8;
}

.settings-tab-pane {
  display: none;
  flex-direction: column;
  gap: 12px;
  height: 100%;
}

.settings-tab-pane.active {
  display: flex;
}

/* --- Custom Helpers & Notifications --- */
.status-pill {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-pill.success {
  background-color: #2ecc71;
  box-shadow: 0 0 4px #2ecc71;
}

.status-pill.danger {
  background-color: #e74c3c;
  box-shadow: 0 0 4px #e74c3c;
}

/* Copy popup feedback */
#toast-notification {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: linear-gradient(to bottom, #4b5563 0%, #1f2937 100%);
  border: 1px solid #111827;
  color: #ffffff;
  padding: 6px 16px;
  border-radius: 20px;
  font-weight: 500;
  font-size: 11px;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

#toast-notification.active {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Spinner / Loader */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: spin 0.8s linear infinite;
}

.spinner.dark {
  border-color: rgba(52, 152, 219, 0.2);
  border-top-color: #3498db;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Gemini Builder tab form styling */
.builder-description {
  font-size: 12px;
  color: #666;
  line-height: 1.4;
  margin-bottom: 10px;
}

.builder-prompt-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.builder-result-preview {
  margin-top: 12px;
  border: 1px solid #ced6e0;
  border-radius: 4px;
  background-color: #ffffff;
  padding: 10px;
  max-height: 160px;
  overflow-y: auto;
}

.builder-result-header {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 4px;
}

.info-note {
  background-color: #ebf5fb;
  border: 1px solid #aed6f1;
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 11px;
  color: #2e86c1;
  line-height: 1.45;
}

.info-note i {
  margin-right: 4px;
}

/* --- Scrollbars styling --- */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: #f0f0f0;
  border-left: 1px solid #d4d4d4;
  box-shadow: inset 1px 0 0 rgba(0,0,0,0.05);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(to right, #cfcfcf 0%, #b5b5b5 100%);
  border: 1px solid #a3a3a3;
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(to right, #b5b5b5 0%, #999999 100%);
}

/* About Screen UI */
.about-dialog-layout {
  display: flex;
  gap: 15px;
  align-items: flex-start;
}

.about-logo-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 90px;
}

.about-logo-card {
  font-size: 36px;
  color: #34495e;
  background-color: #dfe4ea;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 2px solid #b3b7c0;
  box-shadow: inset 0 2px 0 #fff, 0 3px 6px rgba(0,0,0,0.15);
}

.about-info-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.about-title {
  font-size: 18px;
  font-weight: 700;
  color: #2c3e50;
  text-shadow: 0 1px 0 #ffffff;
}

.about-credits {
  font-size: 12px;
  color: #333333;
  line-height: 1.5;
}

.about-credits a {
  color: #2980b9;
  text-decoration: none;
  font-weight: 500;
}

.about-credits a:hover {
  text-decoration: underline;
}

.about-credits-divider {
  border-top: 1px solid #ced6e0;
  margin: 4px 0;
}

.about-system-info {
  background-color: #f1f2f6;
  border: 1px solid #ced6e0;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 6px;
  border-radius: 3px;
  max-height: 70px;
  overflow-y: auto;
  color: #57606f;
}

/* Yellow Warning alert note (2012 skeuomorphic warning panel style) */
.warning-note {
  background: linear-gradient(to bottom, #fcf8e3 0%, #faf2cc 100%);
  border: 1px solid #faebcc;
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 11px;
  color: #8a6d3b;
  line-height: 1.45;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.4);
}

.warning-note i {
  margin-right: 4px;
  color: #f0ad4e;
}

/* Modal Window Closing Animation */
.modal-overlay.closing .modal-window {
  animation: modal-slide-up 0.15s ease-in forwards;
}

@keyframes modal-slide-up {
  from {
    transform: translateY(0);
    opacity: 1;
  }
  to {
    transform: translateY(-20px);
    opacity: 0;
  }
}
