/* Configurações Styles */

.configuracoes-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  box-sizing: border-box;
  padding: 0 8px;
}

.configuracoes-container > * {
  width: 100%;
  max-width: 460px;
  box-sizing: border-box;
}

.configuracoes-container hr {
  border: none;
  border-top: 1px solid #4a5568;
  margin: 8px 0;
}

.config-btn {
  background: #17acaf;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 18px;
  font-size: 1.08rem;
  font-weight: bold;
  cursor: pointer;
  margin-bottom: 4px;
  transition: background 0.2s;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.config-btn:hover {
  background: #17acaf22;
}

#btn-apagar-todos {
  background: #e53e3e !important;
}

#btn-apagar-todos:hover {
  background: #c53030 !important;
}

/* Estilos para integração com Google Sheets */
.sheets-integration {
  background: #232b38;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
  border: 2px solid #17acaf;
  box-shadow: 0 4px 16px rgba(49, 130, 206, 0.1);
  box-sizing: border-box;
}

.sheets-integration h3 {
  color: #17acaf;
  font-size: 1.2rem;
  font-weight: bold;
  margin-bottom: 16px;
  text-align: center;
}

.sheets-config {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.buttonscfg {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
  align-items: center;
}

.url-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 16px;
}

.url-buttons button {
  flex: 1;
  min-width: 120px;
}

.sheets-config input {
  flex: 1;
  min-width: 0;
  width: 100%;
  background: #2d3748;
  color: #fff;
  border: 2px solid #4a5568;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 1rem;
  transition: border 0.2s;
  box-sizing: border-box;
}

.sheets-config input:focus {
  border: 2px solid #17acaf;
  outline: none;
}

.sheets-config button {
  background: #17acaf;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px 16px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
  box-sizing: border-box;
  min-width: 0;
}

.sheets-config button:hover {
  background: #17acaf22;
}

/* Botão Limpar URL com estilo diferenciado */
#btn-clear-url {
  background: #e53e3e;
}

#btn-clear-url:hover {
  background: #c53030;
}

#btn-clear-url:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Botão Enviar dados com destaque */
#btn-enviar-dados {
  background: #805ad5 !important;
}

#btn-enviar-dados:hover {
  background: #6b46c1 !important;
}

#urlStatus {
  margin-top: 8px;
  font-size: 0.9rem;
}

.sheets-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.sheets-actions button {
  background: #17acaf;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 10px 16px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
  width: 100%;
  margin-bottom: 5px;
}

.sheets-actions button:hover {
  background: #17acaf22;
}

.sheets-status {
  text-align: center;
  padding: 8px;
  border-radius: 6px;
  font-weight: bold;
  min-height: 20px;
}

.sheets-status.success {
  background: rgba(56, 161, 105, 0.2);
  color: #17acaf;
  border: 1px solid #17acaf;
}

.sheets-status.error {
  background: rgba(229, 62, 62, 0.2);
  color: #e53e3e;
  border: 1px solid #e53e3e;
}

@media (max-width: 600px) {
  .configuracoes-container {
    padding: 0 8px;
    max-width: calc(100vw - 16px);
    width: calc(100vw - 16px);
  }

  .configuracoes-container > * {
    max-width: 100%;
    width: 100%;
  }

  .sheets-config {
    flex-direction: column;
    text-align: center;
  }

  .sheets-config input {
    min-width: 0;
    width: 100%;
    text-align: center;
  }

  .sheets-integration {
    padding: 8px;
    margin-bottom: 16px;
    width: 100%;
    max-width: 100%;
  }
  
  .estoque-status {
    padding: 8px;
  }

  .buttonscfg {
    flex-direction: column;
    gap: 8px;
  }

  .url-buttons {
    flex-direction: column;
    gap: 8px;
  }

  .url-buttons button {
    min-width: 0;
    width: 100%;
  }

  .sheets-config button {
    width: 100%;
    min-width: 0;
    white-space: normal;
    word-wrap: break-word;
  }

  .sync-btn {
    width: 100%;
    max-width: 100%;
    font-size: 16px;
  }

  .config-btn {
    font-size: 1rem;
    padding: 10px 12px;
    white-space: normal;
    word-wrap: break-word;
  }
}

