<template>
  <div class="topbar">
    <NuxtLink to="/" class="logo-link">
      <div class="logo-container">
        <h1 class="site-title">{{ $t('site_title') }}</h1>
        <p class="site-subtitle">{{ $t('site_subtitle') }}</p>
      </div>
    </NuxtLink>

    <v-spacer />

    <div class="icon-links">
      <LanguageSelector class="mr-3" />

      <ThemeSwitcher />

      <a 
          href="#contact" 
          class="contact-btn v-btn v-btn--text"
      >
        <i class="fas fa-phone mr-2"></i>
        {{ $t('contact_button') }}
      </a>
    </div>
  </div>
</template>

<script setup lang="ts">
  import ThemeSwitcher from "~/components/ThemeSwitcher.vue";
  import { useDisplay } from 'vuetify'
  import { useI18n } from 'vue-i18n'

  const i18n = useI18n()

  const { lgAndUp }= useDisplay()
</script>

<style scoped lang="scss">
.topbar {
  min-height: 64px;
  display: flex;
  flex-direction: row;
  margin: 0;
  padding: 18px;

  @media (max-width: 1279px) {
    margin: 0 10%;
  }

  @media (max-width: 600px) {
    margin: 0 5%;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .logo-link {
    text-decoration: none;
    transition: opacity 0.2s ease;

    &:hover {
      opacity: 0.9;
    }
  }

  .logo-container {
    display: flex;
    flex-direction: column;
    justify-content: center;

    .site-title {
      font-size: 1.8rem;
      font-weight: 700;
      margin: 0;
      color: rgb(var(--v-theme-primary));
      font-family: 'Georgia', serif;
    }

    .site-subtitle {
      font-size: 0.9rem;
      margin: 0;
      color: rgb(var(--v-theme-on-background));
      font-style: italic;
    }
  }

  .v-btn {
    color: rgb(var(--v-theme-on-background));
  }

  .contact-btn {
    background-color: rgb(var(--v-theme-primary));
    color: rgb(var(--v-theme-on-primary)) !important;
    font-weight: 500;
    border-radius: 4px;
    padding: 8px 16px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s;

    &:hover {
      opacity: 0.9;
    }
  }

  .icon-links {
    font-size: 14px;
    display: flex;
    flex-direction: row;
    align-items: center;
    
    @media (max-width: 600px) {
      margin-top: 16px;
      flex-wrap: wrap;
      justify-content: center;
    }

    > * {
      margin-left: 24px;

      @media (max-width: 540px) {
        margin-left: 12px;
        margin-right: 12px;
        margin-bottom: 8px;
      }
    }

    .logo {
      padding: 4px;
    }

    a {
      color: rgb(var(--v-theme-on-background--clickable));
    }
  }
}
</style>
