/*
 * Code architect: Mark Bachman
 * Code agents:    Gemini/Antigravity, Mark Bachman
 *
 * CODE DESCRIPTION
 * Client application base styles.
 * Holds global CSS variable overrides and main body document styles.
 * Component-specific styles are encapsulated inside core-app.js.
 *
 * REVISION HISTORY
 * 18 Jun 2026 | style.css created
 * 24 Jun 2026 | Simplified styles to hold global variable definitions
 *
 */

:root {
  --brand-primary: #e4a224;
  --brand-primary-hover: #c88f1e;
  --brand-danger: #b53325;
  --brand-danger-hover: #9a2b1f;
  --app-bg: #0f172a;
  --card-bg: rgba(30, 41, 59, 0.7);
  --input-bg: rgba(15, 23, 42, 0.8);
  --text-white: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: rgba(255, 255, 255, 0.1);
  --glass-border: rgba(255, 255, 255, 0.05);
  --border-radius: 1rem;
  --success: #10b981;

  /* Theme-specific custom elements defaults */
  --nav-bg: rgba(15, 23, 42, 0.85);
  --header-bg: rgba(30, 41, 59, 0.95);
  --button-secondary-bg: rgba(255, 255, 255, 0.05);
  --button-secondary-hover-bg: rgba(255, 255, 255, 0.1);
  --preview-bg: rgba(15, 23, 42, 0.95);
  --code-bg: rgba(0, 0, 0, 0.25);
  --table-th-bg: rgba(255, 255, 255, 0.03);
  --table-zebra-bg: rgba(255, 255, 255, 0.01);
  --dropdown-bg: #1e293b;
  --dropdown-hover-bg: var(--brand-primary);
  --dropdown-hover-text: #000;
  --overlay-bg: rgba(15, 23, 42, 0.9);
}

html.light-mode {
  --brand-primary: #d97706;
  --brand-primary-hover: #b45309;
  --brand-danger: #dc2626;
  --brand-danger-hover: #b91c1c;
  --app-bg: #f8fafc;
  --card-bg: rgba(255, 255, 255, 0.85);
  --input-bg: #ffffff;
  --text-white: #0f172a;
  --text-muted: #475569;
  --border-color: rgba(15, 23, 42, 0.1);
  --glass-border: rgba(15, 23, 42, 0.05);
  --success: #059669;

  --nav-bg: rgba(248, 250, 252, 0.85);
  --header-bg: rgba(241, 245, 249, 0.95);
  --button-secondary-bg: rgba(15, 23, 42, 0.05);
  --button-secondary-hover-bg: rgba(15, 23, 42, 0.08);
  --preview-bg: rgba(255, 255, 255, 0.98);
  --code-bg: rgba(15, 23, 42, 0.05);
  --table-th-bg: rgba(15, 23, 42, 0.03);
  --table-zebra-bg: rgba(15, 23, 42, 0.01);
  --dropdown-bg: #ffffff;
  --dropdown-hover-bg: var(--brand-primary);
  --dropdown-hover-text: #ffffff;
  --overlay-bg: rgba(15, 23, 42, 0.5);
}

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

body {
  font-family: 'Raleway', sans-serif;
  background-color: var(--app-bg);
  background-image:
    radial-gradient(circle at 10% 20%, rgba(228, 162, 36, 0.1) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(181, 51, 37, 0.1) 0%, transparent 40%);
  color: var(--text-white);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* --- Navigation --- */
nav {
  min-height: 4.5rem;
  height: auto;
  display: flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  width: 100%;
}

.nav-content {
  display: flex;
  flex-flow: row wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  position: relative;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  justify-content: flex-end;
  flex-flow: row wrap;
}

.search-container {
  max-width: 250px;
  width: 100%;
  position: relative;
  display: flex;
  align-items: center;
}

.search-container input {
  width: 100%;
  padding: 0.5rem 3.25rem 0.5rem 0.75rem;
  font-size: 0.9rem;
}

.search-container input::-webkit-search-cancel-button {
  margin-right: 1.4rem;
  cursor: pointer;
}

.search-help-btn {
  position: absolute;
  right: 0.45rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: all 0.2s ease;
  z-index: 10;
}

.search-help-btn:hover {
  background: var(--brand-primary);
  color: var(--app-bg);
  border-color: var(--brand-primary);
}

.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--dropdown-bg);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  margin-top: 0.25rem;
  z-index: 150;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.search-dropdown-item {
  padding: 0.6rem 1rem;
  cursor: pointer;
  font-family: 'Raleway', sans-serif;
  font-size: 0.9rem;
  color: var(--text-white);
  transition: all 0.2s ease;
}