.sync-btn {
  width: 100%;
  max-width: 200px;
  height: 50px;
  background: #17acaf;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

.sync-btn:hover {
  background: #2c5282;
  transform: scale(1.05);
}

.sync-btn:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.sync-btn .loading-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 4px;
  width: 0;
  border-radius: 0;
  transition: width 0.3s ease, background-color 0.3s ease;
}

.sync-btn .loading-bar.loading {
  animation: loadingProgress 3s ease-in-out forwards;
}

@keyframes loadingProgress {
  0% {
    width: 0%;
    background-color: #17acaf;
    height: 30%;
  }

  33% {
    width: 33%;
    background-color: #ecc94b;
    height: 30%;
  }

  66% {
    width: 66%;
    background-color: #38a169;
    height: 30%;
  }

  100% {
    width: 100%;
    background-color: #38a169;
    height: 30%;
  }
}

@keyframes loadingError {
  0% {
    width: 0%;
    background-color: #17acaf;
    height: 30%;
  }

  50% {
    width: 50%;
    background-color: #ecc94b;
    height: 30%;
  }

  100% {
    width: 100%;
    background-color: #e53e3e;
    height: 30%;
  }
}

.sync-btn .loading-bar.error {
  animation: loadingError 2s ease-in-out forwards;
}

.sync-status {
  font-size: 14px;
  font-weight: 500;
}

.sync-status.sync-success {
  color: #143e28;
}

.sync-status.sync-error {
  color: #e53e3e;
}

.sync-status.sync-syncing {
  color: #ecc94b;
}

/* Barra de progresso nas configurações */
.sync-progress {
  margin-top: 12px;
  padding: 8px;
  background: #2d3748;
  border-radius: 6px;
  border: 1px solid #4a5568;
  width: 100%;
  box-sizing: border-box;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #4a5568;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #17acaf, #38a169);
  border-radius: 4px;
  animation: progressAnimation 4s ease-in-out forwards;
}

@keyframes progressAnimation {
  0% {
    width: 0%;
  }

  25% {
    width: 30%;
  }

  50% {
    width: 60%;
  }

  75% {
    width: 85%;
  }

  100% {
    width: 100%;
  }
}

.progress-text {
  font-size: 0.9rem;
  color: #a0aec0;
  text-align: center;
  display: block;
}

/* Estilos para popup do README */
.readme-content {
  text-align: left;
  max-height: 400px;
  overflow-y: auto;
  padding: 10px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.readme-content h1 {
  color: #17acaf;
  font-size: 1.5rem;
  margin: 1rem 0 0.8rem 0;
  border-bottom: 2px solid #17acaf;
  padding-bottom: 0.5rem;
}

.readme-content h2 {
  color: #38a169;
  font-size: 1.2rem;
  margin: 1.2rem 0 0.6rem 0;
  border-bottom: 1px solid #38a169;
  padding-bottom: 0.3rem;
}

.readme-content h3 {
  color: #3182ce;
  font-size: 1.1rem;
  margin: 1rem 0 0.5rem 0;
  font-weight: 600;
}

.readme-content li {
  margin: 0.4rem 0;
  line-height: 1.5;
  list-style-type: disc;
  margin-left: 1.5rem;
}

.readme-content strong {
  color: #ecc94b;
  font-weight: 600;
}

.readme-content code {
  background: #2d3748;
  color: #e2e8f0;
  padding: 3px 6px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
}

.readme-content hr {
  border: none;
  border-top: 2px solid #4a5568;
  margin: 1.5rem 0;
}

.readme-content p {
  margin: 0.8rem 0;
  line-height: 1.6;
}

/* Estilos para status do estoque */
.estoque-status {
  background: #2d3748;
  border-radius: 8px;
  padding: 12px;
  margin-top: 12px;
  border: 1px solid #4a5568;
}

.estoque-status p {
  margin: 0;
  font-size: 0.9rem;
  color: #a0aec0;
}

.estoque-status.success {
  background: rgba(56, 161, 105, 0.1);
  border-color: #38a169;
}

.estoque-status.success p {
  color: #38a169;
}

.estoque-status.error {
  background: rgba(229, 62, 62, 0.1);
  border-color: #e53e3e;
}

.estoque-status.error p {
  color: #e53e3e;
}

#btnCriarAbaEstoque {
  background: #17acaf;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.9rem;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.2s;
}

