/* ==================== COMPONENTS.CSS ==================== */
/* Reusable component styles including buttons, cards, toggles, tooltips, panels, and animations */

/* Page Hero Section */
.page-hero {
  position: relative;
  padding: 50px 0 40px;
  margin: -35px -40px 40px;
  border-radius: 24px;
  overflow: hidden;
  background: linear-gradient(135deg, #0a1628 0%, #0f2744 100%);
}

.page-hero.dashboard-hero {
  background: linear-gradient(135deg, #0a1628 0%, #0f2744 50%, #0d1e36 100%);
}

.hero-bg-effects {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  overflow: hidden;
}

.hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
}

.hero-orb.orb-1 {
  width: 300px;
  height: 300px;
  background: var(--cyan);
  opacity: 0.15;
  top: -100px;
  right: 10%;
  animation: heroOrbFloat 10s ease-in-out infinite;
}

.hero-orb.orb-2 {
  width: 200px;
  height: 200px;
  background: var(--purple);
  opacity: 0.1;
  bottom: -50px;
  left: 20%;
  animation: heroOrbFloat 10s ease-in-out infinite reverse;
}

@keyframes heroOrbFloat {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(20px, -20px); }
}

.hero-grid {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 40px 40px;
}

.page-hero .dashboard-header {
  position: relative;
  z-index: 2;
  padding: 0 40px;
  margin-bottom: 0;
}

.page-hero .dashboard-header::after {
  display: none;
}

.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  background: rgba(0, 188, 212, 0.15);
  border: 1px solid rgba(0, 188, 212, 0.3);
  border-radius: 50px;
  color: var(--cyan);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 20px;
}

.header-badge i {
  font-size: 1rem;
}

.page-hero .dashboard-header h2 {
  color: var(--white);
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.page-hero .dashboard-header p {
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.1rem;
  max-width: 600px;
}

.page-hero .dashboard-header-actions {
  margin-top: 25px;
}

.page-hero .last-updated {
  color: rgba(255, 255, 255, 0.6);
}

.page-hero .last-updated strong {
  color: var(--cyan-light);
}

.page-hero .btn-refresh {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--white);
}

.page-hero .btn-refresh:hover {
  background: var(--cyan);
  border-color: var(--cyan);
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, var(--cyan-dark) 0%, var(--cyan) 100%);
  color: var(--white);
  border: none;
  border-radius: 10px;
  padding: 12px 24px;
  font-family: 'Cairo', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(0, 180, 216, 0.3);
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 180, 216, 0.4);
  background: linear-gradient(135deg, var(--cyan) 0%, var(--teal) 100%);
}

.btn-primary.small {
  padding: 8px 16px;
  font-size: 0.8rem;
}

.btn-refresh {
  background: var(--white);
  border: 1px solid var(--gray-200);
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--navy);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
}

.btn-refresh:hover {
  background: var(--cyan);
  color: var(--white);
  border-color: var(--cyan);
}

/* Card Styles */
.stat-card {
  background: var(--white);
  border-radius: 18px;
  padding: 30px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: 20px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(0, 180, 216, 0.08);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, var(--cyan), var(--teal));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.stat-card:nth-child(1)::before {
  background: linear-gradient(180deg, var(--cyan), var(--cyan-light));
}

.stat-card:nth-child(2)::before {
  background: linear-gradient(180deg, var(--teal), var(--teal-light));
}

.stat-card:nth-child(3)::before {
  background: linear-gradient(180deg, var(--purple), var(--purple-light));
}

.stat-card:nth-child(4)::before {
  background: linear-gradient(180deg, var(--orange), var(--orange-light));
}

.stat-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 50px rgba(0, 45, 66, 0.12);
  border-color: transparent;
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.stat-card:hover .stat-icon {
  transform: scale(1.1) rotate(-5deg);
}

.stat-icon.projects { 
  background: linear-gradient(135deg, var(--cyan-dark) 0%, var(--cyan) 100%);
  color: var(--white);
  box-shadow: 0 10px 25px rgba(0, 180, 216, 0.35);
}
.stat-icon.surveys { 
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-light) 100%);
  color: var(--white);
  box-shadow: 0 10px 25px rgba(0, 191, 166, 0.35);
}
.stat-icon.clients { 
  background: linear-gradient(135deg, var(--purple) 0%, var(--purple-light) 100%);
  color: var(--white);
  box-shadow: 0 10px 25px rgba(124, 58, 237, 0.35);
}
.stat-icon.area { 
  background: linear-gradient(135deg, var(--orange) 0%, var(--orange-light) 100%);
  color: var(--white);
  box-shadow: 0 10px 25px rgba(245, 158, 11, 0.35);
}