.search-dropdown-item:hover {
  background-color: var(--dropdown-hover-bg);
  color: var(--dropdown-hover-text);
}

.table-select-container select {
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  max-width: 200px;
}

.nav-buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-white);
  padding: 0.6rem;
  border-radius: 0.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

@media (max-width: 767px) {
  .nav-content {
    flex-direction: column;
    align-items: stretch;
  }
  .logo-section {
    justify-content: space-between;
    width: 100%;
  }
  .nav-controls {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    margin-top: 0.25rem;
  }
  .search-container {
    max-width: none;
    width: 100%;
  }
  .table-select-container select {
    max-width: none;
    width: 100%;
  }
  .nav-buttons {
    justify-content: flex-end;
    width: 100%;
  }
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-container svg,
.logo-container img {
  height: 32px;
  filter: drop-shadow(0 0 8px rgba(228, 162, 36, 0.3));
}

.logo-text {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* --- Main Layout --- */
main {
  flex: 1;
  padding: 1.25rem 1rem;
}

.sub-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.sub-nav-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.sub-nav-subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* --- Cards --- */
.card {
  background-color: var(--card-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius);
  padding: 2.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
}

/* --- Forms --- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
}

input:not([type="radio"]):not([type="checkbox"]),
select,
textarea {
  font-family: 'Consolas', monospace;
  background-color: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  color: var(--text-white);
  font-size: 1rem;
  transition: all 0.2s ease;
}

input:not([type="radio"]):not([type="checkbox"]):focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(228, 162, 36, 0.1);
}

/* Custom checkbox styles to replace browser default white with grey when unchecked */
input[type="checkbox"]:not(.toggle-switch input) {
  appearance: none;
  -webkit-appearance: none;
  background-color: rgba(148, 163, 184, 0.1); /* grey translucent background */
  border: 1px solid rgba(148, 163, 184, 0.4); /* grey border */
  border-radius: 0.25rem;
  width: 1.1rem;
  height: 1.1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  vertical-align: middle;
  position: relative;
  outline: none;
}

input[type="checkbox"]:not(.toggle-switch input):hover {
  border-color: #ffffff;
  background-color: rgba(148, 163, 184, 0.2);
}

input[type="checkbox"]:not(.toggle-switch input):checked {
  background-color: #ffffff;
  border-color: #ffffff;
}

input[type="checkbox"]:not(.toggle-switch input):checked::after {
  content: "";
  position: absolute;
  left: 0.3rem;
  top: 0.1rem;
  width: 0.35rem;
  height: 0.6rem;
  border: solid var(--app-bg);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

input[type="checkbox"]:not(.toggle-switch input):focus-visible {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

/* Custom radio styles to replace browser default white with grey when unchecked and white when checked */
input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  background-color: rgba(148, 163, 184, 0.1); /* grey translucent background */
  border: 1px solid rgba(148, 163, 184, 0.4); /* grey border */
  border-radius: 50%;
  width: 1.1rem;
  height: 1.1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  vertical-align: middle;
  position: relative;
  outline: none;
}

input[type="radio"]:hover {
  border-color: #ffffff;
  background-color: rgba(148, 163, 184, 0.2);
}

input[type="radio"]:checked {
  background-color: #ffffff;
  border-color: #ffffff;
}

input[type="radio"]:checked::after {
  content: "";
  position: absolute;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background-color: var(--app-bg);
}

input[type="radio"]:focus-visible {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}


/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 2.3rem;
  height: 1.3rem;
  margin: 0;
}

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

.toggle-switch .slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(148, 163, 184, 0.2);
  transition: .3s;
  border-radius: 1.3rem;
  border: 1px solid rgba(148, 163, 184, 0.4);
}

.toggle-switch .slider:before {
  position: absolute;
  content: "";
  height: 0.8rem;
  width: 0.8rem;
  left: 0.15rem;
  bottom: 0.15rem;
  background-color: var(--text-muted);
  transition: .3s;
  border-radius: 50%;
}

.toggle-switch input:checked + .slider {
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
}

.toggle-switch input:checked + .slider:before {
  transform: translateX(1rem);
  background-color: var(--app-bg);
}

/* --- Buttons --- */
.btn {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  padding: 1rem 2rem;
  border-radius: 0.75rem;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 1rem;
}

.btn-primary {
  background-color: var(--brand-primary);
  color: #000;
  box-shadow: 0 4px 12px rgba(228, 162, 36, 0.2);
}

.btn-primary:hover {
  background-color: var(--brand-primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(228, 162, 36, 0.3);
}

.btn-danger {
  background-color: var(--brand-danger);
  color: white;
}

.btn-danger:hover {
  background-color: var(--brand-danger-hover);
  transform: translateY(-2px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-white);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
}

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

/* --- Modals --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--overlay-bg);
  backdrop-filter: blur(8px);
  display: none;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  z-index: 1000;
}

.modal {
  background: var(--app-bg);
  border: none;
  border-radius: 0;
  width: 100%;
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  transition: all 0.2s;
  font-size: 1.5rem;
  line-height: 1;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.05);
  color: white;
}

.modal-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.modal-footer {
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

@media (min-width: 768px) {
  .modal-overlay {
    align-items: center;
    justify-content: center;
    padding: 2rem;
  }
  
  .modal {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    max-width: 900px;
    height: auto;
    max-height: 90vh;
  }
}

/* --- Loading State --- */
.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(228, 162, 36, 0.1);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* --- Helper Utility --- */
.hidden {
  display: none !important;
}

.badge {
  font-size: 0.875rem;
  padding: 0.25rem 0.75rem;
  border-radius: 2rem;
  background: rgba(228, 162, 36, 0.1);
  border: 1px solid var(--brand-primary);
  color: var(--brand-primary);
  margin-left: 0.5rem;
  vertical-align: middle;
  font-weight: 600;
}

/* --- Small Spinner --- */
.spinner-small {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(228, 162, 36, 0.1);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  position: absolute;
  left: 100%;
  margin-left: 0.75rem;
}

/* --- Stacked Records List Layout --- */
.records-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 1.5rem;
}

.record-card {
  width: 90%;
  height: 70px;
  background-color: var(--card-bg);
  border: 1px solid var(--glass-border);
  border-radius: 0.375rem;
  display: flex;
  align-items: flex-start;
  padding: 0.6rem 1rem 0 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
}

.record-card:hover {
  transform: translateY(-6px);
  background-color: var(--button-secondary-hover-bg, rgba(255, 255, 255, 0.1));
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

html.light-mode .record-card:hover {
  background-color: rgba(15, 23, 42, 0.05);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.record-card-content {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  width: 100%;
  height: 100%;
}

.record-title-text {
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-white);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
  line-height: 1.2;
}

.record-desc-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
  margin-top: 0.05rem;
  line-height: 1.2;
}

@media (max-width: 767px) {
  .record-card {
    width: 100%;
  }
}

/* --- Notice Boxes (standards) --- */
.note {
  background: rgba(56, 189, 248, 0.1);
  border-left: 4px solid #38bdf8;
  padding: 1rem;
  border-radius: 0.25rem;
  margin-bottom: 1.5rem;
}

.note h4 {
  color: #38bdf8;
  margin-bottom: 0.5rem;
}

.warning {
  background: rgba(228, 162, 36, 0.1);
  border-left: 4px solid var(--brand-primary);
  padding: 1rem;
  border-radius: 0.25rem;
  margin-bottom: 1.5rem;
}

.warning strong {
  color: var(--brand-primary);
}

/* --- Modal Footer Button Customizations --- */
.modal-footer .btn {
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
  border-radius: 0.5rem;
}

.modal-footer .btn-nav-arrow {
  padding: 0.5rem 0.75rem;
  background: rgba(228, 162, 36, 0.1);
  border: 1px solid rgba(228, 162, 36, 0.2);
  color: var(--brand-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.modal-footer .btn-nav-arrow:hover:not(:disabled) {
  background: var(--brand-primary);
  color: #000;
  box-shadow: 0 0 10px rgba(228, 162, 36, 0.4);
  transform: translateY(-1px);
}

.modal-footer .btn-nav-arrow:disabled {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  opacity: 0.3;
  transform: none !important;
}

/* --- Specific console styles --- */
.console-container {
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 1rem;
  font-family: 'Consolas', monospace;
  font-size: 0.875rem;
  max-height: 250px;
  overflow-y: auto;
  margin-top: 1rem;
}
.console-entry {
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px dashed rgba(255,255,255,0.05);
}
.console-route {
  color: var(--brand-primary);
  font-weight: bold;
}
.console-payload {
  color: var(--text-muted);
  margin-left: 1rem;
}
.console-response {
  color: var(--success);
  margin-left: 1rem;
}
.console-response.error {
  color: var(--brand-danger);
}
.results-table-container {
  overflow-x: auto;
  margin-top: 1.5rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
}
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'Consolas', monospace;
  font-size: 0.9rem;
}
table.data-table th, table.data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}
table.data-table th {
  background-color: var(--table-th-bg);
  color: var(--brand-primary);
  font-weight: 600;
}
table.data-table tr:hover {
  background-color: var(--table-zebra-bg);
}
.panel-section {
  margin-bottom: 2rem;
}
.json-textarea {
  font-family: 'Consolas', monospace;
  width: 100%;
  min-height: 120px;
  resize: vertical;
}
.sync-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: bold;
  font-family: 'Raleway', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.sync-badge.pending {
  background-color: rgba(228, 162, 36, 0.2);
  color: var(--brand-primary);
  border: 1px solid rgba(228, 162, 36, 0.4);
}
.sync-badge.synced {
  background-color: rgba(16, 185, 129, 0.2);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.4);
}