#btnCriarAbaEstoque:hover {
  background: #17acaf22;
}

#btnTestarConexao {
  background: linear-gradient(135deg, #17acaf, #117f81);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(49, 130, 206, 0.3);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

#btnTestarConexao:before {
  content: "\f0c1";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  font-size: 1rem;
  color: #17acaf;
}

#btnTestarConexao:hover {
  background: linear-gradient(135deg, #2c5282, #2a69ac);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(49, 130, 206, 0.4);
}

#btnTestarConexao:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(49, 130, 206, 0.3);
}

#btnTestarConexao:disabled {
  background: #4a5568;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

#btnTestarConexao:disabled:before {
  content: "\f017";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  color: #ecc94b;
}

/* Estilos para feedback visual do botão Salvar URL */
#btn-save-url {
  position: relative;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

#btn-save-url.loading {
  background: #ecc94b !important;
  cursor: not-allowed;
}

#btn-save-url.success {
  background: #38a169 !important;
}

#btn-save-url.error {
  background: #e53e3e !important;
}

.loading-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-right: 6px;
}

.loading-spinner-small {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #4a5568;
  border-top: 2px solid #17acaf;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Barra de progresso para salvar URL */
.save-url-progress {
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  background: #2d3748;
  border-radius: 6px;
  border: 1px solid #4a5568;
  box-sizing: border-box;
}

.save-url-progress .progress-text {
  font-size: 0.9rem;
  color: #ecc94b;
  text-align: center;
  margin-bottom: 8px;
  font-weight: 500;
}

.progress-bar-container {
  width: 100%;
  height: 6px;
  background: #4a5568;
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #17acaf, #38a169);
  border-radius: 3px;
  width: 0%;
  transition: width 0.5s ease;
}

/* Estilos para status de integração */
.integration-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  background: #2d3748;
  border: 1px solid #4a5568;
  margin-bottom: 16px;



  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  background: #2d3748;
  border: 1px solid #4a5568;
  margin-bottom: 16px;
}

.integration-status.connected {
  background: rgba(56, 161, 105, 0.1);
  border-color: #38a169;
}

.integration-status.error {
  background: rgba(229, 62, 62, 0.1);
  border-color: #e53e3e;
}

.status-icon {
  font-size: 1.2rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  text-align: center;
  position: relative;
}

.status-icon .loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #4a5568;
  border-top: 2px solid #17acaf;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.status-text {
  flex: 1;
  font-size: 0.9rem;
  text-align: center;
}

.status-text strong {
  color: #e2e8f0;
}

/* Estilos para status das abas */
.sheets-tabs-status {
  background: #2d3748;
  border-radius: 8px;
  padding: 0px 15px;
  margin-bottom: 16px;
  border: 1px solid #4a5568;
}

.tab-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #4a5568;
}

.tab-status:last-child {
  border-bottom: none;
}

.tab-icon {
  font-size: 1.1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  text-align: center;
}

.tab-name {
  flex: 1;
  font-size: 0.9rem;
  color: #e2e8f0;
}

.tab-status-indicator {
  font-size: 1.1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  text-align: center;
}

.btn-create-tab {
  background: #805ad5;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 0.8rem;
  cursor: pointer;
  margin-left: 8px;
  transition: background 0.2s;
}

.btn-create-tab:hover {
  background: #6b46c1;
}