<template>
  <div class="glass-dashboard">
    <!-- Ultra-Modern Hero Header -->
    <div class="hero-header">
      <!-- Animated background -->
      <div class="hero-gradient"></div>
      <div class="hero-overlay"></div>
      
      <!-- Floating elements -->
      <div class="floating-orb orb-1"></div>
      <div class="floating-orb orb-2"></div>
      <div class="floating-orb orb-3"></div>
      
      <!-- Mesh gradient overlay -->
      <div class="mesh-overlay"></div>
      
      <div class="hero-content">
        <div class="hero-inner">
          <!-- User Info -->
          <div class="user-section">
            <div class="avatar-wrapper">
              <!-- Avatar glow -->
              <div class="avatar-glow"></div>
              
              <div class="avatar-container">
                <div class="avatar">
                  <span class="avatar-text">JD</span>
                </div>
                
                <!-- Status indicator -->
                <div class="status-indicator">
                  <div class="status-dot"></div>
                </div>
                
                <!-- Crown icon -->
                <div class="crown-badge">
                  👑
                </div>
              </div>
            </div>
            
            <div class="user-info">
              <h1 class="welcome-title">
                Welcome back,
                <span class="name-gradient">Board Member!</span>
              </h1>
              
              <div class="user-meta">
                <div class="role-badge">
                  <span class="sparkle">✨</span>
                  <span class="role-text">Administrator</span>
                </div>
                
                <div class="divider"></div>
                
                <span class="org-name">MonacoUSA Association</span>
              </div>
            </div>
          </div>
          
          <!-- Date & Quick Actions -->
          <div class="actions-section">
            <!-- Date Card -->
            <div class="date-card">
              <div class="date-header">
                <span class="calendar-icon">📅</span>
                <p class="date-label">Today</p>
              </div>
              <p class="date-text">
                {{ currentDate }}
              </p>
              <div class="date-progress">
                <div class="progress-fill"></div>
              </div>
            </div>
            
            <!-- Quick Actions -->
            <div class="quick-actions">
              <button class="action-btn action-alerts">
                <span class="action-icon">🔔</span>
                <span class="action-text">Alerts</span>
              </button>
              
              <button class="action-btn action-primary">
                <span class="action-icon">✨</span>
                <span class="action-text">Quick Add</span>
              </button>
            </div>
          </div>
        </div>
        
        <!-- Decorative line -->
        <div class="hero-divider"></div>
      </div>
    </div>

    <!-- Statistics Grid -->
    <div class="stats-section">
      <div class="stats-grid">
        <div v-for="stat in stats" :key="stat.label" class="stat-card">
          <div class="stat-icon">{{ stat.icon }}</div>
          <div class="stat-content">
            <p class="stat-label">{{ stat.label }}</p>
            <p class="stat-value">
              {{ stat.prefix }}{{ stat.value.toLocaleString() }}{{ stat.suffix }}
            </p>
            <p v-if="stat.change" class="stat-change">
              {{ stat.change }}
            </p>
          </div>
        </div>
      </div>
    </div>

    <!-- Dues Management Section -->
    <div class="dues-section">
      <h2 class="section-title">Member Dues Overview</h2>
      
      <div class="dues-grid">
        <div v-for="member in visibleDuesMembers" :key="member.id" class="dues-card">
          <div class="member-header">
            <div class="member-avatar">
              <span>{{ member.initials }}</span>
            </div>
            <div class="member-details">
              <h3 class="member-name">{{ member.name }}</h3>
              <p class="member-id">Member #{{ member.id }}</p>
            </div>
          </div>
          
          <div class="dues-info">
            <span class="dues-label">Amount Due</span>
            <span class="dues-amount">${{ member.dueAmount }}</span>
          </div>
          
          <button class="btn-pay">
            Mark Paid
          </button>
        </div>
      </div>
      
      <div class="view-all-container">
        <button class="btn-view-all">
          View All Members →
        </button>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  layout: 'board',
  middleware: 'board-auth'
}
</script>

<script setup>
import { ref, computed } from 'vue'

// Current date
const currentDate = computed(() => {
  return new Date().toLocaleDateString('en-US', {
    weekday: 'long',
    year: 'numeric',
    month: 'long',
    day: 'numeric'
  })
})

