/* 
 * Muninn Gruvbox Theme Stylesheet
 * Retro-premium developer portal with flat-design accents and shadows.
 */

:root {
  /* Fonts */
  --font-sans: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Theme Transitions */
  --transition-speed: 0.25s;

  /* Theme Tokens - Dark Mode (Default) */
  --bg-hard: #1d2021;
  --bg-medium: #282828;
  --bg-soft: #32302f;
  --bg-element: #3c3836;
  --bg-hover: #504945;
  
  --fg-primary: #ebdbb2;
  --fg-secondary: #a89984;
  --fg-muted: #7c6f64;

  --red: #cc241d;
  --green: #98971a;
  --yellow: #d79921;
  --blue: #458588;
  --purple: #b16286;
  --aqua: #689d6a;
  --orange: #d65d0e;

  /* Border and Shadow Colors */
  --border-color: #504945;
  --shadow-color: #1d2021;
}

[data-theme="light"] {
  /* Theme Tokens - Light Mode */
  --bg-hard: #f9f5d7;
  --bg-medium: #fbf1c7;
  --bg-soft: #f2e5bc;
  --bg-element: #ebdbb2;
  --bg-hover: #d5c4a1;
  
  --fg-primary: #282828;
  --fg-secondary: #7c6f64;
  --fg-muted: #a89984;

  --red: #9d0006;
  --green: #79740e;
  --yellow: #b57614;
  --blue: #076678;
  --purple: #8f3f71;
  --aqua: #427b58;
  --orange: #af3a03;

  --border-color: #d5c4a1;
  --shadow-color: #ebdbb2;
}

/* Reset and Core Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-medium);
  color: var(--fg-primary);
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
  display: flex;
  transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg-primary);
}

a {
  color: var(--blue);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--orange);
  text-decoration: underline;
}

code, pre, .mono-text {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* Main Layout */
.sidebar {
  width: 280px;
  background-color: var(--bg-hard);
  border-right: 3px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 24px;
  overflow-y: auto;
  flex-shrink: 0;
}

.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-medium);
}

.top-bar {
  height: 70px;
  border-bottom: 3px solid var(--border-color);
  background-color: var(--bg-hard);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  flex-shrink: 0;
}

.content-body {
  flex-grow: 1;
  padding: 32px;
  overflow-y: auto;
  position: relative;
}

/* Sidebar Styling */
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 32px;
  font-family: var(--font-mono);
  color: var(--orange);
}

.logo i {
  color: var(--yellow);
}

.logo img {
  height: 36px;
  width: auto;
  border-radius: 6px;
  border: 2px solid var(--border-color);
}

.nav-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: auto;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 6px;
  color: var(--fg-secondary);
  font-weight: 600;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.nav-item.active a, .nav-item a:hover {
  background-color: var(--bg-soft);
  color: var(--fg-primary);
  border-color: var(--border-color);
  text-decoration: none;
}

.nav-item.active a {
  border-left: 4px solid var(--orange);
}

.nav-item i {
  width: 20px;
  font-size: 16px;
  text-align: center;
}

/* Theme Switch & Session Styling */
.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
}

.theme-toggle-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  color: var(--fg-secondary);
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-element);
  transition: .4s;
  border-radius: 34px;
  border: 2px solid var(--border-color);
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: var(--fg-primary);
  transition: .4s;
  border-radius: 50%;
}

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

input:checked + .slider:before {
  transform: translateX(24px);
}

.agent-status-card {
  background-color: var(--bg-soft);
  border: 2px solid var(--border-color);
  padding: 12px;
  border-radius: 6px;
  font-size: 13px;
}

.agent-status-header {
  font-weight: 700;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--fg-muted);
  display: inline-block;
}

.status-dot.active {
  background-color: var(--green);
  box-shadow: 0 0 8px var(--green);
}

/* Top Bar Details */
.search-wrapper {
  position: relative;
  width: 320px;
}

.search-wrapper i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--fg-secondary);
}

.search-input {
  width: 100%;
  background-color: var(--bg-soft);
  border: 2px solid var(--border-color);
  color: var(--fg-primary);
  padding: 10px 16px 10px 40px;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease;
}

.search-input:focus {
  border-color: var(--orange);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border-color);
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-weight: 700;
  font-size: 14px;
}

.user-role {
  font-size: 11px;
  color: var(--fg-secondary);
}

