/* ==============================================================================
   Main Dashboard Layout, Controls & Component Styles
   ============================================================================== */

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

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* App Container */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ==============================================================================
   Top Control Bar
   ============================================================================== */
.top-bar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  gap: 16px;
  z-index: 100;
  position: relative;
  border-bottom: 1px solid var(--surface-glass-border);
}

/* Brand Section */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #00d2ff 0%, #9d4edd 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 210, 255, 0.3);
}

.brand-logo svg {
  width: 20px;
  height: 20px;
  fill: #fff;
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, #fff 0%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Center Section: Omnibox & Quick Presets */
.nav-center {
  flex: 1;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.omnibox-form {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.omnibox-wrapper {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.omnibox-icon {
  position: absolute;
  left: 14px;
  color: var(--text-dim);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.omnibox-input {
  width: 100%;
  height: 38px;
  border-radius: var(--radius-md);
  padding: 0 14px 0 40px;
  font-size: 13px;
  font-family: var(--font-mono);
}

.btn-go {
  height: 38px;
  padding: 0 18px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-blue) 100%);
  border: none;
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
}

.btn-go:hover {
  opacity: 0.92;
  box-shadow: 0 2px 10px rgba(0, 210, 255, 0.35);
}

.quick-presets {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 2px;
}

.preset-chip {
  font-size: 11px;
  color: var(--text-muted);
  padding: 2px 8px;
  cursor: pointer;
}

.preset-chip:hover {
  color: var(--accent-cyan);
  background: rgba(0, 210, 255, 0.1);
  border-color: rgba(0, 210, 255, 0.3);
}

/* Right Section: Device Controls & System Status */
.controls-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.device-switcher {
  display: flex;
  background: rgba(0, 0, 0, 0.4);
  padding: 3px;
  border-radius: var(--radius-md);
  border: 1px solid var(--surface-glass-border);
  gap: 2px;
}

.device-tab {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
  border: none;
  background: transparent;
}

.device-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.device-tab.active {
  color: #fff;
  background: var(--surface-glass-active);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.device-tab svg {
  width: 14px;
  height: 14px;
}

/* Action Icon Buttons */
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--surface-glass-border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.icon-btn.active {
  background: rgba(0, 210, 255, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* Live Resource Pill */
.status-widget {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  font-size: 12px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
}

.stat-val {
  color: var(--text-main);
  font-weight: 600;
}

/* Power Control Button */
.btn-power {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
}

.btn-power.btn-stop {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.btn-power.btn-stop:hover {
  background: rgba(239, 68, 68, 0.25);
}

.btn-power.btn-start {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.3);
  color: #34d399;
}

.btn-power.btn-start:hover {
  background: rgba(16, 185, 129, 0.25);
}

/* ==============================================================================
   Authentication Modal
   ============================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.hidden {
  display: none;
}

.login-card {
  width: 100%;
  max-width: 420px;
  border-radius: var(--radius-lg);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.login-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.login-title {
  font-size: 20px;
  font-weight: 700;
}

.login-desc {
  font-size: 13px;
  color: var(--text-muted);
}

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

.form-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.form-input {
  height: 42px;
  border-radius: var(--radius-md);
  padding: 0 14px;
  font-size: 14px;
}

.btn-login {
  height: 44px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-blue) 100%);
  color: #fff;
  border: none;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-login:hover {
  opacity: 0.9;
  box-shadow: var(--glow-cyan);
}

.login-hint {
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.4;
  background: rgba(255, 255, 255, 0.03);
  padding: 8px;
  border-radius: var(--radius-sm);
}

/* ==============================================================================
   Toast Notifications
   ============================================================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.toast.success {
  background: #064e3b;
  border: 1px solid #059669;
  color: #a7f3d0;
}

.toast.error {
  background: #7f1d1d;
  border: 1px solid #dc2626;
  color: #fecaca;
}

.toast.info {
  background: #1e293b;
  border: 1px solid #334155;
  color: #e2e8f0;
}

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

/* RTL Support */
[dir="rtl"] {
  direction: rtl;
  text-align: right;
}

[dir="rtl"] .omnibox-input {
  padding: 0 40px 0 14px;
}

[dir="rtl"] .omnibox-icon {
  left: auto;
  right: 14px;
}

[dir="rtl"] .toast-container {
  right: auto;
  left: 24px;
}
