import styled from 'styled-components';
import { ITheme, ThemeDefault } from '../../../types/theme.interface';

const css = styled.div;

export default css<ITheme>`
   width: 100%;
   max-width: 450px;

   @keyframes pulse {
      from {
         transform: scale3d(0, 0, 0);
      }

      90% {
         transform: scale3d(1.1, 1.1, 1.1);
      }

      to {
         transform: scale3d(1, 1, 1);
      }
   }

   @keyframes pulse-out {
      from {
         transform: scale3d(1, 1, 1);
      }

      to {
         transform: scale3d(0, 0, 0);
      }
   }

   .ds-toast-container {
      background: #202124;
      color: #fff;
      padding: 9px 20px;
      border-radius: 10px;
      border: none;
      letter-spacing: 0.3px;
      transition: all 400ms;
      opacity: 0;
      font-weight: 500;
      margin-bottom: 9px;

      &.opening {
         transition: all 1ms;
         animation-name: pulse;
         animation-timing-function: ease-in-out;
         animation-duration: 400ms; /* don't forget to set a duration! */
         opacity: 1;
      }

      &.closing {
         animation-name: pulse-out;
         animation-timing-function: ease-in-out;
         animation-duration: 400ms; /* don't forget to set a duration! */
      }

      &.error {
         background: ${(p) => p.theme?.danger ?? ThemeDefault.danger};
         color: ${(p) => p.theme?.dangerTexTextInside ?? ThemeDefault.dangerTextInside};
      }

      &.danger {
         background: ${(p) => p.theme?.danger ?? ThemeDefault.danger};
         color: ${(p) => p.theme?.dangerTexTextInside ?? ThemeDefault.dangerTextInside};
      }

      &.warning {
         background: ${(p) => p.theme?.warning ?? ThemeDefault.warning};
         color: ${(p) => p.theme?.warningTexTextInside ?? ThemeDefault.warningTextInside};
      }

      &.success {
         background: ${(p) => p.theme?.success ?? ThemeDefault.success};
         color: ${(p) => p.theme?.successTexTextInside ?? ThemeDefault.successTextInside};
      }
   }

   .ds-toast {
      display: flex;
      justify-content: center;
      align-self: center;
      align-items: center;
   }

   .close {
      flex: 0;
      text-align: right;
      padding: 5px;
      padding-left: 10px;
      cursor: pointer;
   }

   .message {
      font-size: 13px;
      font-weight: 400;
      flex: 1;
   }
`;