// Statistics data
const stats = ref([
  {
    icon: '👥',
    label: 'TOTAL MEMBERS',
    value: 1234,
    change: '+12%',
  },
  {
    icon: '💰',
    label: 'DUES COLLECTED',
    value: 45678,
    prefix: '$',
    change: '+8%',
  },
  {
    icon: '📅',
    label: 'UPCOMING EVENTS',
    value: 5,
    change: '2 this week',
  },
  {
    icon: '📈',
    label: 'GROWTH RATE',
    value: 23,
    suffix: '%',
    change: '+3%',
  }
])

// Sample dues members data
const visibleDuesMembers = ref([
  {
    id: 1,
    name: 'John Smith',
    initials: 'JS',
    dueAmount: 250,
  },
  {
    id: 2,
    name: 'Marie Dubois',
    initials: 'MD',
    dueAmount: 250,
  },
  {
    id: 3,
    name: 'Alessandro Rossi',
    initials: 'AR',
    dueAmount: 250,
  },
  {
    id: 4,
    name: 'Emma Wilson',
    initials: 'EW',
    dueAmount: 250,
  }
])
</script>

<style scoped>
/* Animations */
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(10deg); }
}

@keyframes pulse-slow {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.1); }
}

@keyframes bounce-slow {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes gradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes slide-in {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

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

/* Base Styles */
.glass-dashboard {
  min-height: 100vh;
  background: #f8f9fa;
}

/* Hero Header */
.hero-header {
  position: relative;
  overflow: hidden;
  margin-bottom: 2rem;
}

.hero-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 50%, #7f1d1d 100%);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.3), transparent);
}

/* Floating Orbs */
.floating-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  animation: float 8s ease-in-out infinite;
}

.orb-1 {
  top: 40px;
  right: 80px;
  width: 256px;
  height: 256px;
  background: rgba(255, 255, 255, 0.05);
}

.orb-2 {
  bottom: 40px;
  left: 80px;
  width: 192px;
  height: 192px;
  background: rgba(239, 68, 68, 0.1);
  animation: pulse-slow 4s ease-in-out infinite;
}

.orb-3 {
  top: 50%;
  left: 50%;
  width: 128px;
  height: 128px;
  background: rgba(255, 255, 255, 0.1);
  animation: bounce-slow 3s ease-in-out infinite;
}

.mesh-overlay {
  position: absolute;
  inset: 0;
  opacity: 0.2;
  background: radial-gradient(circle at 20% 50%, transparent 0%, rgba(255,255,255,0.1) 50%, transparent 100%);
  mix-blend-mode: overlay;
}

.hero-content {
  position: relative;
  padding: 3rem;
  border-radius: 1.5rem;
}