body.modal-open {
  overflow: hidden;
}

/* --- Tooltip styling --- */
.tooltip-container {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: help;
}

.tooltip-container::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(30, 30, 30, 0.95);
  border: 1px solid var(--border-color);
  color: var(--text-white);
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  width: 220px;
  text-align: center;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease-in-out;
}

.tooltip-container:hover::after {
  opacity: 1;
}

/* --- Theme overrides for specific elements in Light Mode --- */
html.light-mode input[type="checkbox"]:not(.toggle-switch input):checked {
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
}
html.light-mode input[type="checkbox"]:not(.toggle-switch input):checked::after {
  border-color: #ffffff;
}
html.light-mode input[type="radio"]:checked {
  background-color: var(--brand-primary);
  border-color: var(--brand-primary);
}
html.light-mode input[type="radio"]:checked::after {
  background-color: #ffffff;
}
html.light-mode .btn-primary {
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.2);
}
html.light-mode .btn-primary:hover {
  box-shadow: 0 8px 24px rgba(217, 119, 6, 0.3);
}
html.light-mode .tooltip-container::after {
  background-color: rgba(255, 255, 255, 0.98);
  color: var(--text-white);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* --- Markdown Box Layout & Theme rules --- */
.markdown-box-container {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  background-color: var(--input-bg);
  overflow: hidden;
  box-sizing: border-box;
}

.markdown-box-header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0.4rem 0.6rem;
  background-color: var(--header-bg);
  border-bottom: 1px solid var(--border-color);
  font-size: 0.8rem;
  user-select: none;
  flex-shrink: 0;
}

