/* ============================================
   UAN FLOW - Design System CSS
   ============================================ */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&family=DM+Sans:wght@400;500;600&display=swap');

/* CSS Variables */
:root {
  /* Brand Colors */
  --sage: #9CA998;
  --stack: #899689;
  --slate-gray: #707F84;
  --morning-blue: #9AACAB;
  --sour-dough: #CAB99E;
  --cararra: #F0EDE6;
  
  /* Semantic Colors */
  --success: #4a7a46;
  --success-light: #e8f5e9;
  --warning: #8a6930;
  --warning-light: #fff8e6;
  --danger: #c45c5c;
  --danger-light: #ffebee;
  --info: #4a5c5b;
  --info-light: #e8f4f4;
  
  /* Text Colors */
  --text-primary: #3a4636;
  --text-secondary: #707F84;
  --text-muted: #9AACAB;
  
  /* Background Colors */
  --bg-primary: #F0EDE6;
  --bg-white: #ffffff;
  --bg-subtle: #f8f7f4;
  
  /* Border */
  --border-color: #e8e5de;
  --border-radius: 12px;
  --border-radius-sm: 8px;
  --border-radius-lg: 16px;
  
  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
  
  /* Typography */
  --font-primary: 'Plus Jakarta Sans', sans-serif;
  --font-secondary: 'DM Sans', sans-serif;
  
  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s ease;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  /* scroll-behavior: smooth; - removido para evitar bugs */
}

body {
  font-family: var(--font-primary);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.875rem; }

p {
  color: var(--text-secondary);
}

a {
  color: var(--stack);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--sage);
}

/* ============================================
   Layout Components
   ============================================ */

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px;
}

.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Demo Frame */
.demo-frame {
  background: var(--bg-primary);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  margin: 20px;
}

/* ============================================
   Header / Navigation
   ============================================ */

.main-header {
  background: var(--stack);
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo {
  width: 40px;
  height: 40px;
  background: var(--cararra);
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.header-title {
  color: white;
  font-size: 18px;
  font-weight: 600;
}

.header-subtitle {
  color: rgba(255,255,255,0.7);
  font-size: 12px;
}

.header-nav {
  display: flex;
  gap: 8px;
}

.header-btn {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  padding: 10px 16px;
  border-radius: var(--border-radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: background var(--transition-fast);
  font-family: var(--font-primary);
}

.header-btn:hover {
  background: rgba(255,255,255,0.3);
}

.header-btn.primary {
  background: white;
  color: var(--stack);
  font-weight: 500;
}

.header-btn.primary:hover {
  background: var(--cararra);
}

/* ============================================
   Sidebar Navigation
   ============================================ */

.app-layout {
  display: flex;
  min-height: calc(100vh - 72px);
}

.sidebar {
  width: 260px;
  background: white;
  border-right: 1px solid var(--border-color);
  padding: 20px 0;
  overflow-y: auto;
}

.sidebar-section {
  margin-bottom: 24px;
}

.sidebar-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0 20px;
  margin-bottom: 8px;
}

.sidebar-menu {
  list-style: none;
}

.sidebar-item {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition-fast);
  border-left: 3px solid transparent;
}

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

.sidebar-item.active {
  background: var(--success-light);
  color: var(--success);
  border-left-color: var(--success);
  font-weight: 500;
}

.sidebar-item-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

.sidebar-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}

/* ============================================
   Main Content Area
   ============================================ */

.main-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  background: var(--bg-primary);
}

.page-header {
  margin-bottom: 24px;
}

.page-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.page-description {
  font-size: 14px;
  color: var(--text-secondary);
}

/* ============================================
   Cards
   ============================================ */

.card {
  background: white;
  border-radius: var(--border-radius);
  padding: 20px;
  border: 1px solid var(--border-color);
  transition: box-shadow var(--transition-normal);
}