.stat-info {
  flex: 1;
}

.stat-info h3 {
  font-family: 'Cairo', sans-serif;
  font-size: 2.4rem;
  color: var(--navy);
  margin-bottom: 4px;
  font-weight: 600;
  line-height: 1;
}

.stat-info p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Chart Card */
.chart-card {
  background: var(--white);
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 5px 25px rgba(0, 45, 66, 0.06);
  border: 1px solid rgba(0, 180, 216, 0.08);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.chart-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--cyan), var(--teal), var(--gold));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
}

.chart-card:hover {
  box-shadow: 0 20px 50px rgba(0, 45, 66, 0.12);
  transform: translateY(-5px);
  border-color: rgba(0, 180, 216, 0.2);
}

.chart-card:hover::before {
  transform: scaleX(1);
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gray-200);
  transition: 0.3s;
  border-radius: 24px;
}

.toggle-slider::before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: var(--white);
  transition: 0.3s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--cyan);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
}

/* Draggable Panels */
.draggable-panel {
  cursor: default;
  user-select: none;
  transition: box-shadow 0.2s ease, transform 0.1s ease;
}

.draggable-panel .panel-header,
.draggable-panel .layer-panel-header,
.draggable-panel .legend-header,
.draggable-panel .feature-panel-header {
  cursor: grab;
  position: relative;
}

.draggable-panel .panel-header:active,
.draggable-panel .layer-panel-header:active,
.draggable-panel .legend-header:active,
.draggable-panel .feature-panel-header:active {
  cursor: grabbing;
}

.draggable-panel.dragging {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3) !important;
  transform: scale(1.02);
  z-index: 1000 !important;
  opacity: 0.95;
}

.draggable-panel .drag-icon {
  position: absolute;
  left: 50%;
  top: 4px;
  transform: translateX(-50%);
  width: 40px;
  height: 4px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 2px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.draggable-panel:hover .drag-icon {
  opacity: 1;
}

/* Drag tooltip on first hover */
.draggable-panel::after {
  content: 'Drag header to move';
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy);
  color: white;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 0.7rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.draggable-panel:hover::after {
  opacity: 0;
}

.draggable-panel.first-hover::after {
  opacity: 1;
  animation: fadeOutTooltip 3s ease forwards;
}

@keyframes fadeOutTooltip {
  0%, 70% { opacity: 1; }
  100% { opacity: 0; }
}

/* General Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 180, 216, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(0, 180, 216, 0); }
}

/* Stat Trends */
.stat-trend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  margin-top: 8px;
  padding: 4px 8px;
  border-radius: 20px;
  font-weight: 500;
}

.stat-trend.positive {
  background: rgba(16, 185, 129, 0.1);
  color: var(--green);
}

.stat-trend.negative {
  background: rgba(239, 68, 68, 0.1);
  color: var(--red);
}

.stat-trend.neutral {
  background: rgba(156, 163, 175, 0.1);
  color: var(--text-secondary);
}

/* Project Items */
.project-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 12px;
  border-bottom: 1px solid var(--gray-100);
  transition: all 0.3s ease;
  border-radius: 10px;
  margin-bottom: 4px;
}

.project-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.project-item:hover {
  padding-left: 16px;
  background: linear-gradient(90deg, rgba(0, 180, 216, 0.05), transparent);
}

.project-status {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.05);
}

.project-status.active { background: var(--green); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2); }
.project-status.pending { background: var(--orange); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2); }
.project-status.completed { background: var(--cyan); box-shadow: 0 0 0 3px rgba(0, 180, 216, 0.2); }

.project-details {
  flex: 1;
}

.project-details h4 {
  color: var(--navy);
  font-size: 0.95rem;
  margin-bottom: 4px;
  font-weight: 600;
}

.project-details p {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.project-type {
  font-size: 0.7rem;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--off-white);
  color: var(--text-secondary);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Active button state */
.animate-btn.active {
  background: var(--cyan);
  color: var(--white);
  animation: pulse 1s infinite;
}
