/* ==========================================================================
   Cloudflare Official Design System for vahid.hedyati.ir
   Author: Vahid Hedyati | Senior IT Infrastructure & Automation Engineer
   ========================================================================== */

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

:root {
  /* Cloudflare Brand Colors */
  --cf-orange: #F38020;
  --cf-orange-hover: #E56F10;
  --cf-orange-dark: #D95300;
  --cf-orange-light: #FFF7ED;
  --cf-orange-subtle: rgba(243, 128, 32, 0.08);
  --cf-orange-border: rgba(243, 128, 32, 0.4);
  --cf-orange-glow: 0 10px 30px -5px rgba(243, 128, 32, 0.16), 0 4px 12px -2px rgba(243, 128, 32, 0.08);

  /* Foundations */
  --cf-bg: #FFFFFF;
  --cf-bg-subtle: #F8FAFC;
  --cf-surface: #FFFFFF;
  --cf-card: #FFFFFF;
  --cf-card-inner: #F8FAFC;

  /* Neutral Text & Borders */
  --cf-text-main: #0F172A;
  --cf-text-muted: #334155;
  --cf-text-subtle: #64748B;
  --cf-border: #E2E8F0;
  --cf-border-light: #F1F5F9;

  /* Status Colors */
  --cf-status-online: #10B981;
  --cf-status-online-bg: #ECFDF5;
  --cf-status-offline: #EF4444;
  --cf-status-offline-bg: #FEF2F2;

  /* Radii */
  --cf-radius-lg: 14px;
  --cf-radius-xl: 18px;
  --cf-radius-2xl: 22px;
  --cf-radius-3xl: 28px;
}

/* Persian Font Defaults */
[dir="rtl"] {
  font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.8;
}

/* English / Turkish Font Defaults */
[dir="ltr"] {
  font-family: 'Inter', 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.65;
}

.font-mono, .code-font {
  font-family: 'JetBrains Mono', monospace !important;
}