.hero-inner {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

@media (min-width: 1024px) {
  .hero-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

/* User Section */
.user-section {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  animation: slide-in 0.6s ease-out;
}

.avatar-wrapper {
  position: relative;
  group: true;
}

.avatar-glow {
  position: absolute;
  inset: -8px;
  background: linear-gradient(135deg, rgba(255,255,255,0.3), rgba(254,202,202,0.3));
  border-radius: 50%;
  filter: blur(12px);
  transition: filter 0.3s;
}

.avatar-wrapper:hover .avatar-glow {
  filter: blur(16px);
}

.avatar-container {
  position: relative;
}

.avatar {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #fff, #fef2f2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 
    0 0 0 4px rgba(255,255,255,0.4),
    0 10px 40px rgba(0,0,0,0.2);
  border: 2px solid rgba(255,255,255,0.2);
  transition: transform 0.3s;
}

.avatar:hover {
  transform: scale(1.1);
}

.avatar-text {
  font-size: 1.5rem;
  font-weight: bold;
  color: #dc2626;
}

.status-indicator {
  position: absolute;
  bottom: -8px;
  right: -8px;
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #10b981, #059669);
  border-radius: 50%;
  border: 4px solid white;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
  animation: pulse-slow 2s infinite;
}

.crown-badge {
  position: absolute;
  top: -12px;
  right: -4px;
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: bounce-slow 3s infinite;
}

/* User Info */
.user-info {
  flex: 1;
}

.welcome-title {
  font-size: 3rem;
  font-weight: 900;
  color: white;
  margin-bottom: 0.5rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.name-gradient {
  display: block;
  background: linear-gradient(90deg, #fff, #fee2e2, #fff);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: gradient 3s ease infinite;
}

.user-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.role-badge {
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(10px);
  border-radius: 9999px;
  padding: 0.75rem 1.5rem;
  border: 1px solid rgba(255,255,255,0.3);
  box-shadow: 0 4px 24px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sparkle {
  font-size: 1.25rem;
}

.role-text {
  color: white;
  font-weight: bold;
}

.divider {
  height: 1.5rem;
  width: 1px;
  background: rgba(255,255,255,0.3);
}

.org-name {
  color: #fecaca;
  font-weight: 500;
}

/* Actions Section */
.actions-section {
  animation: slide-up 0.6s ease-out;
  animation-delay: 200ms;
  animation-fill-mode: both;
}

.date-card {
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(10px);
  border-radius: 1rem;
  padding: 1.5rem;
  border: 1px solid rgba(255,255,255,0.2);
  box-shadow: 0 8px 32px rgba(0,0,0,0.1);
  transition: background 0.3s;
  margin-bottom: 1rem;
}

.date-card:hover {
  background: rgba(255,255,255,0.15);
}

.date-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.calendar-icon {
  font-size: 1.5rem;
}

.date-label {
  color: #fecaca;
  font-weight: 600;
}

.date-text {
  font-size: 1.5rem;
  font-weight: bold;
  color: white;
  line-height: 1.2;
}

.date-progress {
  margin-top: 0.75rem;
  height: 4px;
  background: rgba(255,255,255,0.2);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 75%;
  background: linear-gradient(90deg, rgba(255,255,255,0.6), rgba(255,255,255,0.8));
  border-radius: 9999px;
  animation: pulse-slow 2s infinite;
}

.quick-actions {
  display: flex;
  gap: 0.75rem;
}

.action-btn {
  flex: 1;
  padding: 1rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(255,255,255,0.2);
  transition: all 0.3s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.action-alerts {
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(10px);
  color: white;
}

.action-alerts:hover {
  background: rgba(255,255,255,0.2);
  transform: scale(1.05);
}

.action-primary {
  background: white;
  color: #dc2626;
  box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}

.action-primary:hover {
  background: #fee2e2;
  transform: scale(1.05);
}

.action-icon {
  font-size: 1.25rem;
}

.action-text {
  font-size: 0.875rem;
  font-weight: 500;
}

.hero-divider {
  margin-top: 2rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
}

/* Stats Section */
.stats-section {
  padding: 0 1.5rem;
  margin-bottom: 2rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.stat-card {
  background: white;
  border-radius: 1.5rem;
  padding: 1.5rem;
  box-shadow: 0 10px 40px rgba(0,0,0,0.08);
  border: 1px solid rgba(0,0,0,0.05);
  transition: all 0.3s;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.12);
}

.stat-icon {
  font-size: 2rem;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  border-radius: 0.75rem;
}

.stat-content {
  flex: 1;
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 1.875rem;
  font-weight: 900;
  color: #1f2937;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.stat-change {
  font-size: 0.875rem;
  color: #10b981;
  font-weight: 500;
}

/* Dues Section */
.dues-section {
  padding: 0 1.5rem;
  margin-bottom: 2rem;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 1.5rem;
}

.dues-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.dues-card {
  background: white;
  border-radius: 1.5rem;
  padding: 1.5rem;
  box-shadow: 0 10px 40px rgba(0,0,0,0.08);
  border: 1px solid rgba(0,0,0,0.05);
  transition: all 0.3s;
}

.dues-card:hover {
  box-shadow: 0 20px 60px rgba(0,0,0,0.12);
}

.member-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.member-avatar {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #e5e7eb, #d1d5db);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #6b7280;
}

.member-details {
  flex: 1;
}

.member-name {
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 0.25rem;
}

.member-id {
  font-size: 0.875rem;
  color: #6b7280;
}

.dues-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: #f9fafb;
  border-radius: 0.75rem;
}

.dues-label {
  font-size: 0.875rem;
  color: #6b7280;
}

.dues-amount {
  font-size: 1.25rem;
  font-weight: 700;
  color: #dc2626;
}

.btn-pay {
  width: 100%;
  padding: 0.75rem;
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  color: #dc2626;
  font-weight: 600;
  border: 1px solid #fecaca;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-pay:hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(220, 38, 38, 0.3);
}

.view-all-container {
  text-align: center;
}

.btn-view-all {
  padding: 0.875rem 2rem;
  background: white;
  color: #dc2626;
  font-weight: 600;
  border: 2px solid #dc2626;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-view-all:hover {
  background: #dc2626;
  color: white;
  transform: translateX(4px);
}
</style>