@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
  --bg-dark: #07090e;
  --bg-card: rgba(18, 24, 38, 0.7);
  --bg-glass: rgba(255, 255, 255, 0.04);
  --border-glass: rgba(255, 255, 255, 0.1);
  --accent-primary: #6366f1;
  --accent-secondary: #a855f7;
  --accent-cyan: #06b6d4;
  --accent-danger: #ef4444;
  --accent-success: #10b981;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --font-arabic: 'Cairo', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --safe-area-top: env(safe-area-inset-top, 0px);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-arabic);
  direction: rtl;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  overflow-x: hidden;
  position: relative;
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(168, 85, 247, 0.15) 0%, transparent 40%);
  padding-top: var(--safe-area-top);
  padding-bottom: var(--safe-area-bottom);
}

/* Glassmorphism Card Utility */
.glass-panel {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

/* iOS Standalone Requirement Screen */
.pwa-guard-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(7, 9, 14, 0.96);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 24px;
  text-align: center;
}

.pwa-guard-icon {
  width: 96px;
  height: 96px;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  box-shadow: 0 0 40px rgba(99, 102, 241, 0.5);
  margin-bottom: 24px;
  animation: pulseGlow 3s infinite alternate;
}

@keyframes pulseGlow {
  0% { transform: scale(1); box-shadow: 0 0 30px rgba(99, 102, 241, 0.4); }
  100% { transform: scale(1.05); box-shadow: 0 0 60px rgba(168, 85, 247, 0.7); }
}

.pwa-guard-title {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 12px;
  background: linear-gradient(90deg, #fff, #c7d2fe);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.pwa-guard-desc {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 320px;
  margin-bottom: 32px;
}

.pwa-steps-list {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pwa-step-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  text-align: right;
}

.step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-primary);
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-text {
  font-size: 14px;
  color: #e2e8f0;
}

.step-icon-ios {
  font-size: 20px;
  margin-right: auto;
}

/* Application Container */
#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 16px;
}

/* PIN Screen */
.pin-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.pin-header {
  text-align: center;
  margin-bottom: 36px;
}

.pin-logo {
  font-size: 52px;
  margin-bottom: 12px;
  filter: drop-shadow(0 0 20px rgba(99, 102, 241, 0.6));
}

.pin-title {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 6px;
}

.pin-subtitle {
  font-size: 14px;
  color: var(--text-muted);
}

.pin-dots {
  display: flex;
  gap: 14px;
  margin-bottom: 40px;
  direction: ltr;
}

.pin-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.pin-dot.filled {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  box-shadow: 0 0 16px var(--accent-primary);
  transform: scale(1.15);
}

.pin-dot.shake {
  animation: shake 0.4s ease-in-out;
  border-color: var(--accent-danger);
  background: var(--accent-danger);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

/* Numpad Keyboard */
.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  width: 100%;
  max-width: 320px;
  direction: ltr;
}

.num-btn {
  height: 72px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  color: #fff;
  font-size: 26px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  backdrop-filter: blur(10px);
}

.num-btn:active {
  background: rgba(99, 102, 241, 0.4);
  transform: scale(0.92);
}

.num-btn.num-action {
  font-size: 20px;
  background: transparent;
  border: none;
  color: var(--text-muted);
}

.num-btn.num-action:active {
  color: #fff;
}

/* Main Dashboard Header */
.dash-header {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.pc-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pc-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.pc-name {
  font-weight: 800;
  font-size: 16px;
}

.pc-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--accent-success);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-success);
  box-shadow: 0 0 10px var(--accent-success);
  animation: blink 2s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.timer-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.timer-label {
  font-size: 11px;
  color: var(--text-muted);
}

.timer-value {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--accent-cyan);
}

/* Navigation Tabs */
.nav-tabs {
  display: flex;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  padding: 6px;
  margin-bottom: 20px;
  gap: 4px;
  backdrop-filter: blur(15px);
}

.tab-btn {
  flex: 1;
  padding: 10px 4px;
  border-radius: 14px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-arabic);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: var(--accent-primary);
  color: #fff;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.tab-icon {
  font-size: 18px;
}

/* Tab Views Container */
.tab-content {
  display: none;
  flex-direction: column;
  gap: 16px;
}

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

/* Quick Control Cards Grid */
.controls-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.ctrl-card {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-radius: 20px;
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-group {
  display: flex;
  gap: 8px;
}

.btn-ctrl {
  flex: 1;
  height: 48px;
  border-radius: 14px;
  border: 1px solid var(--border-glass);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-family: var(--font-arabic);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-ctrl:active {
  transform: scale(0.95);
  background: rgba(255, 255, 255, 0.15);
}

.btn-ctrl.danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.btn-ctrl.danger:active {
  background: var(--accent-danger);
  color: #fff;
}

/* Trackpad View */
.trackpad-area {
  height: 340px;
  border-radius: 24px;
  background: radial-gradient(circle at center, rgba(99, 102, 241, 0.08) 0%, transparent 70%), rgba(15, 23, 42, 0.6);
  border: 2px stroke var(--border-glass);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  touch-action: none;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.5);
}

.trackpad-hint {
  font-size: 13px;
  color: var(--text-muted);
  pointer-events: none;
  opacity: 0.6;
}

.trackpad-buttons {
  display: flex;
  gap: 12px;
  width: 100%;
}

.tp-btn {
  flex: 1;
  height: 54px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-glass);
  color: #fff;
  font-weight: 700;
  font-family: var(--font-arabic);
}

/* Live Screen View */
.screen-wrapper {
  position: relative;
  width: 100%;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--border-glass);
  background: #000;
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
}

.screen-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.screen-placeholder {
  color: var(--text-muted);
  font-size: 14px;
}

/* System Stats List */
.stats-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-glass);
}

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

.stat-val {
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--accent-cyan);
}

/* Terminal Input */
.terminal-card {
  padding: 16px;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.terminal-input-group {
  display: flex;
  gap: 8px;
  direction: ltr;
}

.term-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 12px 14px;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 13px;
  outline: none;
}

.term-output {
  background: #000;
  border-radius: 14px;
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: #34d399;
  max-height: 160px;
  overflow-y: auto;
  direction: ltr;
  white-space: pre-wrap;
}

/* Input Forms */
.input-field {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  padding: 14px;
  color: #fff;
  font-family: var(--font-arabic);
  font-size: 14px;
  direction: ltr;
  outline: none;
}

.input-field:focus {
  border-color: var(--accent-primary);
}
