/*
  ==========================================
  BASE.CSS - Semantyq
  ==========================================
  Reset moderno, tipografia, containers
  e estruturas globais de layout
*/

/* ========== RESET MODERNO ========== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

@font-face {
  font-family: "Nunito";
  src: url("../fonts/Nunito-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Nunito";
  src: url("../fonts/Nunito-Medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Nunito";
  src: url("../fonts/Nunito-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Nunito";
  src: url("../fonts/Nunito-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --font-body: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--background);
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

h1 {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 2rem;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 1.5rem;
}

h4 {
  font-size: 1.25rem;
}

p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:not(.btn):not(.btn-sem):hover {
  color: var(--accent);
}

ul, ol {
  list-style: none;
}

img, svg {
  max-width: 100%;
  display: block;
}

button {
  font-family: inherit;
  border: none;
  cursor: pointer;
  background: none;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  border: none;
  outline: none;
}

/* ========== FORMS ========== */
.form-control {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--background);
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.2s ease;
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-alpha);
}

.form-control:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

textarea.form-control {
  min-height: 180px;
  resize: vertical;
  line-height: 1.6;
}

input[type="number"].form-control {
  max-width: 200px;
}

.form-label {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.form-error {
  color: var(--error);
  font-size: 0.875rem;
  margin-top: 4px;
}

.form-group {
  display: grid;
  gap: 8px;
}

.form-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

.form-grid-2 {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid-3 {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
}

/* ========== CONTAINERS ========== */
.container {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 24px;
  padding-right: 24px;
}

.container-wide {
  width: 100%;
  max-width: 1440px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 32px;
  padding-right: 32px;
}

.container-narrow {
  width: 100%;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 24px;
  padding-right: 24px;
}

/* ========== LAYOUT WRAPPER ========== */
.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-content {
  flex: 1;
  padding-top: 72px; /* Compensar navbar fixa */
  padding-bottom: 40px;
}

/* ========== FOOTER ========== */
.site-footer {
  padding: 60px 0 40px;
}

/* ========== SECTION ========== */
.section {
  padding: 64px 0;
}

.section-hero {
  padding: 5px 0 80px 0;
}

@media (max-width: 768px) {
  .main-content {
    padding-top: 64px;
  }

  .section-hero {
    padding: 0 0 48px 0;
  }
}

/* ========== GRID SYSTEM ========== */
.grid {
  display: grid;
  gap: 24px;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

/* ========== FLEX HELPERS ========== */
.flex {
  display: flex;
}

.flex-col {
  display: flex;
  flex-direction: column;
}

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

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-wrap {
  flex-wrap: wrap;
}

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

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

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

/* ========== CARD BASE ========== */
.card {
  background-color: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  transition: all 0.3s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
}

/* ========== ALERTS ========== */
.alert {
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text-primary);
  text-align: justify;
}

.alert-success {
  border-color: var(--success);
  background: var(--success-alpha);
  color: var(--success);
}

.alert-danger {
  border-color: var(--error);
  background: var(--error-alpha);
  color: var(--error);
}

.alert-warning {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.12);
  color: #fcd34d;
}

/* ========== TABLE ========== */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.table thead th {
  background: var(--background);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.875rem;
  text-align: left;
}

.table tbody tr {
  transition: background-color 0.2s ease;
}

.table-hover tbody tr:hover {
  background: var(--background);
}

.table td.table-actions,
.table th.table-actions {
  text-align: right;
}

/* ========== BUTTON BASE ========== */
.btn {
  --btn-radius: 6px;
  --btn-h-md: 44px;
  --btn-py-md: 12px;
  --btn-px-md: 24px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--btn-h-md);
  padding: var(--btn-py-md) var(--btn-px-md);
  border-radius: var(--btn-radius);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  outline: none;
  text-decoration: none;
  white-space: nowrap;
  gap: 8px;
}

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

/* ========== INPUT BASE ========== */
.input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background-color: var(--card-bg);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-alpha);
}

