/**
 * Estilos CSS para templates públicos do STCP Plus
 * Organizados de forma aninhada seguindo os padrões do projeto
 *
 * @package STCP_Plus
 * @since 2.0.0
 */

/* ====================================================================
   Regras Globais: Links STCP+
   ==================================================================== */
/* Remover underline de todos os links do STCP+ */
.stcp-inscricao-detalhes a,
.stcp-section a,
.stcp-info-item a,
.stcp-btn,
.stcp-btn a,
.stcp-timeline a,
.stcp-segunda-tentativa-buttom-wrapper a,
.stcp-reinscricao-button-wrapper a,
.aneps-inscricoes a,
.aneps-account.aneps-account-stcp a {
  text-decoration: none !important;
}

.stcp-inscricao-detalhes a:hover,
.stcp-section a:hover,
.stcp-info-item a:hover,
.stcp-btn:hover,
.stcp-btn a:hover,
.stcp-timeline a:hover,
.stcp-segunda-tentativa-buttom-wrapper a:hover,
.stcp-reinscricao-button-wrapper a:hover,
.aneps-inscricoes a:hover,
.aneps-account.aneps-account-stcp a:hover {
  text-decoration: none !important;
}

/* ====================================================================
   Seção: Conta ANEPS / WooCommerce Account
   ==================================================================== */
.aneps-account {
  &.woocommerce-account {
    padding-top: 50px;
    padding-bottom: 100px;
  }
}

/* ====================================================================
   Seção: Minhas Inscrições
   ==================================================================== */
