/* =================================================================
   DESIGN SYSTEM FINETIPS — Estilos Globais
   Arquivo: styles.css
   Descrição: Reset CSS, variáveis de tema (Light/Dark), tipografia
              global e classes utilitárias.
   ================================================================= */

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

/* Bloqueia TODAS as transições durante o carregamento da página para
   evitar o flash/piscar ao navegar entre páginas (light e dark).
   A classe é removida por JS após DOMContentLoaded. */
.no-transition,
.no-transition *,
.no-transition *::before,
.no-transition *::after {
  transition: none !important;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--bg-color);
  transition: background-color 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---- Variáveis CSS — Tema Light (Padrão) ---- */
:root {
  --primary-color: #FF5D00;
  --primary-hover: #FF8533;
  --primary-pressed: #E64A00;
  --primary-light: #FCF4F2;
  --primary-light-hover: #FCE8E4;

  --text-color: #1E293B;
  --text-secondary: #64748B;
  --text-tertiary: #94A3B8;
  --text-on-primary: #FFFFFF;

  --bg-color: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-surface-hover: #F8FAFC;
  --bg-sidebar: #FFFFFF;
  --bg-header: #FFFFFF;
  --bg-secondary: #F1F5F9;
  --bg-tertiary: #E2E8F0;

  --text-primary: #1E293B;

  --border-color: #E2E8F0;
  --border-hover: #CBD5E1;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);

  --disabled-bg: #F1F5F9;
  --disabled-text: #94A3B8;
  --disabled-border: #E2E8F0;

  --sidebar-hover-bg: #FAF9F9;

  --font-heading: 'Manrope', sans-serif;
  --font-body: 'Inter', sans-serif;

  --tag-blue-bg: #EFF6FF;
  --tag-blue-border: #3B82F6;
  --tag-blue-text: #2563EB;
  --tag-orange-bg: #FFF7ED;
  --tag-orange-border: #F97316;
  --tag-orange-text: #EA580C;
  --tag-purple-bg: #F5F3FF;
  --tag-purple-border: #8B5CF6;
  --tag-purple-text: #7C3AED;
  --tag-green-bg: #F0FDF4;
  --tag-green-border: #22C55E;
  --tag-green-text: #16A34A;

  --tag-blue-hover-bg: #DBEAFE;
  --tag-orange-hover-bg: #FED7AA;
  --tag-purple-hover-bg: #EDE9FE;
  --tag-green-hover-bg: #BBF7D0;

  --tag-blue-pressed-bg: #3B82F6;
  --tag-orange-pressed-bg: #F97316;
  --tag-purple-pressed-bg: #8B5CF6;
  --tag-green-pressed-bg: #22C55E;

  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-2xl: 48px;
  --spacing-3xl: 64px;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;

  --sidebar-width: 250px;
}

/* ---- Variáveis CSS — Tema Dark ---- */
body.dark-mode {
  --primary-color: #FF5D00;
  --primary-hover: #FF8533;
  --primary-pressed: #E64A00;
  --primary-light: rgba(255, 93, 0, 0.3);
  --primary-light-hover: rgba(255, 93, 0, 0.4);

  --text-color: #E2E8F0;
  --text-secondary: #94A3BB;
  --text-tertiary: #64748B;
  --text-on-primary: #FFFFFF;

  --bg-color: #050E30;
  --bg-surface: #081648;
  --bg-surface-hover: #0D1F5C;
  --bg-sidebar: #081648;
  --bg-header: #081648;
  --bg-secondary: #1a2a66;
  --bg-tertiary: #1E293B;

  --text-primary: #E2E8F0;

  --border-color: #314363;
  --border-hover: #475569;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.3);

  --disabled-bg: #1E293B;
  --disabled-text: #475569;
  --disabled-border: #334155;

  --sidebar-hover-bg: rgba(65, 86, 123, 0.2);

  --tag-blue-bg: #1E3A5F;
  --tag-blue-border: #3B82F6;
  --tag-blue-text: #60A5FA;
  --tag-orange-bg: rgba(255, 93, 0, 0.2);
  --tag-orange-border: rgba(255, 93, 0, 0.5);
  --tag-orange-text: #FF5D00;
  --tag-purple-bg: #2E1065;
  --tag-purple-border: #8B5CF6;
  --tag-purple-text: #A78BFA;
  --tag-green-bg: #14532D;
  --tag-green-border: #22C55E;
  --tag-green-text: #4ADE80;

  --tag-blue-hover-bg: #1E40AF;
  --tag-orange-hover-bg: #9A3412;
  --tag-purple-hover-bg: #5B21B6;
  --tag-green-hover-bg: #166534;

  --tag-blue-pressed-bg: #3B82F6;
  --tag-orange-pressed-bg: #F97316;
  --tag-purple-pressed-bg: #8B5CF6;
  --tag-green-pressed-bg: #22C55E;
}

