<template>
  <v-container>
    <!-- Welcome Header -->
    <v-row class="mb-6">
      <v-col>
        <h1 class="text-h3 font-weight-bold" style="color: #a31515;">
          Welcome Back, {{ firstName }}!
        </h1>
        <p class="text-h6 text-medium-emphasis">
          MonacoUSA Member Portal
        </p>
      </v-col>
    </v-row>

    <!-- Quick Actions -->
    <v-row class="mb-6">
      <v-col cols="12" md="4">
        <v-card class="pa-4 text-center" elevation="2" hover>
          <v-icon size="48" color="primary" class="mb-2">mdi-account</v-icon>
          <h3 class="mb-2">My Profile</h3>
          <p class="text-body-2 mb-4">View and update your information</p>
          <v-btn 
            color="primary" 
            variant="outlined"
            style="border-color: #a31515; color: #a31515;"
            @click="navigateToProfile"
          >
            View Profile
          </v-btn>
        </v-card>
      </v-col>
      
      <v-col cols="12" md="4">
        <v-card class="pa-4 text-center" elevation="2" hover>
          <v-icon size="48" color="primary" class="mb-2">mdi-calendar</v-icon>
          <h3 class="mb-2">Events</h3>
          <p class="text-body-2 mb-4">View upcoming association events</p>
          <v-btn 
            color="primary" 
            variant="outlined"
            style="border-color: #a31515; color: #a31515;"
            @click="navigateToEvents"
          >
            View Events
          </v-btn>
        </v-card>
      </v-col>
      
      <v-col cols="12" md="4">
        <v-card class="pa-4 text-center" elevation="2" hover>
          <v-icon size="48" color="primary" class="mb-2">mdi-file-document</v-icon>
          <h3 class="mb-2">Resources</h3>
          <p class="text-body-2 mb-4">Access member resources</p>
          <v-btn 
            color="primary" 
            variant="outlined"
            style="border-color: #a31515; color: #a31515;"
            @click="navigateToResources"
          >
            View Resources
          </v-btn>
        </v-card>
      </v-col>
    </v-row>

    <!-- Recent Activity Section -->
    <v-row class="mb-6">
      <v-col cols="12">
        <v-card elevation="2">
          <v-card-title class="pa-4" style="background-color: #f5f5f5;">
            <v-icon class="mr-2" color="primary">mdi-clock-outline</v-icon>
            Recent Activity
          </v-card-title>
          <v-card-text class="pa-4">
            <v-list>
              <v-list-item>
                <v-list-item-content>
                  <v-list-item-title>Welcome to MonacoUSA Portal!</v-list-item-title>
                  <v-list-item-subtitle>
                    You've successfully logged in to your member dashboard.
                  </v-list-item-subtitle>
                </v-list-item-content>
                <v-list-item-action>
                  <v-chip color="success" size="small">New</v-chip>
                </v-list-item-action>
              </v-list-item>
            </v-list>
          </v-card-text>
        </v-card>
      </v-col>
    </v-row>

    <!-- Member Information -->
    <v-row>
      <v-col cols="12" md="6">
        <v-card elevation="2">
          <v-card-title class="pa-4" style="background-color: #f5f5f5;">
            <v-icon class="mr-2" color="primary">mdi-information-outline</v-icon>
            Member Information
          </v-card-title>
          <v-card-text class="pa-4">
            <v-list>
              <v-list-item>
                <v-list-item-content>
                  <v-list-item-title>Name</v-list-item-title>
                  <v-list-item-subtitle>{{ user?.name || 'Not provided' }}</v-list-item-subtitle>
                </v-list-item-content>
              </v-list-item>
              <v-list-item>
                <v-list-item-content>
                  <v-list-item-title>Email</v-list-item-title>
                  <v-list-item-subtitle>{{ user?.email || 'Not provided' }}</v-list-item-subtitle>
                </v-list-item-content>
              </v-list-item>
              <v-list-item>
                <v-list-item-content>
                  <v-list-item-title>Member Type</v-list-item-title>
                  <v-list-item-subtitle>
                    <v-chip color="primary" size="small">{{ userTier.toUpperCase() }}</v-chip>
                  </v-list-item-subtitle>
                </v-list-item-content>
              </v-list-item>
            </v-list>
          </v-card-text>
        </v-card>
      </v-col>
      
      <v-col cols="12" md="6">
        <v-card elevation="2">
          <v-card-title class="pa-4" style="background-color: #f5f5f5;">
            <v-icon class="mr-2" color="primary">mdi-help-circle-outline</v-icon>
            Need Help?
          </v-card-title>
          <v-card-text class="pa-4">
            <p class="mb-4">
              If you need assistance or have questions about your membership, 
              please don't hesitate to contact our support team.
            </p>
            <v-btn 
              color="primary" 
              variant="outlined"
              style="border-color: #a31515; color: #a31515;"
              @click="contactSupport"
            >
              <v-icon start>mdi-email</v-icon>
              Contact Support
            </v-btn>
          </v-card-text>
        </v-card>
      </v-col>
    </v-row>
  </v-container>
</template>

<script setup lang="ts">
definePageMeta({
  layout: 'dashboard',
  middleware: 'auth'
});

const { firstName, user, userTier } = useAuth();

// Navigation methods (placeholder implementations)
const navigateToProfile = () => {
  // TODO: Implement profile navigation
  console.log('Navigate to profile');
};

const navigateToEvents = () => {
  // TODO: Implement events navigation
  console.log('Navigate to events');
};

const navigateToResources = () => {
  // TODO: Implement resources navigation
  console.log('Navigate to resources');
};

const contactSupport = () => {
  // TODO: Implement support contact
  console.log('Contact support');
};
</script>

<style scoped>
.v-card {
  border-radius: 12px !important;
}

.v-card:hover {
  transform: translateY(-2px);
  transition: transform 0.2s ease-in-out;
}

.v-btn {
  text-transform: none !important;
}

.v-icon {
  color: #a31515 !important;
}

h3 {
  color: #333;
  font-weight: 600;
}

.text-body-2 {
  color: #666;
}
</style>
