/* ═══════════════════════════════════════════════════════════════════════════
   Bora Planejar — App Dashboard CSS
   Extraído de: App Dashboard Redesign.html
   Pronto para copiar em: src/App.css
   ═══════════════════════════════════════════════════════════════════════════ */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #4F6EF7;
  --primary-dark: #3B56D4;
  --primary-light: #EEF1FE;
  --primary-lighter: #F5F7FF;
  
  --accent: #F5820D;
  --accent-light: #FFF3E5;
  
  --bg: #F4F5FA;
  --surface: #FFFFFF;
  --surface-hover: #F8F9FD;
  
  --text-primary: #111827;
  --text-secondary: #475569;
  --text-tertiary: #64748B;
  --text-inverse: #FFFFFF;
  
  --border: #E2E5F1;
  --border-light: #EFF0F6;
  
  --success: #059669;
  --success-bg: #ECFDF5;
  --warning: #D97706;
  --warning-bg: #FEF3C7;
  --error: #DC2626;
  --error-bg: #FEF2F2;
  
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.07);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.08);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
}

#root {
  min-height: 100vh;
}

/* ─────────────────────── LAYOUT ─────────────────────── */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: 260px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.app-content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
}

/* ─────────────────────── SIDEBAR ─────────────────────── */

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
  text-decoration: none;
  padding: 0.5rem;
  margin-bottom: 1rem;
}

.sidebar-logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 0.9rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.sidebar-nav-item:hover {
  background: var(--primary-lighter);
  color: var(--text-primary);
}

.sidebar-nav-item.active {
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 600;
}

.sidebar-nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.sidebar-user {
  margin-top: auto;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sidebar-user-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.9rem;
}

.sidebar-user-text {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-status {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─────────────────────── HEADER ─────────────────────── */

.header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  background: var(--success-bg);
  color: var(--success);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.header-button {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: var(--transition);
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-button:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

/* ─────────────────────── MAIN CONTENT ─────────────────────── */

.content-section {
  margin-bottom: 2rem;
}

.section-header {
  margin-bottom: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.section-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.section-action {
  font-size: 0.9rem;
}

/* ─────────────────────── CARDS ─────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: var(--transition);
}

.card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-word;
}

.card-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.card-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  background: var(--primary-lighter);
  color: var(--primary-dark);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.card-badge.secondary {
  background: var(--accent-light);
  color: var(--accent);
}

.card-actions {
  display: flex;
  gap: 0.5rem;
}

.card-action-button {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  transition: var(--transition);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-action-button:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

/* ─────────────────────── GRID ─────────────────────── */

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.cards-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ─────────────────────── BUTTONS ─────────────────────── */

.button {
  padding: 0.7rem 1.5rem;
  border-radius: var(--radius-md);
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}

.button-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(79,110,247,0.35);
}

.button-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 16px rgba(79,110,247,0.40);
}

.button-secondary {
  background: var(--surface-hover);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.button-secondary:hover {
  background: var(--border-light);
  border-color: var(--primary);
}

.button-sm {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.button-block {
  width: 100%;
  justify-content: center;
}

/* ─────────────────────── EMPTY STATE ─────────────────── */

.empty-state {
  padding: 3rem 2rem;
  text-align: center;
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.empty-state-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.empty-state-text {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

/* ─────────────────────── QUICK ACTION CARD ─────────────── */

.quick-action {
  background: linear-gradient(135deg, var(--primary-lighter) 0%, var(--accent-light) 100%);
  border: 1px solid var(--primary-light);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
}

.quick-action-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.quick-action-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.quick-action-text {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

/* ─────────────────────── STATS ─────────────────── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  text-align: center;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ─────────────────────── ANIMATIONS ─────────────────── */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; max-height: 0; }
  to { opacity: 1; max-height: 500px; }
}

.fade-in {
  animation: fadeIn 0.3s ease-out;
}

.slide-down {
  animation: slideDown 0.3s ease-out;
}

/* ─────────────────────── RESPONSIVE ─────────────────── */

@media (max-width: 768px) {
  .app-shell {
    flex-direction: column;
  }

  .app-sidebar {
    width: 100%;
    height: auto;
    position: relative;
    border-right: none;
    border-bottom: 1px solid var(--border);
    flex-direction: row;
    gap: 1rem;
    padding: 1rem;
  }

  .app-content {
    padding: 1.5rem;
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }

  .section-header {
    flex-direction: column;
    gap: 1rem;
  }
}

/* React integration: aplica o design aos componentes reais do App.tsx */
.app-shell {
  width: 100%;
  background: var(--bg);
}

.app-main {
  min-width: 0;
  background: var(--bg);
}

.app-content {
  width: 100%;
  max-width: none !important;
  margin: 0;
}

.sidebar-logo-image {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  object-fit: contain;
  background: var(--primary-lighter);
  padding: 0.25rem;
}

.app-sidebar-brand-text {
  color: var(--text-primary);
  font-weight: 800;
  letter-spacing: 0;
}

.sidebar-plan-cta {
  border-radius: var(--radius-md);
  background: var(--primary);
  box-shadow: 0 2px 8px rgba(79,110,247,0.35);
}

.sidebar-plan-cta:hover {
  background: var(--primary-dark);
}

.stat-card {
  justify-content: flex-start;
  text-align: left;
}

.stat-card:hover,
.card:hover {
  transform: translateY(-2px);
}

.app-header input {
  border: 1px solid var(--border);
  background: var(--surface-hover);
}

html,
body,
#root {
  height: 100%;
}

@media (max-width: 900px) {
  html,
  body,
  #root {
    height: 100%;
    overflow: hidden;
  }

  .app-shell {
    height: 100dvh;
    height: 100svh;
    min-height: 0;
    overflow: hidden;
  }

  .app-main {
    height: 100dvh;
    height: 100svh;
    min-height: 0;
    overflow: hidden;
  }

  .app-main--with-sidebar {
    margin-left: 0;
  }

  .app-header {
    min-height: 3.75rem;
    padding: 0.6rem 0.85rem;
  }

  .dashboard-page,
  .dashboard-page--narrow {
    height: calc(100dvh - 3.75rem);
    height: calc(100svh - 3.75rem);
    min-height: 0;
    overflow-y: auto;
    padding: 0.95rem 0.9rem 6.4rem;
  }

  .planning-wizard-page {
    height: calc(100dvh - 3.75rem);
    height: calc(100svh - 3.75rem);
    max-width: none;
    padding: 0.75rem 0.85rem 6.25rem !important;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .planning-wizard-back {
    margin-bottom: 0.65rem !important;
    min-height: 2rem;
  }

  .planning-wizard-stepper {
    flex: 0 0 auto;
    margin-bottom: 0.75rem !important;
    padding: 0.75rem !important;
    border-radius: 18px !important;
    overflow-x: auto;
  }

  .planning-wizard-stepper > div {
    min-width: max-content;
    gap: 1rem !important;
  }

  .planning-wizard-card {
    flex: 1 1 auto;
    min-height: 0 !important;
    height: auto !important;
    border-radius: 18px !important;
    overflow: hidden !important;
  }

  .planning-wizard-panel,
  .planning-wizard-panel--scroll {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none !important;
    overflow-y: auto;
    padding: 1rem !important;
  }

  .planning-result-scroll {
    padding: 0.85rem !important;
    gap: 1rem !important;
  }

  .planning-result-actions {
    align-items: stretch !important;
    border-radius: 16px !important;
    padding: 0.7rem !important;
  }

  .planning-result-actions > div:last-child {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .mobile-bottom-nav {
    display: grid;
  }
}