.card:hover {
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.card-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Stat Cards */
.stat-card {
  background: white;
  border-radius: var(--border-radius);
  padding: 20px;
  border: 1px solid var(--border-color);
}

.stat-card.success {
  background: var(--success-light);
  border-color: transparent;
}

.stat-card.warning {
  background: var(--warning-light);
  border-color: transparent;
}

.stat-card.danger {
  background: var(--danger-light);
  border-color: transparent;
}

.stat-card.info {
  background: var(--info-light);
  border-color: transparent;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-card.success .stat-value { color: var(--success); }
.stat-card.warning .stat-value { color: var(--warning); }
.stat-card.danger .stat-value { color: var(--danger); }
.stat-card.info .stat-value { color: var(--info); }

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.stat-icon {
  font-size: 24px;
  float: right;
}

/* ============================================
   Buttons
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--border-radius-sm);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
}

.btn-primary {
  background: var(--stack);
  color: white;
}

.btn-primary:hover {
  background: var(--slate-gray);
}

.btn-secondary {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 12px;
}

.btn-lg {
  padding: 16px 32px;
  font-size: 16px;
}

/* ============================================
   Forms
   ============================================ */

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  font-size: 14px;
  font-family: var(--font-primary);
  background: white;
  color: var(--text-primary);
  transition: border-color var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--stack);
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

/* ============================================
   Tables
   ============================================ */

.table-container {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.table th {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  background: var(--bg-subtle);
}

.table td {
  font-size: 14px;
  color: var(--text-primary);
}

.table tr:hover td {
  background: var(--bg-subtle);
}

/* ============================================
   Tags & Badges
   ============================================ */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
}

.tag-success {
  background: var(--success-light);
  color: var(--success);
}

.tag-warning {
  background: var(--warning-light);
  color: var(--warning);
}

.tag-danger {
  background: var(--danger-light);
  color: var(--danger);
}

.tag-info {
  background: var(--info-light);
  color: var(--info);
}

.tag-neutral {
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

/* ============================================
   Alerts
   ============================================ */

.alert {
  padding: 14px 16px;
  border-radius: var(--border-radius-sm);
  border-left: 4px solid;
  margin-bottom: 12px;
}

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

.alert-warning {
  background: var(--warning-light);
  border-color: var(--warning);
}

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

.alert-info {
  background: var(--info-light);
  border-color: var(--info);
}

.alert-title {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
}

.alert-text {
  font-size: 12px;
  opacity: 0.85;
}

/* ============================================
   Grid System
   ============================================ */

.grid {
  display: grid;
  gap: 16px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }

@media (max-width: 1024px) {
  .grid-4, .grid-5 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }
  
  .sidebar {
    display: none;
  }
  
  .main-content {
    padding: 16px;
  }
}

/* ============================================
   Utilities
   ============================================ */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.flex { display: flex; }
.flex-center { align-items: center; }
.flex-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

/* ============================================
   Animations
   ============================================ */

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

@keyframes slideIn {
  from { transform: translateX(-20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.animate-fade {
  animation: fadeIn 0.4s ease forwards;
}

.animate-slide {
  animation: slideIn 0.3s ease forwards;
}

/* Staggered animations */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }

/* ============================================
   Demo Navigation Bar (Fixed Bottom)
   ============================================ */

.demo-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-top: 1px solid var(--border-color);
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1000;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
}

.demo-nav-info {
  font-size: 13px;
  color: var(--text-secondary);
}

.demo-nav-info strong {
  color: var(--text-primary);
}

.demo-nav-buttons {
  display: flex;
  gap: 12px;
}

.demo-nav-btn {
  padding: 10px 20px;
  border-radius: var(--border-radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-family: var(--font-primary);
}

.demo-nav-btn.prev {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.demo-nav-btn.next {
  background: var(--stack);
  border: none;
  color: white;
}

.demo-nav-btn:hover {
  transform: translateY(-1px);
}

/* Page indicator dots */
.demo-dots {
  display: flex;
  gap: 6px;
}

.demo-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-color);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.demo-dot.active {
  background: var(--stack);
  width: 24px;
  border-radius: 4px;
}

.demo-dot:hover {
  background: var(--sage);
}