.aneps-inscricoes {
  padding-top: 20px;

  .table-container {
    .aneps-table {
      thead {
        th {
          &:nth-child(3) {
            text-align: center;
          }
        }
      }

      tbody {
        td {
          &:nth-child(3) {
            text-align: center;
          }
        }
      }
    }
  }

  .aneps-inscricoes-items {
    &.grid {
      &.gap-4 {
        display: grid;
        gap: 1rem;
      }
    }

    .aneps-inscricoes-item {
      header {
        h4 {
          margin: 0 0 1rem 0;
          color: #1d2327;
        }
      }

      .aneps-inscricoes-content {
        .badge {
          background-color: var(--status-color, #9e9e9e);
          color: #ffffff;
          padding: 5px 10px;
          border-radius: 4px;
          font-size: 12px;
          display: inline-block;
        }

        a {
          margin-top: 5px;
          display: inline-block;
          color: #2271b1;
          text-decoration: none;
          font-size: 13px;
          transition: all 0.3s;
          &:hover {
            text-decoration: none;
            color: #135e96;
          }
        }
      }
    }

    @media (max-width: 768px) {
      &.grid {
        grid-template-columns: 1fr;
        gap: 20px;
      }
    }
  }
}

/* Estado vazio - Nenhuma inscrição encontrada */
.d-flex {
  &.gap-20 {
    gap: 20px;
  }

  &.justify-content-between {
    justify-content: space-between;
  }

  &.align-items-center {
    align-items: center;
  }

  .flex {
    &.flex-column {
      flex-direction: column;
    }

    &.gap-20 {
      gap: 20px;
    }

    &.justify-content-center {
      justify-content: center;
    }

    h2 {
      margin: 0 0 0.5rem 0;
      color: #1d2327;
    }

    p {
      margin: 0 0 1rem 0;
      color: #666;
    }

    .btn {
      &.azul {
        background-color: #2271b1 !important;
        color: #fff !important;
        border: none;
        padding: 12px 24px;
        border-radius: 4px;
        text-decoration: none;
        display: inline-block;
        font-weight: 600;
        transition: background-color 0.3s ease;

        &:hover {
          background-color: #135e96 !important;
          color: #fff !important;
        }

        &.centered {
          text-align: center;
        }
      }
    }
  }

  @media (max-width: 768px) {
    flex-direction: column;
    text-align: center;

    .flex {
      .btn {
        &.azul {
          width: 100%;
        }
      }
    }
  }
}

/* ====================================================================
   Seção: Detalhes da Inscrição
   ==================================================================== */
.stcp-inscricao-detalhes {
  max-width: 800px;
  margin: 0 auto;

  .stcp-inscricao-header {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    border-left: 4px solid #2271b1;

    h2 {
      margin: 0 0 10px 0;
      color: #1d2327;
    }

    .stcp-status-badge {
      display: inline-block;
      padding: 5px 12px;
      border-radius: 4px;
      font-size: 13px;
      font-weight: 600;
      color: #fff;
    }
  }

  .stcp-section {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;

    h3 {
      margin: 0 0 15px 0;
      padding-bottom: 10px;
      border-bottom: 2px solid #f0f0f0;
      color: #1d2327;
    }

    .stcp-info-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 15px;

      .stcp-info-item {
        padding: 10px 0;

        .stcp-info-label {
          font-size: 12px;
          color: #666;
          text-transform: uppercase;
          letter-spacing: 0.5px;
          margin-bottom: 5px;
          font-weight: 600;
        }

        .stcp-info-value {
          font-size: 15px;
          color: #1d2327;
          font-weight: 500;

          strong {
            font-weight: 700;
          }

          span {
            margin-left: 5px;

            &[style*="color: #46b450"] {
              color: #46b450;
            }

            &[style*="color: #dc3232"] {
              color: #dc3232;
            }
          }

          a {
            color: #2271b1;
            text-decoration: none;

            &:hover {
              text-decoration: none;
            }
          }
        }
      }
    }
  }

  .stcp-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;

    .stcp-btn {
      padding: 10px 20px;
      display: flex;
      align-items: center;
      border-radius: 4px;
      text-decoration: none;
      font-weight: 600;
      transition: all 0.3s;

      &.stcp-btn-primary {
        background: #2271b1 !important;
        color: #fff !important;

        &:hover {
          background: #135e96 !important;
          color: #fff !important;
        }
      }

      &.stcp-btn-secondary {
        background: #f0f0f0 !important;
        color: #1d2327 !important;

        &:hover {
          background: #ddd !important;
          color: #1d2327 !important;
        }
      }
    }
  }

  @media (max-width: 768px) {
    .stcp-section {
      .stcp-info-grid {
        grid-template-columns: 1fr;
      }
    }

    .stcp-actions {
      flex-direction: column;

      .stcp-btn {
        width: 100%;
        text-align: center;
      }
    }
  }

  /* ====================================================================
   Seção: Botão Segunda Tentativa
   ==================================================================== */
  .stcp-segunda-tentativa-buttom-wrapper {
    margin-top: 15px;
  }

  .stcp-reinscricao-button-wrapper {
    margin-top: 15px;

    .stcp-btn-reinscricao {
      background-color: #2271b1 !important;
      color: #ffffff !important;
      text-decoration: none !important;

      &:hover {
        background-color: #135e96 !important;
        color: #ffffff !important;
        text-decoration: none !important;
      }
    }
  }

  .stcp-btn-segunda-tentativa {
    background-color: #2271b1 !important;
    color: #ffffff !important;
    text-decoration: none;
    transition: all 0.3s;
    cursor: pointer;

    &:hover:not(:disabled) {
      background-color: #135e96 !important;
      color: #ffffff !important;
      text-decoration: none;
    }

    &:disabled {
      opacity: 0.6;
      cursor: not-allowed;
      transform: none;
    }

    .stcp-btn-loading {
      display: none;
    }
  }

  /* ====================================================================
   Seção: Alertas
   ==================================================================== */
  .aneps-alert {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 20px;
    border-left: 4px solid;

    span {
      display: block;
    }

    &.alert-success {
      background-color: #d4edda;
      border-color: #28a745;
      color: #155724;
    }

    &.alert-error,
    &.alert-danger {
      background-color: #f8d7da;
      border-color: #dc3545;
      color: #721c24;
    }

    &.alert-warning {
      background-color: #fff3cd;
      border-color: #ffc107;
      color: #856404;
    }

    &.alert-info {
      background-color: #d1ecf1;
      border-color: #17a2b8;
      color: #0c5460;
    }
  }

  /* ====================================================================
   Seção: Verificação de Disponibilidade de Certificado
   ==================================================================== */
  .certificate-availability-box {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 20px 0;

    span {
      color: #666;
      font-size: 14px;
    }

    .aneps-spinner {
      width: 20px;
      height: 20px;
      border: 3px solid #f3f3f3;
      border-top: 3px solid #2271b1;
      border-radius: 50%;
      animation: spin 1s linear infinite;
    }
  }

  @keyframes spin {
    0% {
      rotate: 0deg;
    }

    100% {
      rotate: 360deg;
    }
  }

  /* ====================================================================
   Seção: Página de Inscrições STCP (stcp-inscricoes-page.php)
   ==================================================================== */
  .stcp-navigation {
    margin-bottom: 20px;

    .woocommerce-button,
    .button {
      padding: 10px 20px;
      border-radius: 4px;
      text-decoration: none;
      font-weight: 600;
      display: inline-block;
      transition: all 0.3s;
      background: #2271b1;
      color: #fff;
      border: none;
      cursor: pointer;

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

  .stcp-inscricoes-container {
    margin: 20px 0;

    h3 {
      margin-bottom: 20px;
      color: #333;
    }
  }

  .woocommerce-message {
    padding: 15px 20px;
    background: #d4edda;
    border-left: 4px solid #28a745;
    color: #155724;
    border-radius: 4px;
    margin-bottom: 20px;

    p {
      margin: 0;
    }
  }

  .woocommerce-account-details {
    .details-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 30px;

      .detail-section {
        h4 {
          margin-bottom: 15px;
          color: #555;
          border-bottom: 2px solid #e0e0e0;
          padding-bottom: 10px;
        }

        .woocommerce-table {
          width: 100%;
          border-collapse: collapse;
          margin-bottom: 20px;

          th,
          td {
            padding: 12px;
            text-align: left;
            border-bottom: 1px solid #ddd;
          }

          th {
            background-color: #f8f8f8;
            font-weight: bold;
            width: 40%;
          }
        }
      }
    }

    @media (max-width: 768px) {
      .details-grid {
        grid-template-columns: 1fr;
        gap: 20px;

        .detail-section {
          .woocommerce-table {
            font-size: 14px;

            th,
            td {
              padding: 8px;
            }
          }
        }
      }
    }
  }

  .woocommerce-account-table {
    overflow-x: auto;

    .woocommerce-orders-table {
      width: 100%;
      border-collapse: collapse;
      margin-bottom: 20px;

      &.shop_table {
        &.shop_table_responsive {
          .my_account_orders {
            .account-orders-table {
              /* Estilos específicos para tabela de pedidos */
            }
          }
        }
      }

      .woocommerce-orders-table__header {
        background-color: #f8f8f8;
        font-weight: bold;

        &.woocommerce-orders-table__header-order-number,
        &.woocommerce-orders-table__header-order-date,
        &.woocommerce-orders-table__header-order-status,
        &.woocommerce-orders-table__header-order-total,
        &.woocommerce-orders-table__header-order-actions {
          padding: 12px;
          text-align: left;
          border-bottom: 1px solid #ddd;

          .nobr {
            white-space: nowrap;
          }
        }
      }

      .woocommerce-orders-table__row {
        &.woocommerce-orders-table__row--status-pendente {
          /* Estilos para linha pendente */
        }

        &.woocommerce-orders-table__row--status-pago {
          /* Estilos para linha paga */
        }

        &.woocommerce-orders-table__row--status-aprovado {
          /* Estilos para linha aprovada */
        }

        &.woocommerce-orders-table__row--status-reprovado {
          /* Estilos para linha reprovada */
        }

        .woocommerce-orders-table__cell {
          padding: 12px;
          text-align: left;
          border-bottom: 1px solid #ddd;

          &.woocommerce-orders-table__cell-order-number,
          &.woocommerce-orders-table__cell-order-date,
          &.woocommerce-orders-table__cell-order-status,
          &.woocommerce-orders-table__cell-order-total,
          &.woocommerce-orders-table__cell-order-actions {
            /* Estilos específicos para células */
          }

          &[data-title] {
            /* Estilos para células responsivas */
          }

          time {
            /* Estilos para elemento time */
          }

          .woocommerce-orders-table__status {
            padding: 4px 8px;
            border-radius: 3px;
            font-size: 12px;
            font-weight: bold;
            text-transform: uppercase;
            display: inline-block;

            &.woocommerce-orders-table__status-pendente {
              background-color: #fff3cd;
              color: #856404;
            }

            &.woocommerce-orders-table__status-pago {
              background-color: #d4edda;
              color: #155724;
            }

            &.woocommerce-orders-table__status-aprovado {
              background-color: #d1ecf1;
              color: #0c5460;
            }

            &.woocommerce-orders-table__status-reprovado {
              background-color: #f8d7da;
              color: #721c24;
            }
          }

          .woocommerce-button,
          .button {
            &.view {
              padding: 8px 16px;
              border-radius: 4px;
              text-decoration: none;
              font-weight: 600;
              display: inline-block;
              transition: all 0.3s;
              background: #2271b1;
              color: #fff;
              border: none;
              cursor: pointer;
              font-size: 14px;

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

    @media (max-width: 768px) {
      .woocommerce-orders-table {
        font-size: 14px;

        .woocommerce-orders-table__header,
        .woocommerce-orders-table__cell {
          padding: 8px;
        }
      }
    }
  }

  .status-badge {
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    display: inline-block;

    &.status-pendente {
      background-color: #fff3cd;
      color: #856404;
    }

    &.status-pago {
      background-color: #d4edda;
      color: #155724;
    }

    &.status-aprovado {
      background-color: #d1ecf1;
      color: #0c5460;
    }

    &.status-reprovado {
      background-color: #f8d7da;
      color: #721c24;
    }
  }
}

/* ====================================================================
   Seção: Estado Vazio - Conteúdos Restritos
   ==================================================================== */
.stcp-empty-state {
  text-align: center;
  padding: 50px 30px 40px;
  position: relative;
  font-family: var(--font-family-primary, "Open Sans", sans-serif);

  & .stcp-empty-state__icon {
    width: 100px;
    height: 100px;
    margin: 0 auto 24px;
    background: #f0f5f9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    animation: stcp-empty-float 4s ease-in-out infinite;

    &::after {
      content: '';
      position: absolute;
      inset: -4px;
      border-radius: 50%;
      border: 2px dashed rgba(21, 116, 191, 0.2);
      animation: stcp-empty-spin 20s linear infinite;
    }

    & svg {
      width: 44px;
      height: 44px;
      stroke: #1574bf;
    }
  }

  & .stcp-empty-state__title {
    font-size: 1.4em;
    font-weight: 600;
    color: #1e215a;
    margin: 0 0 8px;
  }

  & .stcp-empty-state__message {
    font-size: 1.2em;
    line-height: 1.4;
    color: #333f49;
    margin: 0 auto 24px;
    max-width: 420px;
  }

  & .stcp-empty-state__divider {
    width: 50px;
    height: 3px;
    background: linear-gradient(90deg, #1574bf, #f96500);
    border-radius: 2px;
    margin: 0 auto 24px;
  }

  & .stcp-empty-state__hint {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 1em;
    color: #607589;
    background: #fafafa;
    padding: 10px 20px;
    border-radius: 50px;
    border: 1px solid #e5e5e5;

    & svg {
      width: 16px;
      height: 16px;
      stroke: #607589;
      flex-shrink: 0;
    }
  }
}

@keyframes stcp-empty-float {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-8px);
  }
}

@keyframes stcp-empty-spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/* Estado vazio dentro de abas de categoria */
.aneps-account-tab .stcp-empty-state {
  padding: 35px 20px 25px;

  & .stcp-empty-state__icon {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;

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

    &::after {
      inset: -3px;
    }
  }

  & .stcp-empty-state__title {
    font-size: 1.2em;
  }

  & .stcp-empty-state__message {
    font-size: 1.1em;
    margin-bottom: 20px;
  }

  & .stcp-empty-state__divider {
    margin-bottom: 20px;
  }
}
