@import '../mixins';

.shortcodes-tab {
  h2 {
    font-size: 24px;
    margin-bottom: 10px;
  }

  p {
    font-size: 14px;
    margin-bottom: 20px;
  }

  .shortcodes-list {
    // Container has no width - items control their own width

    .shortcode-item {
      padding: 10px 15px;
      border: 1px solid #ddd;
      border-radius: 8px;
      background-color: #f9f9f9;
      margin-top: 20px;

      // Simple layout (vertical pattern like complex ones)
      &.shortcode-item-simple {
        width: 100%;
        max-width: 100%;
        display: block;
        box-sizing: border-box;

        .shortcode-content {
          width: 100%;
        }

        .shortcode-header {
          display: flex;
          align-items: center;
          justify-content: space-between;
          margin-bottom: 16px;
          padding-bottom: 16px;
          border-bottom: 2px solid #f0f0f0;

          h3 {
            font-size: 20px;
            margin: 0;
            color: #1d2327;
            font-weight: 700;
            letter-spacing: -0.3px;
          }
        }

        .shortcode-description-simple {
          font-size: 15px;
          margin: 0 0 20px 0;
          color: #646970;
          line-height: 1.7;
          display: flex;
          align-items: end;
          gap: 8px;

          .mhub-info {
            cursor: pointer;
            color: #2271b1;
            font-size: 18px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 20px;
            height: 20px;
            transition: color 0.3s ease;
            flex-shrink: 0;
            margin-top: 2px;

            i {
              font-size: 16px;
            }

            &:hover {
              color: #135e96;
            }
          }
        }

        .shortcode-code-wrapper {
          margin-bottom: 0;
          overflow-x: visible;
          display: flex;
          align-items: center;
          gap: 12px;
          flex-wrap: wrap;
          width: 100%;
          box-sizing: border-box;

          .main-shortcode {
            display: inline-block;
            min-width: 0;
            font-size: 14px;
            color: #d63384;
            background: linear-gradient(135deg, #f8f9fa 0%, #f0f1f3 100%);
            padding: 16px 20px;
            border-radius: 10px;
            font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
            border: 2px solid #e8e9eb;
            line-height: 1.8;
            font-weight: 500;
            box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
            white-space: normal;
            word-break: break-all;
            flex: 1;
            max-width: 100%;
          }

          .copy-shortcode-btn {
            padding: 10px 20px;
            font-size: 14px;
            color: #ffffff;
            background: linear-gradient(135deg, #7856fb 0%, #6344d9 100%);
            border: none;
            border-radius: 8px;
            cursor: pointer;
            display: flex;
            align-items: center;
            min-width: 150px;
            justify-content: center;
            transition: all 0.3s ease;
            flex-shrink: 0;
            font-weight: 600;
            box-shadow: 0 2px 4px rgba(120, 86, 251, 0.2);
            height: fit-content;

            i {
              font-size: 16px;
              margin-right: 6px;
              line-height: 1.4;
            }

            &:hover {
              background: linear-gradient(135deg, #6344d9 0%, #4f21ff 100%);
              box-shadow: 0 4px 8px rgba(120, 86, 251, 0.3);
              transform: translateY(-1px);
            }

            &:active {
              transform: translateY(0);
            }
          }
        }
      }

      // Complex layout (new style - for items with parameters/notes/examples)
      &:not(.shortcode-item-simple) {
        width: 100%;
        max-width: 100%;
        display: block;
        box-sizing: border-box;
      }

      h3 {
        font-size: 18px;
        margin: 0;
      }

      p {
        font-size: 14px;
        margin: 0;
        margin-top: 5px;
      }

      .shortcode-content {
        width: 100%;
      }

      .shortcode-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 16px;
        flex-wrap: wrap;
        gap: 16px;
        padding-bottom: 16px;
        border-bottom: 2px solid #f0f0f0;

        h3 {
          font-size: 20px;
          margin: 0;
          color: #1d2327;
          font-weight: 700;
          letter-spacing: -0.3px;
        }
      }

      .shortcode-description {
        font-size: 15px;
        margin: 0 0 20px 0;
        color: #646970;
        line-height: 1.7;
        display: flex;
        align-items: end;
        gap: 8px;

        .mhub-info {
          cursor: pointer;
          color: #2271b1;
          font-size: 18px;
          display: inline-flex;
          align-items: center;
          justify-content: center;
          width: 20px;
          height: 20px;
          transition: color 0.3s ease;
          flex-shrink: 0;
          margin-top: 2px;

          i {
            font-size: 16px;
          }

          &:hover {
            color: #135e96;
          }
        }
      }

      .shortcode-code-wrapper {
        margin-bottom: 20px;
        overflow-x: visible;
        display: flex;
        align-items: center;
        gap: 12px;
        flex-wrap: wrap;
        width: 100%;
        box-sizing: border-box;

        .main-shortcode {
          display: inline-block;
          min-width: 0;
          font-size: 14px;
          color: #d63384;
          background: linear-gradient(135deg, #f8f9fa 0%, #f0f1f3 100%);
          padding: 16px 20px;
          border-radius: 10px;
          font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
          border: 2px solid #e8e9eb;
          line-height: 1.8;
          font-weight: 500;
          box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
          white-space: normal;
          word-break: break-all;
          flex: 1;
          max-width: 100%;
        }

        .copy-shortcode-btn {
          padding: 10px 20px;
          font-size: 14px;
          color: #ffffff;
          background: linear-gradient(135deg, #7856fb 0%, #6344d9 100%);
          border: none;
          border-radius: 8px;
          cursor: pointer;
          display: flex;
          align-items: center;
          min-width: 150px;
          justify-content: center;
          transition: all 0.3s ease;
          flex-shrink: 0;
          font-weight: 600;
          box-shadow: 0 2px 4px rgba(120, 86, 251, 0.2);
          height: fit-content;

          i {
            font-size: 16px;
            margin-right: 6px;
            line-height: 1.4;
          }

          &:hover {
            background: linear-gradient(135deg, #6344d9 0%, #4f21ff 100%);
            box-shadow: 0 4px 8px rgba(120, 86, 251, 0.3);
            transform: translateY(-1px);
          }

          &:active {
            transform: translateY(0);
          }
        }

        // Zoom-specific wider layout
        &.shortcode-code-wrapper-zoom {
          max-width: 100%;
          width: 100%;

          .main-shortcode {
            flex: 1;
            min-width: 0;
            max-width: 100%;
            overflow-x: visible;
            white-space: normal;
            word-break: break-all;
          }

          &.mhub-pro-restricted {
            position: relative;



            .mhub-pro-overlay {
              position: absolute;
              top: 0;
              left: 0;
              width: 100%; // Cover everything, including the button
              height: 100%;
              display: flex;
              align-items: center;
              justify-content: center;
              z-index: 10;
              opacity: 0;
              transition: opacity 0.3s ease;
              background-color: rgba(255, 255, 255, 0.85); // Semi-transparent white background
              backdrop-filter: blur(2px); // Slight blur on the overlay itself for better button visibility
              border-radius: 10px; // Match main-shortcode border-radius

              .mhub-upgrade-btn {
                background-color: #fde68a;
                color: #b45309;
                padding: 10px 20px;
                border-radius: 6px;
                text-decoration: none;
                font-weight: 700;
                font-size: 14px;
                box-shadow: 0 4px 12px rgba(180, 83, 9, 0.2);
                transform: translateY(0);
                transition: all 0.2s ease;
                display: flex;
                align-items: center;
                gap: 8px; // Space between icon and text
                cursor: pointer;

                i {
                  font-size: 18px;
                  line-height: 1;
                }

                &:hover {
                  background-color: #fcd34d; // Slightly darker yellow on hover
                  transform: translateY(-2px);
                  box-shadow: 0 6px 15px rgba(180, 83, 9, 0.3);
                  color: #92400e;
                }
              }
            }

            &:hover {
              .mhub-pro-overlay {
                opacity: 1;
              }
            }
          }
        }
      }

      .shortcode-note {
        display: flex;
        align-items: flex-start;
        gap: 12px;
        padding: 16px 20px;
        background: linear-gradient(135deg, #e7f3ff 0%, #d9edff 100%);
        border-left: 5px solid #2271b1;
        border-radius: 8px;
        margin-bottom: 20px;
        box-shadow: 0 2px 4px rgba(34, 113, 177, 0.1);

        i {
          color: #2271b1;
          font-size: 20px;
          margin-top: 2px;
          flex-shrink: 0;
        }

        span {
          font-size: 14px;
          color: #1d2327;
          line-height: 1.7;
          font-weight: 500;
        }
      }

      .shortcode-parameters {
        margin-bottom: 20px;
        padding: 20px;
        background: linear-gradient(135deg, #fff9e6 0%, #fff4d6 100%);
        border-left: 5px solid #f0ad4e;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(240, 173, 78, 0.1);

        .parameters-header {
          margin-bottom: 14px;

          strong {
            font-size: 16px;
            color: #1d2327;
            font-weight: 700;
            letter-spacing: -0.2px;
          }
        }

        .parameters-list {
          display: flex;
          flex-direction: column;
          gap: 12px;
        }

        .parameter-item {
          display: flex;
          align-items: flex-start;
          gap: 12px;
          padding: 12px 16px;
          background-color: #ffffff;
          border-radius: 6px;
          border: 1px solid #f0e5cc;

          .parameter-name {
            font-size: 13px;
            color: #d63384;
            background-color: #f8f9fa;
            padding: 4px 10px;
            border-radius: 4px;
            font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
            font-weight: 600;
            white-space: nowrap;
            flex-shrink: 0;
            border: 1px solid #e8e9eb;
          }

          .parameter-description {
            font-size: 14px;
            color: #646970;
            line-height: 1.6;
            flex: 1;
          }
        }
      }

      .shortcode-examples {
        margin-top: 24px;
        padding-top: 24px;
        border-top: 3px solid #e8e9eb;

        .examples-header {
          margin-bottom: 16px;

          strong {
            font-size: 16px;
            color: #1d2327;
            font-weight: 700;
            letter-spacing: -0.2px;
          }
        }

        .example-item {
          margin-bottom: 18px;
          padding: 18px 20px;
          background: linear-gradient(135deg, #fafbfc 0%, #f5f6f8 100%);
          border-radius: 10px;
          border: 2px solid #e8e9eb;
          transition: all 0.3s ease;
          overflow-x: visible;

          &:last-child {
            margin-bottom: 0;
          }

          &:hover {
            border-color: #d0d1d3;
            box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
          }

          .example-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 12px;

            .example-label {
              font-size: 14px;
              font-weight: 700;
              color: #2271b1;
              letter-spacing: -0.1px;
            }

            .copy-example-btn {
              padding: 7px 14px;
              font-size: 13px;
              color: #ffffff;
              background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
              border: none;
              border-radius: 6px;
              cursor: pointer;
              display: flex;
              align-items: center;
              min-width: 36px;
              justify-content: center;
              transition: all 0.3s ease;
              flex-shrink: 0;
              font-weight: 600;
              box-shadow: 0 2px 4px rgba(108, 117, 125, 0.2);

              i {
                font-size: 14px;
                line-height: 1;
              }

              &:hover {
                background: linear-gradient(135deg, #5a6268 0%, #495057 100%);
                box-shadow: 0 3px 6px rgba(108, 117, 125, 0.3);
                transform: translateY(-1px);
              }

              &:active {
                transform: translateY(0);
              }
            }
          }

          code {
            display: inline-block;
            min-width: fit-content;
            font-size: 13px;
            color: #d63384;
            background-color: #ffffff;
            padding: 14px 16px;
            border-radius: 8px;
            font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
            overflow-x: visible;
            border: 2px solid #e0e2e6;
            line-height: 1.8;
            margin-bottom: 10px;
            font-weight: 500;
            box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
            white-space: nowrap;
          }

          .example-description {
            font-size: 13px;
            color: #646970;
            margin: 0;
            line-height: 1.6;
            font-style: italic;
            padding-left: 4px;
          }
        }
      }
    }
  }

  // Responsive styles for mobile and small devices
  @include respond-to('small') {
    .shortcodes-list {
      .shortcode-item {
        padding: 12px;

        .shortcode-header {
          h3 {
            font-size: 18px;
          }
        }

        .shortcode-description,
        .shortcode-description-simple {
          font-size: 14px;
        }

        .shortcode-code-wrapper {
          flex-direction: column !important;
          gap: 15px;
          width: 100% !important;
          max-width: 100% !important;
          overflow: visible !important;
          box-sizing: border-box;

          .main-shortcode {
            width: 100% !important;
            font-size: 13px;
            padding: 12px 16px;
            white-space: normal !important; 
            word-break: break-all !important;
            min-width: 0 !important;
            max-width: 100% !important;
            display: block !important;
            box-sizing: border-box;
            line-height: 1.6;
          }

          .copy-shortcode-btn {
            width: 100% !important;
            min-width: unset !important;
            max-width: 100% !important;
            display: flex !important;
            justify-content: center;
          }

          &.shortcode-code-wrapper-zoom {
            .main-shortcode {
              max-width: 100% !important;
              width: 100% !important;
            }
          }
        }

        .shortcode-parameters {
          padding: 16px;

          .parameters-header strong {
            font-size: 15px;
          }

          .parameter-item {
            flex-direction: column;
            gap: 8px;
            padding: 10px 12px;

            .parameter-name {
              font-size: 12px;
            }

            .parameter-description {
              font-size: 13px;
            }
          }
        }
      }
    }
  }

  @include respond-to('xsmall') {
    .shortcodes-list {
      .shortcode-item {
        padding: 10px;

        .shortcode-header {
          h3 {
            font-size: 16px;
          }
        }

        .shortcode-description,
        .shortcode-description-simple {
          font-size: 13px;
        }

        .shortcode-code-wrapper {
          .main-shortcode {
            font-size: 12px;
            padding: 10px 14px;
          }

          .copy-shortcode-btn {
            padding: 10px 16px;
            font-size: 13px;

            i {
              font-size: 14px;
            }
          }
        }

        .shortcode-parameters {
          padding: 14px;

          .parameters-header strong {
            font-size: 14px;
          }

          .parameter-item {
            padding: 8px 10px;

            .parameter-name {
              font-size: 11px;
              padding: 3px 8px;
            }

            .parameter-description {
              font-size: 12px;
            }
          }
        }
      }
    }
  }

}