/* ============================================================
   VOLTRA / VOO SMART MOBILE APP DESIGN SYSTEM
   Exact Match to Mobile Screenshots (Emerald Green & Pure White)
   ============================================================ */

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

:root {
  /* Colors from Screenshots */
  --color-primary: #15803d; /* Vibrant Emerald Green */
  --color-primary-light: #edf7ed; /* Soft Mint Green for Active Cards & Buttons */
  --color-primary-border: #86efac;
  --color-primary-hover: #166534;
  --color-primary-glow: rgba(21, 128, 61, 0.15);

  --bg-app: #f4f6f9; /* Mobile App Light Background */
  --bg-card: #ffffff; /* Crisp White Card */
  --bg-subtle: #f8fafc;
  --bg-outlet-inactive: #f8fafc;
  --bg-outlet-active: #edf7ed;

  --border-card: #e2e8f0;
  --border-subtle: #edf2f7;
  --border-active: #15803d;

  --text-main: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-green: #15803d;

  --color-danger: #ef4444;
  --color-warning: #f59e0b;

  /* Typography */
  --font-arabic: 'Alexandria', 'Cairo', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Radius */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-pill: 9999px;

  /* Shadows */
  --shadow-card: 0 2px 10px rgba(0, 0, 0, 0.03), 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-float: 0 10px 25px -5px rgba(21, 128, 61, 0.3);
}

/* Dark Mode Theme */
[data-theme="dark"] {
  --bg-app: #0b111e;
  --bg-card: #151e2e;
  --bg-subtle: #1c2738;
  --bg-outlet-inactive: #1a2332;
  --bg-outlet-active: rgba(21, 128, 61, 0.2);

  --border-card: #253347;
  --border-subtle: #1e293b;
  --border-active: #22c55e;

  --text-main: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --text-green: #4ade80;
  --color-primary-light: rgba(21, 128, 61, 0.25);
  --color-primary-border: rgba(74, 222, 128, 0.4);
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-arabic);
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  direction: rtl;
  text-align: right;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

/* Mobile Frame Container */
.mobile-app-wrapper {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background-color: var(--bg-app);
  position: relative;
  box-shadow: 0 0 50px rgba(0,0,0,0.06);
  padding-bottom: 90px;
}

/* App Header Top Bar */
.mobile-header {
  padding: 1.25rem 1.25rem 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.mobile-header-title-wrap {
  display: flex;
  flex-direction: column;
}

.mobile-header-subtitle {
  font-size: 0.8rem;
  color: var(--text-green);
  font-weight: 600;
  letter-spacing: 0.2px;
}

.mobile-header-title {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.mobile-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-card);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.header-icon-btn:active {
  transform: scale(0.92);
  background: var(--bg-subtle);
}

/* User Account Profile Card */
.user-account-card {
  margin: 0.75rem 1.25rem;
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform 0.2s;
}

.user-account-card:active {
  transform: scale(0.98);
}

.user-account-info {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.user-avatar-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #16a34a;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 1px;
}

.user-meta-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.user-meta-email {
  font-size: 0.8rem;
  color: var(--text-muted);
  direction: ltr;
  text-align: right;
  font-family: var(--font-arabic);
}

.user-card-arrow {
  color: var(--text-muted);
  font-size: 1.1rem;
}

/* Total Power Live Banner Card */
.total-power-card {
  margin: 0.5rem 1.25rem 1rem;
  padding: 1.25rem 1.25rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.total-power-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #10b981, #22c55e, #10b981);
}

.total-power-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.total-power-value {
  font-size: 3rem;
  font-weight: 800;
  color: var(--text-green);
  line-height: 1;
  font-family: var(--font-arabic);
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.4rem;
}

.total-power-unit {
  font-size: 1.5rem;
  font-weight: 700;
}

.total-power-substats {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.substat-dot {
  color: var(--text-muted);
  font-size: 0.5rem;
}

/* 4 Quick Actions Grid */
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  margin: 0 1.25rem 1rem;
}

.quick-action-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  padding: 0.85rem 0.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: all 0.2s;
  text-decoration: none;
}

.quick-action-btn:active {
  transform: scale(0.94);
  background: var(--bg-subtle);
}

.quick-action-icon-wrap {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #f0fdf4;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: #16a34a;
}

[data-theme="dark"] .quick-action-icon-wrap {
  background: rgba(22, 163, 74, 0.18);
  color: #4ade80;
}

.quick-action-label {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
}

/* Search Bar */
.search-container {
  margin: 0 1.25rem 1.25rem;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 0.85rem 2.8rem 0.85rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  font-size: 0.9rem;
  color: var(--text-main);
  outline: none;
  box-shadow: var(--shadow-card);
  transition: border-color 0.2s;
}

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

.search-icon {
  position: absolute;
  top: 50%;
  right: 1.1rem;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.1rem;
  pointer-events: none;
}

/* Strip Card (بطاقة الشريحة الرئيسية) */
.strip-card {
  margin: 0 1.25rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1.25rem;
  position: relative;
}

