/* ==========================================================================
   FATIMA AUTOMATION - INTERACTIVE SVG & CANVAS ANIMATIONS
   Core Feature: Animations that illustrate the engineering & automation itself.
   Strict 60fps, GPU-accelerated transforms/opacity, prefers-reduced-motion friendly.
   ========================================================================== */

/* --------------------------------------------------------------------------
   General Animation Canvas & Controls
   -------------------------------------------------------------------------- */
.fatima-animation-stage {
  position: relative;
  width: 100%;
  background: #0a1a26;
  border: 1px solid var(--fatima-hairline-dark);
  padding: 32px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
}

.fatima-stage-controls {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
  z-index: 20;
}

.fatima-stage-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  padding: 6px 12px;
  font-size: 0.75rem;
  font-family: var(--font-heading);
  font-weight: 600;
  cursor: pointer;
  border-radius: 0;
  transition: all var(--transition-fast);
}

.fatima-stage-btn:hover, .fatima-stage-btn.is-active {
  background: var(--fatima-red);
  border-color: var(--fatima-red);
  color: #ffffff;
}

/* --------------------------------------------------------------------------
   1. Hero Villa Wakeup Animation
   -------------------------------------------------------------------------- */
.villa-scene {
  width: 100%;
  max-width: 580px;
  margin: 0 auto;
}

.villa-wireframe {
  stroke: rgba(255, 255, 255, 0.35);
  stroke-width: 1.5;
  fill: none;
}