.btn-icon {
  background: none;
  border: 2px solid var(--border-color);
  color: var(--fg-primary);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  background-color: var(--bg-soft);
}

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

/* Dashboard Widgets / Cards */
.grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.card {
  background-color: var(--bg-hard);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 4px 4px 0px var(--shadow-color);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0px var(--shadow-color);
}

.card-accent-red { border-top: 5px solid var(--red); }
.card-accent-green { border-top: 5px solid var(--green); }
.card-accent-yellow { border-top: 5px solid var(--yellow); }
.card-accent-blue { border-top: 5px solid var(--blue); }
.card-accent-orange { border-top: 5px solid var(--orange); }

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--fg-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-value {
  font-size: 36px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--fg-primary);
  line-height: 1.1;
}

.card-desc {
  font-size: 13px;
  color: var(--fg-muted);
  margin-top: 6px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background-color: var(--bg-element);
  border: 2px solid var(--border-color);
  color: var(--fg-primary);
  padding: 10px 20px;
  font-weight: 700;
  font-family: var(--font-sans);
  font-size: 14px;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 2px 2px 0px var(--shadow-color);
  transition: all 0.15s ease;
}

.btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0px var(--shadow-color);
  background-color: var(--bg-hover);
}

.btn:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0px var(--shadow-color);
}

.btn-primary {
  background-color: var(--orange);
  border-color: var(--border-color);
  color: #fbf1c7; /* always light text on orange for readable contrast */
}

.btn-primary:hover {
  background-color: var(--bg-hover);
  color: var(--fg-primary);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 4px;
}

/* Lists and Tables */
.table-container {
  background-color: var(--bg-hard);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 4px 4px 0px var(--shadow-color);
  overflow: hidden;
  margin-bottom: 32px;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th, td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-color);
}

th {
  background-color: var(--bg-soft);
  font-weight: 700;
  color: var(--fg-secondary);
  font-family: var(--font-mono);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background-color: var(--bg-soft);
}

/* Badges and States */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
  text-transform: uppercase;
  border: 1px solid transparent;
}

.badge-success { background-color: rgba(152, 151, 26, 0.15); color: var(--green); border-color: var(--green); }
.badge-danger { background-color: rgba(204, 36, 29, 0.15); color: var(--red); border-color: var(--red); }
.badge-warning { background-color: rgba(215, 153, 33, 0.15); color: var(--yellow); border-color: var(--yellow); }
.badge-info { background-color: rgba(69, 133, 136, 0.15); color: var(--blue); border-color: var(--blue); }
.badge-neutral { background-color: rgba(168, 153, 132, 0.15); color: var(--fg-secondary); border-color: var(--border-color); }

/* Forms / Fields */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--fg-secondary);
}

.form-control {
  width: 100%;
  background-color: var(--bg-soft);
  border: 2px solid var(--border-color);
  color: var(--fg-primary);
  padding: 12px 16px;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease;
}

.form-control:focus {
  border-color: var(--orange);
}

/* Page Section Transition (View management) */
.view-section {
  display: none;
}

.view-section.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-hard);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-element);
  border-radius: 4px;
  border: 2px solid var(--bg-hard);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--fg-muted);
}

/* Utility classes */
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-align { display: flex; align-items: center; gap: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-4 { margin-top: 16px; }
.gap-4 { gap: 16px; }
.text-right { text-align: right; }

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(29, 32, 33, 0.75);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

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

.modal {
  background-color: var(--bg-hard);
  border: 3px solid var(--border-color);
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  padding: 32px;
  box-shadow: 8px 8px 0px var(--shadow-color);
  position: relative;
  animation: modalSlide 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlide {
  from { transform: scale(0.95) translateY(10px); opacity: 0; }
  to { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--fg-secondary);
  cursor: pointer;
}

.modal-close:hover {
  color: var(--red);
}

/* Setup/Auth Section Banner */
.auth-panel {
  max-width: 600px;
  margin: 80px auto;
  text-align: center;
}

.auth-panel i.auth-logo {
  font-size: 64px;
  color: var(--orange);
  margin-bottom: 24px;
}

/* Security scan table specific styling */
.scan-severity-critical { color: var(--red); font-weight: bold; }
.scan-severity-high { color: var(--orange); font-weight: bold; }
.scan-severity-medium { color: var(--yellow); }
.scan-severity-low { color: var(--blue); }