.strip-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.strip-identity {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.strip-status-badge {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

[data-theme="dark"] .strip-status-badge {
  background: rgba(22, 163, 74, 0.2);
  border-color: rgba(74, 222, 128, 0.3);
  color: #4ade80;
}

.strip-mac {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  letter-spacing: 0.5px;
}

.strip-gear-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 50%;
  transition: transform 0.2s;
}

.strip-gear-btn:active {
  transform: rotate(45deg);
}

.strip-subinfo {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.strip-live-w {
  color: var(--text-green);
  font-weight: 700;
}

/* 4 Outlets Grid (2x2) */
.outlets-grid-2x2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.outlet-box {
  border-radius: var(--radius-lg);
  padding: 1rem 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 125px;
  position: relative;
  border: 1px solid var(--border-card);
  background: var(--bg-outlet-inactive);
}

.outlet-box:active {
  transform: scale(0.96);
}

/* Active Outlet State */
.outlet-box.active {
  background: var(--bg-outlet-active);
  border-color: var(--color-primary-border);
  box-shadow: 0 4px 15px var(--color-primary-glow);
}

/* Outlet Socket Icon */
.socket-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}

.socket-pin {
  width: 4px;
  height: 12px;
  border-radius: 2px;
  background: #94a3b8;
  transition: all 0.2s;
}

.outlet-box.active .socket-icon {
  border-color: #16a34a;
  background: #ffffff;
}

.outlet-box.active .socket-pin {
  background: #16a34a;
}

.outlet-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.outlet-substatus {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.outlet-box.active .outlet-substatus {
  color: var(--text-green);
}

/* Master Power Controls */
.master-controls-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.btn-master-off {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  color: var(--text-secondary);
  padding: 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-master-off:active {
  background: #fee2e2;
  color: #dc2626;
}

.btn-master-on {
  background: var(--color-primary-light);
  border: 1px solid var(--color-primary-border);
  color: var(--color-primary);
  padding: 0.85rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-master-on:active {
  background: #16a34a;
  color: #ffffff;
}

/* Floating Action Button (+ إضافة شريحة) */
.fab-add-strip {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: #16a34a;
  color: #ffffff;
  border: none;
  padding: 0.85rem 1.6rem;
  border-radius: var(--radius-pill);
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  box-shadow: var(--shadow-float);
  z-index: 100;
  transition: transform 0.2s, background 0.2s;
}

.fab-add-strip:active {
  transform: scale(0.94);
  background: #15803d;
}

/* ============================================================
   SCREEN 2: إعدادات الشريحة وأدواتها (DEVICE SETTINGS)
   ============================================================ */
.settings-view {
  padding: 1.25rem;
}

.settings-header {
  margin-bottom: 1.5rem;
}

.settings-strip-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

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

.settings-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  margin: 1.25rem 0 0.6rem;
  text-transform: uppercase;
}

.settings-list-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  margin-bottom: 1rem;
}

.settings-item-row {
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background 0.15s;
}

.settings-item-row:last-child {
  border-bottom: none;
}

.settings-item-row:active {
  background: var(--bg-subtle);
}

.settings-item-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.settings-item-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: #f0fdf4;
  color: #16a34a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

[data-theme="dark"] .settings-item-icon {
  background: rgba(22, 163, 74, 0.18);
  color: #4ade80;
}

.settings-item-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}

.settings-item-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ============================================================
   SCREEN 3: الجدولة والمؤقتات (جدول جديد - SCHEDULING FORM)
   ============================================================ */
.schedule-form-view {
  padding: 1.25rem;
}

.form-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.form-header-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-main);
}

.form-header-category {
  font-size: 0.8rem;
  color: var(--text-green);
  font-weight: 600;
}

.btn-back-arrow {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-card);
  background: var(--bg-card);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.form-card-block {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-card);
}

.field-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  display: block;
}

.form-select-styled, .form-input-styled {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-card);
  background: var(--bg-subtle);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  outline: none;
  margin-bottom: 1rem;
}

.form-select-styled:focus, .form-input-styled:focus {
  border-color: var(--color-primary);
}

/* 2-Pills Toggle */
.pills-toggle-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.pill-btn {
  padding: 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-card);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}

.pill-btn.active {
  background: var(--color-primary-light);
  border-color: var(--color-primary-border);
  color: var(--color-primary);
}

/* 7 Days Selector */
.days-selector-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.day-pill {
  padding: 0.65rem 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-card);
  background: var(--bg-subtle);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-align: center;
  cursor: pointer;
}

.day-pill.selected {
  background: var(--color-primary-light);
  border-color: var(--color-primary-border);
  color: var(--color-primary);
}

.time-picker-row {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  border: 1px solid var(--border-card);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.time-input-clock {
  font-size: 1.25rem;
  font-weight: 800;
  border: none;
  background: none;
  outline: none;
  font-family: var(--font-arabic);
}

/* Full Width Sticky Green Save Button */
.btn-save-sticky {
  width: 100%;
  padding: 1rem;
  background: #16a34a;
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 1.1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(22, 163, 74, 0.3);
  transition: background 0.2s;
}

.btn-save-sticky:active {
  background: #15803d;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 999;
}

.modal-bottom-sheet {
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 1.5rem;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
  animation: slideUp 0.25s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* Toast */
.toast-container {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  color: var(--text-main);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-pill);
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  border: 1px solid var(--border-card);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.9rem;
  font-weight: 600;
}