.markdown-box-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: var(--button-secondary-bg);
  color: var(--brand-primary);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  outline: none;
  transition: all 0.2s;
}

.markdown-box-toggle:hover {
  background-color: var(--button-secondary-hover-bg);
}

.markdown-box-textarea {
  width: 100%;
  flex-grow: 1;
  flex-shrink: 1;
  padding: 0.75rem;
  border: none;
  outline: none;
  resize: none;
  font-family: 'Consolas', monospace;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-white);
  background-color: transparent;
  box-sizing: border-box;
  display: block;
}

.markdown-box-preview {
  width: 100%;
  flex-grow: 1;
  flex-shrink: 1;
  padding: 0.75rem;
  background-color: var(--preview-bg);
  color: var(--text-white);
  overflow-y: auto;
  box-sizing: border-box;
  display: none;
}

/* --- Premium Markdown Render Styling (.markdown-body) --- */
.markdown-body {
  line-height: 1.6;
  font-size: 0.9rem;
}

.markdown-body h1, 
.markdown-body h2, 
.markdown-body h3, 
.markdown-body h4 {
  font-family: 'Outfit', sans-serif;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--text-white);
  font-weight: 600;
}

.markdown-body h1 {
  font-size: 1.4rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.3rem;
  margin-top: 0.5rem;
}