.input::placeholder {
  color: var(--text-muted);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.75rem;
  }

  .section {
    padding: 48px 0;
  }

  .section-hero {
    padding: 80px 0 48px 0;
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .card {
    padding: 24px;
  }

  .container,
  .container-narrow {
    padding-left: 16px;
    padding-right: 16px;
  }

  .form-control {
    min-height: 44px;
    padding: 11px 14px;
    font-size: 16px;
  }

  textarea.form-control {
    min-height: 140px;
  }

  input[type="number"].form-control {
    max-width: 100%;
  }

  .form-grid-2,
  .form-grid-3 {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .form-actions {
    justify-content: stretch;
    align-items: stretch;
    gap: 10px;
  }

  .form-actions .btn,
  .form-actions button,
  .form-actions a {
    width: 100%;
  }

  /* HERO BUTTONS - STACK EM MOBILE */
  .section-hero .flex.gap-16 {
    flex-direction: column !important;
    gap: 12px !important;
  }

  .section-hero .flex > a,
  .section-hero .flex > button {
    width: 100% !important;
  }

  /* CTA BUTTONS - STACK EM MOBILE */
  .cta-actions.flex.gap-16 {
    flex-direction: column !important;
    gap: 12px !important;
    justify-content: stretch !important;
    align-items: stretch !important;
  }

  .cta-actions > a {
    width: 100% !important;
    text-align: center !important;
  }

  /* Ajustar card CTA padding */
  .cta-card {
    padding: 28px 24px !important;
  }

  /* Ajustar tamanho dos botões em mobile tablet */
  .btn-lg {
    min-height: 44px !important;
    padding: 10px 20px !important;
    font-size: 0.95rem !important;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 15px;
  }

  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  .btn {
    padding: 10px 20px;
    font-size: 0.9rem;
  }

  .btn-lg {
    min-height: 42px !important;
    padding: 10px 16px !important;
    font-size: 0.9rem !important;
  }

  .form-label {
    margin-bottom: 6px;
    font-size: 0.92rem;
  }

  /* HERO - Stack buttons ainda mais compacto */
  .section-hero .flex.gap-16 {
    flex-direction: column !important;
    gap: 10px !important;
    align-items: stretch !important;
  }

  .section-hero .flex > a {
    width: 100% !important;
  }

  .section-hero .flex > .btn-sem {
    width: 100% !important;
  }

  /* CTA - Stack buttons ainda mais compacto */
  .cta-actions.flex.gap-16 {
    flex-direction: column !important;
    gap: 10px !important;
    justify-content: stretch !important;
    align-items: stretch !important;
  }

  .cta-actions > a {
    width: 100% !important;
  }

  /* Remover padding do card em telas muito pequenas */
  .cta-card {
    padding: 20px !important;
  }

  .cta-card h2 {
    font-size: 1.5rem;
    margin-bottom: 12px;
  }

  .cta-card p {
    font-size: 0.9rem;
    margin-bottom: 20px;
  }

  .mt-40 {
    margin-top: 20px !important;
  }
}

/* ========== SWEETALERT2 THEME ========== */
body.theme-light .swal2-popup,
html.theme-light body .swal2-popup {
  background: var(--card-bg);
  color: var(--text-primary);
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.06);
}

body.theme-dark .swal2-popup,
html.theme-dark body .swal2-popup {
  background: var(--card-bg);
  color: var(--text-primary);
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

body.theme-dark .swal2-title,
body.theme-dark .swal2-html-container {
  color: var(--text-primary);
}

body.theme-dark .swal2-icon.swal2-info,
body.theme-dark .swal2-icon.swal2-success,
body.theme-dark .swal2-icon.swal2-warning,
body.theme-dark .swal2-icon.swal2-error,
body.theme-dark .swal2-icon.swal2-question {
  color: var(--primary);
  border-color: var(--primary);
}

body.theme-dark .swal2-loader {
  border-color: var(--primary) transparent var(--primary) transparent;
}

body.theme-dark .swal2-confirm {
  background: var(--primary) !important;
  color: #fff !important;
  box-shadow: none !important;
}

body.theme-dark .swal2-cancel {
  background: var(--surface-2) !important;
  color: var(--text-primary) !important;
}
body[data-guided-tours-enabled="false"] [data-analysis-tour-start],
body[data-guided-tours-enabled="false"] [data-analysis-create-tour-start],
body[data-guided-tours-enabled="false"] [data-analysis-list-tour-start],
body[data-guided-tours-enabled="false"] [data-analysis-settings-tour-start] {
  display: none !important;
}
