:root {
  --fc-bg: #0f172a;
  --fc-panel: #111827;
  --fc-accent: var(--primary-color);
  --fc-accent-2: var(--dark-primary-color);
  --fc-text: #e5e7eb;
  --fc-muted: #9ca3af;
  --fc-danger: #ef4444;
  --fc-shadow: 0 10px 20px rgba(0,0,0,.20);
  --radius-xl: 18px;
  --radius: 14px;
}

body { font-family: "Cairo", sans-serif; }

/* ===== زر التشغيل (FAB) ===== */
.fc-fab {
  position: fixed;
  inset-inline-end: 18px;
  inset-block-end: 25px;
  width: 58px; height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--fc-accent), var(--fc-accent-2));
  color: #fff; display: grid; place-items: center;
  cursor: pointer; z-index: 9999; box-shadow: var(--fc-shadow);
  transition: transform 0.25s ease;
}
.fc-fab svg { width: 28px; height: 28px; }
.fc-fab:active { transform: scale(0.88); } /* انيميشن ضغط */

/* ===== Overlay ===== */
.fc-overlay {
  position: fixed; inset: 0;
  background: rgba(2,6,23,.55);
  display: none; z-index: 9998; backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.35s ease;
}
.fc-overlay.show {
  display: block;
  opacity: 1;
}

/* ===== Panel (الحاسبة) ===== */
.fc-panel {
  position: fixed; inset-inline: 0;
  background: linear-gradient(180deg, #0b1224, #0a0f1f);
  color: var(--fc-text);
  box-shadow: var(--fc-shadow);
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
  z-index: 10000;
  bottom: 0; margin-inline: auto; width: min(680px, 96vw);

  /* أنيميشن الفتح/القفل */
  transform: translateY(100%);
  opacity: 0;
  transition: transform 0.35s ease, opacity 0.35s ease;
  pointer-events: none;
}
.fc-panel.show {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 768px) {
  .fc-panel { width: 100vw; height: 90vh; border-radius: 0; }
  .fc-panel-inner { height: 100%; display: grid; grid-template-rows: auto 1fr auto; }
}

/* ===== Header ===== */
.fc-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; background: rgba(255,255,255,.02);
}

/* ===== Display ===== */
.fc-display {
  padding: 12px 16px; text-align: end; direction: ltr;
  display: grid; gap: 6px; background: rgba(2,6,23,.45);
  border-radius: 12px; margin: 12px;
}
.fc-expression { font-size: 20px; color: var(--fc-muted); min-height: 20px; }
.fc-result { font-size: clamp(28px, 5vw, 48px); font-weight: 800; }

/* ===== Keypad ===== */
.fc-keypad {
  display: grid; gap: 10px; padding: 12px; grid-template-columns: repeat(4, 1fr);
}
.fc-key {
  border: 0; border-radius: 14px; padding: 14px 10px;
  font-size: 17px; font-weight: 700; cursor: pointer;
  background: #0e152c; color: var(--fc-text);
  transition: transform 0.1s ease, background 0.2s ease;
}
.fc-key:hover { background: #121a34; }
.fc-key:active { transform: scale(0.95); }

.fc-key.op { background: #13203f; }
.fc-key.eq { background: linear-gradient(135deg, var(--fc-accent), var(--fc-accent-2)); color: #001b0a; }
.fc-key.util { background: #2a1320; }
.fc-key.danger { background: #3b0c0c; }

/* ===== Footer ===== */
.fc-footer {
  padding: 10px 12px; color: var(--fc-muted);
  border-top: 1px solid rgba(148,163,184,.12);
  font-size: 13px;
}

/* ===== الوضع الداكن ===== */
body[data-layout-mode="dark"] .fc-panel {
  background: linear-gradient(180deg, #111827, #0f172a);
  color: #f3f4f6;
}
body[data-layout-mode="dark"] .fc-key {
  background: #1f2937;
  color: #f9fafb;
}
body[data-layout-mode="dark"] .fc-key.op {
  background: #374151;
}
body[data-layout-mode="dark"] .fc-key.eq {
  background: linear-gradient(135deg, var(--fc-accent), var(--fc-accent-2));
  color: #111;
}
body[data-layout-mode="dark"] .fc-overlay {
  background: rgba(0,0,0,.65);
}
