<template>
  <div class="tech-card">
    <div class="corner top-left"></div>
    <div class="corner top-right"></div>
    <div class="corner bottom-left"></div>
    <div class="corner bottom-right"></div>

    <div class="card-header">
      <slot name="extra" />
    </div>

    <div class="card-content">
      <slot />
    </div>
  </div>
</template>

<script lang="ts" setup>
defineOptions({ name: 'TechCard' })
</script>

<style lang="less" scoped>
.tech-card {
  position: relative;
  background: linear-gradient(135deg, #001f3f, #005f99, #00aaff);
  background: #0b173f;
  border-radius: 12px;
  padding: 24px;
  color: #fff;
  transition: box-shadow 0.3s ease;

  @media (max-width: 1200px) {
    padding: 20px;
  }

  @media (max-width: 768px) {
    padding: 15px;
    min-height: 180px;
  }

  &::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    padding: 3px;
    background: linear-gradient(270deg, #ff00cc, #3333ff, #00ffee, #ffcc00);
    background-size: 600% 600%;
    animation: rainbowBorder 6s linear infinite;
    mask:
      linear-gradient(#fff 0 0) content-box,
      linear-gradient(#fff 0 0);
    -webkit-mask:
      linear-gradient(#fff 0 0) content-box,
      linear-gradient(#fff 0 0);
    mask-composite: exclude;
    -webkit-mask-composite: destination-out;
    opacity: 0.3;
    transition: opacity 0.4s ease;
    z-index: 10;
    pointer-events: none;
  }

  &:hover::before {
    opacity: 1;
    padding: 5px;
    animation: rainbowBorder 3s linear infinite;
  }

  .card-header {
    display: flex;
    margin-bottom: 8px;
    z-index: 1;
    position: relative;
  }

  .card-content {
    position: relative;
    z-index: 1;
  }

  .corner {
    position: absolute;
    width: 20px;
    height: 20px;
    z-index: 2;
  }

  .top-left {
    top: 3px;
    left: 3px;
    border-top: 2px solid #00f0ff;
    border-left: 2px solid #00f0ff;
    border-radius: 6px 0 0 0;
  }

  .top-right {
    top: 3px;
    right: 3px;
    border-top: 2px solid #00f0ff;
    border-right: 2px solid #00f0ff;
    border-radius: 0 6px 0 0;
  }

  .bottom-left {
    bottom: 3px;
    left: 3px;
    border-bottom: 2px solid #00f0ff;
    border-left: 2px solid #00f0ff;
    border-radius: 0 0 0 6px;
  }

  .bottom-right {
    bottom: 3px;
    right: 3px;
    border-bottom: 2px solid #00f0ff;
    border-right: 2px solid #00f0ff;
    border-radius: 0 0 6px 0;
  }
}

@keyframes rainbowBorder {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}
</style>