/* Pulsing Electric Fence Line on Boundary Wall */
.fence-pulse-path {
  stroke: #ff3131;
  stroke-width: 2.5;
  stroke-dasharray: 8 16;
  animation: fencePulse 1.8s linear infinite;
  filter: drop-shadow(0 0 6px #ff3131);
}

@keyframes fencePulse {
  0% { stroke-dashoffset: 48; }
  100% { stroke-dashoffset: 0; }
}

/* Gate Sliding Open & Closed */
.villa-sliding-gate {
  transition: transform 1.6s cubic-bezier(0.22, 1, 0.36, 1);
  transform: translateX(0);
}

.villa-scene.gate-open .villa-sliding-gate {
  transform: translateX(78px);
}

/* Interior Lights Room-by-Room Activation */
.room-light {
  opacity: 0.08;
  transition: opacity 0.8s ease, fill 0.8s ease;
  fill: #ffeaa7;
}

.room-light.is-lit {
  opacity: 0.85;
  filter: drop-shadow(0 0 12px rgba(255, 234, 167, 0.6));
}

/* Curtains Parting */
.villa-curtain-left {
  transition: transform 1.2s ease;
}
.villa-curtain-right {
  transition: transform 1.2s ease;
}
.villa-scene.curtains-open .villa-curtain-left {
  transform: scaleX(0.25);
  transform-origin: left;
}
.villa-scene.curtains-open .villa-curtain-right {
  transform: scaleX(0.25);
  transform-origin: right;
}

/* Smart Lock Aura */
.villa-lock-glow {
  opacity: 0.4;
  fill: #00cec9;
  transition: all 0.5s ease;
}
.villa-scene.lock-unlocked .villa-lock-glow {
  fill: #2ecc71;
  opacity: 1;
  filter: drop-shadow(0 0 8px #2ecc71);
}

/* --------------------------------------------------------------------------
   2. Interactive Touch Switch Panel & Live Room Simulation
   -------------------------------------------------------------------------- */
.switch-demo-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  align-items: center;
}

@media (min-width: 860px) {
  .switch-demo-container {
    grid-template-columns: 320px 1fr 260px;
  }
}

/* Touch Glass Plate */
.touch-panel-glass {
  background: linear-gradient(145deg, #182029, #0d1218);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), inset 0 1px 1px rgba(255, 255, 255, 0.2);
  padding: 30px 24px;
  border-radius: 4px;
}

.touch-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.touch-button {
  background: #0d151e;
  border: 1px solid rgba(255, 255, 255, 0.08);
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
  user-select: none;
}

.touch-button:hover {
  border-color: rgba(255, 255, 255, 0.25);
}

.touch-icon {
  width: 28px;
  height: 28px;
  color: rgba(255, 255, 255, 0.35);
  transition: all 0.25s ease;
}

.touch-label {
  font-family: var(--font-heading);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  font-weight: 600;
}

/* Active Touch Button Glowing Ring */
.touch-button.is-on {
  border-color: #00cec9;
  background: radial-gradient(circle at center, rgba(0, 206, 201, 0.15), transparent 70%);
}

.touch-button.is-on .touch-icon {
  color: #00cec9;
  filter: drop-shadow(0 0 6px rgba(0, 206, 201, 0.8));
}

.touch-button.is-on .touch-label {
  color: #ffffff;
}

.touch-button.is-on.touch-danger {
  border-color: var(--fatima-red);
}
.touch-button.is-on.touch-danger .touch-icon {
  color: var(--fatima-red);
  filter: drop-shadow(0 0 6px var(--fatima-red));
}

/* Simulated Room Scene */
.room-sim-box {
  background: #081119;
  border: 1px solid var(--fatima-hairline-dark);
  padding: 30px;
  position: relative;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.lamp-fixture {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: #1a2530;
  transition: all 0.4s ease;
  margin: 0 auto;
}

.room-sim-box.lamp-active .lamp-fixture {
  background: #ffd32a;
  box-shadow: 0 0 45px 15px rgba(255, 211, 42, 0.45);
}

.fan-fixture {
  width: 60px;
  height: 60px;
  margin: 0 auto;
}

.fan-blades {
  transform-origin: center;
  transition: transform 0.2s linear;
}

.room-sim-box.fan-active .fan-blades {
  animation: fanSpin 0.4s linear infinite;
}

@keyframes fanSpin {
  100% { transform: rotate(360deg); }
}

.ac-fixture {
  position: relative;
  width: 140px;
  height: 40px;
  background: #1e2a38;
  border: 1px solid rgba(255, 255, 255, 0.2);
  margin: 0 auto;
}

.ac-airflow {
  opacity: 0;
  transition: opacity 0.3s;
}

.room-sim-box.ac-active .ac-airflow {
  opacity: 1;
  animation: airflowWave 1.2s ease-in-out infinite;
}

@keyframes airflowWave {
  0% { transform: translateY(0); opacity: 0.3; }
  50% { transform: translateY(8px); opacity: 0.9; }
  100% { transform: translateY(16px); opacity: 0; }
}

/* Phone App Mock Sync */
.phone-mock-sync {
  background: #04090e;
  border: 3px solid #233142;
  border-radius: 24px;
  padding: 16px 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}

.phone-mock-screen {
  background: #0a141e;
  border-radius: 14px;
  padding: 14px 10px;
}

.phone-app-header {
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.phone-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.8);
}

.phone-switch-pill {
  width: 28px;
  height: 16px;
  background: #334354;
  border-radius: 10px;
  position: relative;
  transition: background 0.25s;
}

.phone-switch-pill::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.25s;
}

.phone-switch-pill.is-on {
  background: var(--fatima-red);
}

.phone-switch-pill.is-on::after {
  transform: translateX(12px);
}

/* --------------------------------------------------------------------------
   3. Curtains & Blinds Scroll Demo
   -------------------------------------------------------------------------- */
.curtains-stage {
  position: relative;
  height: 380px;
  background: #111e2a;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.window-frame {
  position: absolute;
  width: 82%;
  height: 82%;
  border: 8px solid #2d3b48;
  background: linear-gradient(180deg, #87ceeb 0%, #e0f7fa 100%);
  transition: background 0.8s ease;
  overflow: hidden;
}

.curtains-stage.mode-night .window-frame {
  background: linear-gradient(180deg, #070d18 0%, #162438 100%);
}

.curtain-fabric-left, .curtain-fabric-right {
  position: absolute;
  top: 0;
  height: 100%;
  width: 50%;
  background: linear-gradient(90deg, #3a2e2b 0%, #52423e 50%, #3a2e2b 100%);
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.curtain-fabric-left {
  left: 0;
  transform-origin: left;
}

.curtain-fabric-right {
  right: 0;
  transform-origin: right;
}

.roller-blind-fabric {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #f1ebd9;
  border-bottom: 6px solid #b8a688;
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  transform: translateY(-85%);
}

.curtain-slider-control {
  margin-top: 18px;
  width: 100%;
  accent-color: var(--fatima-red);
}

/* --------------------------------------------------------------------------
   4. Smart Door Lock Sequence
   -------------------------------------------------------------------------- */
.lock-stage {
  max-width: 380px;
  margin: 0 auto;
  background: #091119;
  border: 1px solid var(--fatima-hairline-dark);
  padding: 30px;
  text-align: center;
}

.lock-body {
  width: 120px;
  height: 240px;
  background: linear-gradient(180deg, #1b2531 0%, #0c1218 100%);
  border: 2px solid #2d3b48;
  border-radius: 12px;
  margin: 0 auto 20px;
  padding: 20px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.5);
}

.lock-fingerprint-sensor {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid #00cec9;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
}

.lock-fingerprint-sensor.scanning::after {
  content: "";
  position: absolute;
  inset: -6px;
  border: 2px solid #2ecc71;
  border-radius: 50%;
  animation: sensorPing 1s infinite;
}

@keyframes sensorPing {
  0% { transform: scale(0.9); opacity: 1; }
  100% { transform: scale(1.4); opacity: 0; }
}

.lock-keypad-mini {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: 70px;
}

.keypad-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
}

.keypad-dot.lit {
  background: #00cec9;
  box-shadow: 0 0 6px #00cec9;
}

.lock-bolt {
  width: 24px;
  height: 12px;
  background: #bdc3c7;
  border-radius: 2px;
  margin-top: 10px;
  transition: transform 0.4s ease;
}

.lock-stage.unlocked .lock-bolt {
  transform: translateX(-16px);
  background: #2ecc71;
}

.lock-status-badge {
  font-family: var(--font-heading);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #e74c3c;
  padding: 6px 14px;
  border: 1px solid rgba(231, 76, 60, 0.3);
  display: inline-block;
  margin-top: 8px;
}

.lock-stage.unlocked .lock-status-badge {
  color: #2ecc71;
  border-color: rgba(46, 204, 113, 0.3);
}

/* --------------------------------------------------------------------------
   5. Gate Automation Simulation
   -------------------------------------------------------------------------- */
.gate-sim-box {
  width: 100%;
  height: 240px;
  background: #081119;
  border: 1px solid var(--fatima-hairline-dark);
  position: relative;
  overflow: hidden;
}

.gate-beam-sensor {
  position: absolute;
  top: 160px;
  left: 20px;
  right: 20px;
  height: 2px;
  background: rgba(255, 49, 49, 0.35);
  box-shadow: 0 0 8px var(--fatima-red);
}

.gate-beam-sensor::before, .gate-beam-sensor::after {
  content: "";
  position: absolute;
  top: -6px;
  width: 6px;
  height: 14px;
  background: #ff3131;
}
.gate-beam-sensor::before { left: 0; }
.gate-beam-sensor::after { right: 0; }

/* --------------------------------------------------------------------------
   6. Electric Fencing Pulse & Breach Notification
   -------------------------------------------------------------------------- */
.fence-stage {
  position: relative;
  background: #09131c;
  border: 1px solid var(--fatima-hairline-dark);
  padding: 30px;
  overflow: hidden;
}

.fence-breach-notification {
  position: absolute;
  bottom: 24px;
  right: 24px;
  background: rgba(192, 41, 43, 0.95);
  color: #ffffff;
  padding: 12px 18px;
  border-left: 4px solid #ff7675;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  transform: translateY(120%);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s;
  z-index: 30;
  max-width: 320px;
}

.fence-stage.breached .fence-breach-notification {
  transform: translateY(0);
  opacity: 1;
}

.breach-title {
  font-family: var(--font-heading);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.breach-body {
  font-size: 0.75rem;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.9);
}

/* --------------------------------------------------------------------------
   7. Swing Gate Articulated Arm & Dual Leaf Simulation
   -------------------------------------------------------------------------- */
.swing-stage {
  position: relative;
  background: #09131c;
  border: 1px solid var(--fatima-hairline-dark);
  padding: 30px 20px 24px;
  overflow: hidden;
}

.swing-stage-arena {
  width: 100%;
  max-width: 580px;
  height: 240px;
  margin: 0 auto;
  position: relative;
  background: radial-gradient(circle at 50% 30%, #162434 0%, #081119 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  overflow: hidden;
}

.swing-driveway-grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 24px 24px;
}

.swing-pillar {
  position: absolute;
  top: 36px;
  width: 32px;
  height: 32px;
  background: #2c3e50;
  border: 2px solid #7f8c8d;
  border-radius: 4px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 700;
  color: #bdc3c7;
}
.swing-pillar-left { left: 45px; }
.swing-pillar-right { right: 45px; }

.swing-motor-box {
  position: absolute;
  top: 72px;
  width: 22px;
  height: 22px;
  background: #c0392b;
  border-radius: 3px;
  border: 1px solid #e74c3c;
  z-index: 11;
  box-shadow: 0 0 8px rgba(231, 76, 60, 0.4);
}
.swing-motor-box-left { left: 20px; }
.swing-motor-box-right { right: 20px; }

.swing-gate-leaf {
  position: absolute;
  top: 50px;
  height: 6px;
  background: linear-gradient(180deg, #ecf0f1, #95a5a6);
  border-radius: 3px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.7);
  transition: transform 1.8s cubic-bezier(0.2, 0.9, 0.3, 1);
  z-index: 8;
}
.swing-leaf-left {
  left: 77px;
  width: calc(50% - 78px);
  transform-origin: 0% 50%;
  transform: rotate(0deg);
}
.swing-leaf-right {
  right: 77px;
  width: calc(50% - 78px);
  transform-origin: 100% 50%;
  transform: rotate(0deg);
}

.swing-stage.gate-open .swing-leaf-left {
  transform: rotate(-84deg);
}
.swing-stage.gate-open .swing-leaf-right {
  transform: rotate(84deg);
}

.swing-arm {
  position: absolute;
  top: 76px;
  height: 3px;
  background: #e67e22;
  transition: transform 1.8s cubic-bezier(0.2, 0.9, 0.3, 1);
  z-index: 9;
}
.swing-arm-left {
  left: 42px;
  width: 65px;
  transform-origin: 0% 50%;
  transform: rotate(20deg);
}
.swing-arm-right {
  right: 42px;
  width: 65px;
  transform-origin: 100% 50%;
  transform: rotate(-20deg);
}
.swing-stage.gate-open .swing-arm-left {
  transform: rotate(-45deg);
}
.swing-stage.gate-open .swing-arm-right {
  transform: rotate(45deg);
}

.swing-safety-beam {
  position: absolute;
  top: 170px;
  left: 45px;
  right: 45px;
  height: 2px;
  background: rgba(46, 204, 113, 0.45);
  box-shadow: 0 0 8px #2ecc71;
  transition: background 0.3s;
}
.swing-safety-beam::before, .swing-safety-beam::after {
  content: "";
  position: absolute;
  top: -5px;
  width: 5px;
  height: 12px;
  background: #2ecc71;
  border-radius: 1px;
}
.swing-safety-beam::before { left: 0; }
.swing-safety-beam::after { right: 0; }
