<template>
  <div class="loader-container" :class="{ 'loader--inline': inline }">
    <div class="loader-spinner"></div>
    <span v-if="text" class="loader-text">{{ text }}</span>
  </div>
</template>

<script setup>
defineProps({
  text: {
    type: String,
    default: 'Загрузка...'
  },
  inline: {
    type: Boolean,
    default: false
  }
})
</script>

<style scoped>
.loader-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 80px;
  color: var(--text-secondary);
}

.loader-container.loader--inline {
  flex-direction: row;
  padding: 40px;
  gap: 12px;
}

.loader-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loader--inline .loader-spinner {
  width: 24px;
  height: 24px;
  border-width: 2px;
}

.loader-text {
  font-size: 14px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
</style>