.markdown-body h2 {
  font-size: 1.2rem;
  border-bottom: 1px dashed var(--border-color);
  padding-bottom: 0.2rem;
}

.markdown-body h3 {
  font-size: 1.05rem;
}

.markdown-body p {
  margin-bottom: 0.85rem;
  font-size: 0.9rem;
}

.markdown-body ul, 
.markdown-body ol {
  margin-bottom: 0.85rem;
  padding-left: 1.5rem;
}

.markdown-body li {
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
}

.markdown-body ul {
  list-style-type: disc;
}

.markdown-body ol {
  list-style-type: decimal;
}

.markdown-body pre {
  background: var(--code-bg);
  border: 1px solid var(--border-color);
  border-radius: 0.375rem;
  padding: 0.75rem;
  overflow-x: auto;
  margin-bottom: 0.85rem;
}

.markdown-body pre code {
  background: transparent;
  padding: 0;
  font-size: 0.85rem;
  border-radius: 0;
  color: inherit;
}

.markdown-body code {
  font-family: 'Consolas', monospace;
  font-size: 0.85rem;
  background: var(--code-bg);
  color: var(--brand-primary);
  padding: 0.15rem 0.3rem;
  border-radius: 0.25rem;
}

.markdown-body blockquote {
  border-left: 4px solid var(--brand-primary);
  padding-left: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
  font-style: italic;
  background: rgba(228, 162, 36, 0.03);
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
}

.markdown-body a {
  color: var(--brand-primary);
  text-decoration: none;
  font-weight: 600;
}

.markdown-body a:hover {
  text-decoration: underline;
  color: var(--brand-primary-hover);
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0.85rem;
  font-size: 0.85rem;
}

.markdown-body th, 
.markdown-body td {
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.6rem;
  text-align: left;
}

.markdown-body th {
  background: var(--table-th-bg);
  color: var(--brand-primary);
}

.markdown-body tr:nth-child(even) {
  background: var(--table-zebra-bg);
}

/* --- Settings Modal Layout --- */
.settings-row {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

@media (min-width: 768px), (orientation: landscape) {
  .settings-row {
    flex-direction: row;
  }
  .settings-row > .form-group {
    flex: 1;
    margin-bottom: 0 !important;
  }
}

/* --- External Action Modal Mobile Full-Viewport Layout --- */
.action-modal-content {
  width: 90vw;
  max-width: 1100px;
  height: 85vh;
  display: flex;
  flex-direction: column;
}

@media (max-width: 768px) {
  #action-modal .modal,
  .action-modal-content {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    margin: 0 !important;
    border-radius: 0 !important;
  }

  #action-modal .modal-header {
    padding: 0.75rem 1rem !important;
    border-radius: 0 !important;
  }
}

/* --- Actions Dropdown Solid Non-Translucent Menu --- */
#actions-dropdown-menu {
  min-width: 320px !important;
  background-color: var(--dropdown-bg) !important;
  opacity: 1 !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4) !important;
}