body {
  background-color: var(--cf-bg);
  color: var(--cf-text-main);
  background-image: 
    radial-gradient(circle at 10% 10%, rgba(243, 128, 32, 0.035) 0%, transparent 40%),
    radial-gradient(circle at 90% 60%, rgba(243, 128, 32, 0.025) 0%, transparent 45%),
    radial-gradient(circle at 50% 95%, rgba(243, 128, 32, 0.02) 0%, transparent 35%);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ==========================================================================
   CLOUDFLARE BENTO CARDS & ORANGE GLOW HOVER EFFECT
   ========================================================================== */
.cf-card, .bento-card {
  background: var(--cf-surface);
  border: 1px solid var(--cf-border);
  border-radius: var(--cf-radius-3xl);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.03), 0 1px 2px -1px rgba(0, 0, 0, 0.03);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.cf-card:hover, .bento-card:hover {
  border-color: var(--cf-orange);
  box-shadow: var(--cf-orange-glow);
  transform: translateY(-2px);
}

/* Sub-cards within Bento Cards */
.bento-subcard {
  background: #F8FAFC;
  border: 1px solid var(--cf-border);
  border-radius: var(--cf-radius-2xl);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.bento-subcard:hover {
  background: #FFFFFF;
  border-color: var(--cf-orange);
  box-shadow: 0 6px 20px -4px rgba(243, 128, 32, 0.12);
  transform: translateY(-1px);
}

/* ==========================================================================
   BUTTONS & CHIPS
   ========================================================================== */
.cf-btn-primary {
  background: linear-gradient(135deg, #F38020 0%, #E56F10 100%);
  color: #FFFFFF !important;
  font-weight: 600;
  border-radius: 14px;
  border: 1px solid rgba(243, 128, 32, 0.35);
  box-shadow: 0 2px 8px rgba(243, 128, 32, 0.25);
  transition: all 0.25s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0.625rem 1.25rem;
}

.cf-btn-primary:hover {
  background: linear-gradient(135deg, #E56F10 0%, #D95300 100%);
  box-shadow: 0 6px 18px rgba(243, 128, 32, 0.35);
  transform: translateY(-1px);
}

.cf-btn-primary:active {
  transform: translateY(0);
}

.cf-btn-secondary {
  background: #FFFFFF;
  color: var(--cf-text-main);
  border: 1px solid var(--cf-border);
  font-weight: 600;
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: all 0.25s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0.625rem 1.25rem;
}

.cf-btn-secondary:hover {
  background: #F8FAFC;
  border-color: var(--cf-orange);
  color: var(--cf-orange);
  box-shadow: 0 4px 12px rgba(243, 128, 32, 0.08);
}

/* Nav Links */
.nav-link {
  color: #475569;
  font-weight: 600;
  padding: 0.625rem 1.125rem;
  border-radius: 9999px;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.nav-link:hover {
  color: var(--cf-orange);
  background: var(--cf-orange-light);
}

.nav-link.active {
  color: #FFFFFF;
  background: var(--cf-orange);
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(243, 128, 32, 0.3);
}

/* Status Indicators */
.status-indicator-online {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: #ECFDF5;
  color: #065F46;
  border: 1px solid #A7F3D0;
  padding: 0.3rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.status-indicator-offline {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: #FEF2F2;
  color: #991B1B;
  border: 1px solid #FECACA;
  padding: 0.3rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.pulse-dot-green {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 0 rgba(16, 185, 129, 0.4);
  animation: pulseGreenLight 2s infinite;
}

@keyframes pulseGreenLight {
  0% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

.pulse-dot-red {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #EF4444;
  box-shadow: 0 0 0 rgba(239, 68, 68, 0.4);
  animation: pulseRedLight 2s infinite;
}

@keyframes pulseRedLight {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

/* Interactive Chips */
.cf-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 600;
  background: #FFFFFF;
  border: 1px solid var(--cf-border);
  color: var(--cf-text-main);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
  white-space: nowrap;
}

.cf-chip:hover {
  background: var(--cf-orange-light);
  border-color: var(--cf-orange);
  color: var(--cf-orange);
  box-shadow: 0 4px 14px rgba(243, 128, 32, 0.12);
  transform: translateY(-1px);
}

/* Modals */
.modal-overlay {
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity 0.25s ease;
}

.modal-content {
  animation: cfModalScale 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  background: #FFFFFF;
  border: 1px solid var(--cf-border);
  color: var(--cf-text-main);
}

@keyframes cfModalScale {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Pin Keypad */
.pin-btn {
  background: #F8FAFC;
  border: 1px solid var(--cf-border);
  color: var(--cf-text-main);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pin-btn:hover {
  background: var(--cf-orange-light);
  border-color: var(--cf-orange);
  color: var(--cf-orange);
}

.pin-btn:active {
  transform: scale(0.94);
  background: var(--cf-orange);
  color: #FFFFFF;
  border-color: var(--cf-orange);
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10001;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: 90%;
  max-width: 420px;
}

.toast {
  pointer-events: auto;
  background: #FFFFFF;
  border: 1px solid var(--cf-orange);
  color: var(--cf-text-main);
  padding: 12px 20px;
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 600;
  box-shadow: 0 12px 30px -5px rgba(0, 0, 0, 0.12), 0 4px 6px -2px rgba(243, 128, 32, 0.1);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Dropzone & Interactive Canvas Elements */
.cf-dropzone {
  border: 2px dashed #CBD5E1;
  background: #F8FAFC;
  border-radius: var(--cf-radius-2xl);
  transition: all 0.25s ease;
  cursor: pointer;
}

.cf-dropzone:hover, .cf-dropzone.dragover {
  border-color: var(--cf-orange);
  background: var(--cf-orange-light);
}

/* Harmonic Color Wheel */
#color-wheel-canvas {
  border-radius: 50%;
  cursor: crosshair;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s ease;
}

#color-wheel-canvas:hover {
  transform: scale(1.02);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: #F1F5F9;
}

::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--cf-orange);
}
