/* ==========================================================================
   NAS MRO Services - Email Generator Studio Stylesheet
   Aviation-inspired dark theme matching nasmro.com branding
   ========================================================================== */

:root {
  --bg-deep: #080A0B;
  --bg-surface: #111417;
  --bg-card: #181C20;
  --bg-card-hover: #20262B;
  --border-color: #272E36;
  --border-focus: #F47121;
  --orange: #F47121;
  --orange-hover: #E05F12;
  --lime: #9DFF20;
  --lime-dark: #345C00;
  --text-white: #FFFFFF;
  --text-light: #D0D7DE;
  --text-muted: #8B949E;
  --danger: #FF4D4D;
  --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-deep);
  color: var(--text-light);
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* TOP NAVBAR */
.top-navbar {
  height: 60px;
  background-color: var(--bg-surface);
  border-bottom: 2px solid var(--orange);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
  flex-shrink: 0;
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo {
  height: 28px;
  width: auto;
}

.brand-divider {
  width: 1px;
  height: 22px;
  background-color: var(--border-color);
}

.brand-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-white);
}

.brand-badge {
  background-color: var(--lime-dark);
  color: var(--lime);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 4px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--orange);
  color: var(--text-white);
  border-color: var(--orange);
}

.btn-primary:hover {
  background-color: var(--orange-hover);
  border-color: var(--orange-hover);
  box-shadow: 0 2px 8px rgba(244, 113, 33, 0.4);
}

.btn-secondary {
  background-color: var(--bg-card);
  color: var(--text-white);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--text-muted);
}

.btn-lime {
  background-color: var(--lime);
  color: #000000;
  border-color: var(--lime);
}

.btn-lime:hover {
  background-color: #B2FF4D;
  box-shadow: 0 2px 8px rgba(157, 255, 32, 0.4);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 11px;
}

.btn-danger {
  color: var(--danger);
  border-color: transparent;
  background: transparent;
}

.btn-danger:hover {
  background-color: rgba(255, 77, 77, 0.15);
}

.btn-icon {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-light);
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  cursor: pointer;
  font-size: 13px;
}

.btn-icon:hover {
  border-color: var(--orange);
  color: var(--orange);
}

/* APP WORKSPACE LAYOUT (DUAL-PANE) */
.app-container {
  display: flex;
  flex: 1;
  overflow: hidden;
  height: calc(100vh - 60px);
}

/* LEFT EDITOR PANE */
.editor-pane {
  width: 520px;
  min-width: 480px;
  max-width: 600px;
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.editor-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--bg-surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

.preset-pills {
  display: flex;
  gap: 8px;
}

.editor-content {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* SECTION ACCORDION / CARDS */
.section-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  overflow: hidden;
  transition: border-color 0.2s;
}

.section-card:hover {
  border-color: #38424D;
}

.section-header {
  padding: 14px 18px;
  background-color: #15191D;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.section-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-white);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title span.indicator {
  color: var(--orange);
}

.section-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* FORM CONTROLS */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.form-row {
  display: flex;
  gap: 12px;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

input[type="text"],
input[type="url"],
input[type="email"],
textarea,
select {
  width: 100%;
  padding: 8px 12px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-white);
  font-size: 12px;
  font-family: inherit;
  transition: border-color 0.2s;
}

input[type="text"]:focus,
input[type="url"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 1px var(--orange);
}

textarea {
  resize: vertical;
}

/* TOGGLE SWITCH */
.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  cursor: pointer;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 18px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--border-color);
  transition: .3s;
  border-radius: 18px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 12px;
  width: 12px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--lime);
}

input:checked + .slider:before {
  transform: translateX(16px);
  background-color: #000000;
}

/* IMAGE INPUT WRAPPER */
.image-input-wrapper {
  display: flex;
  gap: 8px;
}

.btn-upload-label {
  padding: 8px 12px;
  background-color: var(--bg-card-hover);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: var(--text-white);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.btn-upload-label:hover {
  border-color: var(--orange);
  color: var(--orange);
}

/* COMPONENT ITEM EDITOR */
.component-item-editor {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 5px;
  margin-bottom: 12px;
  overflow: hidden;
}

.component-item-header {
  padding: 10px 14px;
  background-color: #12161A;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.component-drag-handle {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--orange);
  font-weight: 700;
  margin-right: 8px;
}

.component-item-title {
  flex: 1;
  font-size: 12px;
  color: var(--text-white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.component-actions {
  display: flex;
  gap: 4px;
}

.component-item-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* RIGHT PREVIEW PANE */
.preview-pane {
  flex: 1;
  background-color: var(--bg-deep);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.preview-toolbar {
  height: 48px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.preview-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.viewport-switch {
  display: flex;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 2px;
}

.viewport-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 3px;
  text-transform: uppercase;
}

.viewport-btn.active {
  background-color: var(--orange);
  color: var(--text-white);
}

.preview-content {
  flex: 1;
  overflow: auto;
  padding: 24px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: radial-gradient(circle, rgba(24,28,32,0.6) 0%, rgba(8,10,11,1) 100%);
}

.preview-iframe-wrapper {
  width: 100%;
  max-width: 640px;
  background-color: #0B0D0E;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.7);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  transition: max-width 0.3s ease;
}

.preview-iframe {
  width: 100%;
  height: calc(100vh - 160px);
  border: none;
  display: block;
}

/* ARCHIVE LIST & ITEMS */
.archive-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 280px;
  overflow-y: auto;
}

.empty-archive {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  padding: 16px;
  border: 1px dashed var(--border-color);
  border-radius: 4px;
}

.archive-item {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.archive-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.archive-title {
  font-size: 12px;
  color: var(--text-white);
}

.archive-date {
  font-size: 10px;
  color: var(--lime);
}

.archive-meta {
  font-size: 10px;
  color: var(--text-muted);
}

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

/* TOAST NOTIFICATION */
.toast-notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background-color: var(--lime);
  color: #000000;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.5px;
  padding: 12px 20px;
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast-notification.show {
  transform: translateY(0);
  opacity: 1;
}

/* SCROLLBARS */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-surface);
}
::-webkit-scrollbar-thumb {
  background: #2D353F;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--orange);
}
