/*
 * This file is part of the UX SDC Bundle
 *
 * (c) Jozef Môstka <https://github.com/tito10047/ux-sdc>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

/* Styles for Homepage component */
@layer components {
  .homepage {
    padding-block: var(--space-xl);
    min-height: 80vh;
    background-image: radial-gradient(at 0% 0%, hsla(210,100%,95%,1) 0, transparent 50%),
                      radial-gradient(at 100% 0%, hsla(250,100%,95%,1) 0, transparent 50%);

    & .homepage__hero {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: var(--space-l);
      margin-bottom: var(--space-xl);
      padding-top: var(--space-xl);
    }

    & .homepage__search-wrapper {
      position: relative;
      width: min(100% - 2rem, 700px);
    }

    & .homepage__search-glow {
      position: absolute;
      inset: -10px;
      background: linear-gradient(90deg, #3b82f6, #a855f7);
      filter: blur(25px);
      opacity: 0.2;
      border-radius: var(--radius-xl);
      z-index: 0;
    }

    & .homepage__search-box {
      position: relative;
      z-index: 1;
      background: var(--color-surface);
      border-radius: 2rem;
      display: flex;
      align-items: center;
      padding: 0.25rem 0.75rem 0.25rem 1.25rem;
      box-shadow: 0 10px 25px -5px rgba(0,0,0,0.05);
      border: 1px solid var(--color-border);
      gap: 0.5rem;
    }

    & .homepage__search-select-wrapper {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      padding-right: 0.75rem;
      border-right: 1px solid var(--color-border);
      height: 1.5rem;
      flex-shrink: 0;

      & .homepage__search-select-icon {
        color: #94a3b8;
        display: flex;
        align-items: center;
      }

      /* TomSelect custom styling to fit the search box */
      & .ts-wrapper {
        min-width: 120px;

        & .ts-control {
          border: none;
          background: transparent;
          padding: 0;
          box-shadow: none;
          font-size: 0.95rem;
          color: var(--color-text);
          display: flex;
          align-items: center;
          min-height: unset;

          & .item {
            color: var(--color-text);
          }
        }

        &.focus .ts-control {
            box-shadow: none;
        }

        & .ts-dropdown {
          margin-top: 0.75rem;
          /* Ostatne style sa dedia z globalneho app.css */
        }
      }
    }

    & .homepage__search-input {
      flex: 1;
      border: none;
      background: transparent;
      font-size: 1.1rem;
      color: var(--color-text);
      outline: none;
      padding-block: 0.5rem;

      &::placeholder {
        color: #94a3b8;
      }
    }

    & .homepage__search-icon {
      color: #94a3b8;
      display: flex;
      align-items: center;
    }

    & .homepage__categories {
      display: flex;
      justify-content: center;
      gap: var(--space-m);
      flex-wrap: wrap;
      margin-top: var(--space-l);
      width: 100%;
      max-width: 1200px;
      margin-inline: auto;
      padding-inline: var(--space-s);
    }

    & .homepage__category {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: var(--space-xs);
      cursor: pointer;
      transition: transform 0.2s;

      &:hover {
        transform: translateY(-2px);

        & .homepage__category-name {
          color: var(--color-primary);
        }
      }
    }

    & .homepage__category-icon {
      width: 56px;
      height: 56px;
      border-radius: 1rem;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: var(--shadow-sm);
      background: var(--colorset-bg, var(--clr-gray-100));
      color: var(--colorset-primary, var(--color-text));
      border: 1px solid var(--colorset-border, transparent);

      & svg {
        width: 28px;
        height: 28px;
      }
    }

    & .homepage__category-name {
      font-size: 0.85rem;
      font-weight: 500;
      color: var(--color-text);
      opacity: 0.7;
      transition: color 0.2s;
    }

  }
}

@media (prefers-color-scheme: dark) {
  .homepage {
    background-image: radial-gradient(at 0% 0%, hsla(210,100%,10%,1) 0, transparent 50%),
                      radial-gradient(at 100% 0%, hsla(250,100%,10%,1) 0, transparent 50%);
  }
}
