import { style } from '@vanilla-extract/css';
import { DefaultReset, color, config, toRem } from 'folds';

export const YouTubeEmbed = style([
  DefaultReset,
  {
    width: toRem(480),
    maxWidth: '100%',
    backgroundColor: color.SurfaceVariant.Container,
    border: `${config.borderWidth.B300} solid ${color.SurfaceVariant.ContainerLine}`,
    borderRadius: config.radii.R300,
    overflow: 'hidden',
  },
]);

export const YouTubeEmbedIframe = style([
  DefaultReset,
  {
    width: '100%',
    aspectRatio: '16 / 9',
    border: 'none',
    display: 'block',
  },
]);

export const YouTubeEmbedHeader = style([
  DefaultReset,
  {
    padding: `${config.space.S100} ${config.space.S200}`,
    backgroundColor: color.SurfaceVariant.ContainerActive,
    display: 'flex',
    alignItems: 'center',
    justifyContent: 'space-between',
    gap: config.space.S200,
  },
]);

export const YouTubeEmbedLink = style({
  color: color.Success.Main,
  textDecoration: 'none',
  overflow: 'hidden',
  textOverflow: 'ellipsis',
  whiteSpace: 'nowrap',
  ':hover': {
    textDecoration: 'underline',
  },
});

export const YouTubeThumbnailButton = style([
  DefaultReset,
  {
    position: 'relative',
    width: '100%',
    aspectRatio: '16 / 9',
    border: 'none',
    padding: 0,
    cursor: 'pointer',
    backgroundColor: '#000',
    display: 'block',
  },
]);

export const YouTubeThumbnail = style([
  DefaultReset,
  {
    width: '100%',
    height: '100%',
    objectFit: 'cover',
    display: 'block',
  },
]);

export const YouTubePlayButton = style([
  DefaultReset,
  {
    position: 'absolute',
    top: '50%',
    left: '50%',
    transform: 'translate(-50%, -50%)',
    width: toRem(68),
    height: toRem(48),
    backgroundColor: 'rgba(255, 0, 0, 0.9)',
    borderRadius: toRem(12),
    display: 'flex',
    alignItems: 'center',
    justifyContent: 'center',
    color: '#fff',
    transition: 'background-color 0.2s ease',
    selectors: {
      [`${YouTubeThumbnailButton}:hover &`]: {
        backgroundColor: 'rgba(255, 0, 0, 1)',
      },
    },
  },
]);
