// index.style.ts
import { createStyles } from 'antd-style';

const useStyles = createStyles(({ token }) => {
  return {
    timelineItem: {
      marginBottom: '20px',
      boxShadow: token.boxShadow,
      borderRadius: token.borderRadius,
      transition: 'all 0.3s',
      cursor: 'pointer',
      position: 'relative',
      padding: '20px',
      maxWidth: '100%',
      textAlign: 'left',
      maxHeight: '80vh',
      scrollBehavior: 'smooth',
      scrollbarWidth: 'none',
      borderBottom: '1px solid #eee',
      [`@media (max-width: 768px)`]: {
        padding: '10px',
      },
    },
    timelineItemHover: {
      boxShadow: token.boxShadowSecondary,
    },
    actions: {
      display: 'flex',
      gap: '8px',
      alignItems: 'center',
      height: '24px',
      width: '120px',
    },
    timelineItemTitle: {
      display: 'flex',
      justifyContent: 'space-between',
      alignItems: 'center',
      width: '100%',
    },
    timelineItemTitleText: {
      flex: 1,
      overflow: 'hidden',
      textOverflow: 'ellipsis',
      whiteSpace: 'nowrap',
    },
    timelineItemTags: {
      flexShrink: 0,
      marginLeft: '16px',
    },
    creatorTag: {
      fontSize: '12px',
    },
    updaterTag: {
      fontSize: '12px',
    },
    content: {
      padding: '10px 0',
    },
    cover: {
      width: '100%',
      height: '200px',
      overflow: 'hidden',
      borderRadius: '4px',
      marginBottom: '15px',
      img: {
        width: '100%',
        height: '100%',
        objectFit: 'cover',
      },
    },
    date: {
      fontSize: '14px',
      color: token.colorTextSecondary,
      marginBottom: '10px',
      fontWeight: 'bold',
    },
    dateInfo: {
      display: 'flex',
      alignItems: 'center',
      gap: '8px',
    },
    time: {
      color: token.colorTextSecondary,
    },
    location: {
      color: token.colorTextTertiary,
      display: 'flex',
      alignItems: 'center',
      gap: '4px',
    },
    description: {
      fontSize: '16px',
      lineHeight: '1.6',
      color: token.colorText,
      marginBottom: '15px',
      '.ant-btn-link': {
        padding: '0 4px',
      },
    },
    subItems: {
      borderTop: `1px dashed ${token.colorBorder}`,
      paddingTop: '15px',
      marginTop: '15px',
    },
    subItemsHeader: {
      display: 'flex',
      justifyContent: 'space-between',
      alignItems: 'center',
      cursor: 'pointer',
      fontWeight: 'bold',
      color: token.colorTextHeading,
      marginBottom: '10px',
      padding: '5px 0',
    },
    subItemsList: {
      maxHeight: '300px',
      overflowY: 'auto',
    },
    subItem: {
      display: 'flex',
      marginBottom: '10px',
      '&:last-child': {
        marginBottom: 0,
      },
    },
    subItemDate: {
      fontWeight: 'bold',
      minWidth: '100px',
      color: token.colorTextSecondary,
    },
    subItemContent: {
      flex: 1,
      color: token.colorText,
    },
    timelineItemImages: {
      display: 'grid',
      gridTemplateColumns: 'repeat(auto-fit, minmax(100px, 1fr))', // 减小最小宽度到100px
      gap: '8px', // 减少间距
      marginBottom: '20px',
      maxWidth: '100%', // 确保容器不会超出父元素宽度
      [`@media (max-width: 768px)`]: {
        gridTemplateColumns: 'repeat(auto-fit, minmax(60px, 1fr))', // 在移动设备上减小最小宽度到60px
      },
    },
    timelineImage: {
      maxWidth: '100%',
      height: 'auto',
      borderRadius: '4px',
      overflow: 'hidden',
      img: {
        width: '100%',
        height: 'auto',
        objectFit: 'cover',
      },
    },
  };
});

export default useStyles;