/* ---- Tipografia ---- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-color);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; color: var(--primary-color); }
h4 { font-size: 1.125rem; }

p {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.7;
}

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

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

ul, ol {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

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

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

/* ---- Layout Principal ---- */
.dsys-layout {
  display: flex;
  min-height: 100vh;
}

.dsys-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

.dsys-content {
  padding: var(--spacing-xl) var(--spacing-2xl) 96px;
  max-width: 900px;
  margin: 0 auto;
}

/* ---- Seções de Componentes ---- */
.component-category {
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  padding: var(--spacing-xl) var(--spacing-2xl);
  margin-bottom: var(--spacing-xl);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: background-color var(--transition-normal), box-shadow var(--transition-normal);
}

.component-category h1 {
  margin-bottom: var(--spacing-md);
}

.component-category h2 {
  margin-bottom: 0;
  padding-bottom: 0;
}

.component-section {
  padding-bottom: var(--spacing-xl);
  margin-bottom: var(--spacing-xl);
  border-bottom: 1px solid var(--border-color);
}

.component-section--no-border {
  border-bottom: none;
}

.component-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.component-section h3 {
  margin-bottom: var(--spacing-sm);
}

.component-section > p {
  margin-bottom: var(--spacing-lg);
}

.component-preview {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--spacing-md);
}

/* ---- Utilitários ---- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ---- Dashboard ---- */
.dashboard-header {
  margin-bottom: var(--spacing-2xl);
}

.dashboard-header h1 {
  margin-bottom: var(--spacing-sm);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: var(--spacing-lg);
}

.dashboard-card {
  display: flex;
  flex-direction: column;
  padding: var(--spacing-xl);
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  transition: all var(--transition-normal);
  border: 1px solid var(--border-color);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.dashboard-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary-color);
  transform: translateY(-2px);
}

.dashboard-card-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #FCF4F2;
  border: 1px solid #FF5D00;
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-md);
  color: var(--primary-color);
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

body.dark-mode .dashboard-card-icon {
  background: rgba(255, 93, 0, 0.18);
  border-color: #FF5D00;
}

.dashboard-card-icon svg {
  width: 24px;
  height: 24px;
}

.dashboard-card-arrow {
  display: none;
}

.dashboard-card h3 {
  font-size: 1rem;
  margin-bottom: var(--spacing-sm);
}

.dashboard-card p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin: 0;
}

body.dark-mode .dashboard-card p {
  color: #E2E8F0;
}

/* ---- Responsividade ---- */
@media (max-width: 1024px) {
  .dsys-main {
    margin-left: 0;
  }

  .dsys-content {
    padding: var(--spacing-lg) var(--spacing-lg);
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }

  .dashboard-card {
    flex-direction: row;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
  }

  .dashboard-card-icon {
    margin-bottom: 0;
    flex-shrink: 0;
  }

  .dashboard-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
  }

  .dashboard-card-content h3 {
    margin-bottom: var(--spacing-xs);
  }

  .dashboard-card-content p {
    margin: 0;
  }

  .dashboard-card-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: var(--text-tertiary);
    flex-shrink: 0;
  }

  .dashboard-card-arrow svg {
    width: 20px;
    height: 20px;
  }
}

@media (max-width: 768px) {
  .dsys-content {
    padding: var(--spacing-md) var(--spacing-lg);
  }

  .component-category {
    padding: var(--spacing-lg) var(--spacing-md);
    border-radius: var(--radius-lg);
  }

  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
  h3 { font-size: 1.1rem; }
}

@media (max-width: 480px) {
  .component-preview {
    gap: var(--spacing-sm);
  }
}
