/* ============================================================================
   SSA Esiti - Main CSS
   Stripe-inspired design system
   ============================================================================ */

/* ============================================================================
   CSS Variables & Design Tokens
   ============================================================================ */

:root {
  /* Colors - Stripe Palette */
  --color-primary: #635BFF;
  --color-primary-light: #F4F1FF;
  --color-primary-hover: #5247E3;
  --color-primary-dark: #3D36CC;

  --color-success: #30D158;
  --color-success-light: #D1F4D1;

  --color-warning: #FF9F0A;
  --color-warning-light: #FFF3CD;

  --color-danger: #FF453A;
  --color-danger-light: #FFDAD8;

  /* Neutral Colors - Clean & Professional */
  --color-neutral-bg: #F7F8FA;
  --color-neutral-bg-secondary: #FAFBFC;
  --color-neutral-border: #E5E7EB;
  --color-neutral-border-light: #F0F1F3;
  --color-neutral-text: #1F2937;
  --color-neutral-text-secondary: #6B7280;
  --color-neutral-text-tertiary: #9CA3AF;
  --color-neutral-white: #FFFFFF;

  /* Legacy color names for compatibility */
  --color-positivo: #30D158;
  --color-negativo: #FF453A;
  --color-retake: #FF9F0A;
  --color-error: #FF453A;
  --color-neutral-50: #F7F8FA;
  --color-neutral-100: #F0F1F3;
  --color-neutral-200: #E5E7EB;
  --color-neutral-300: #D1D5DB;
  --color-neutral-400: #9CA3AF;
  --color-neutral-500: #6B7280;
  --color-neutral-600: #4B5563;
  --color-neutral-700: #374151;
  --color-neutral-900: #1F2937;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-2xl: 32px;
  --space-3xl: 48px;

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.15);

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-size-xs: 12px;
  --font-size-sm: 13px;
  --font-size-base: 14px;
  --font-size-md: 15px;
  --font-size-lg: 16px;
  --font-size-xl: 18px;
  --font-size-2xl: 20px;
  --font-size-3xl: 24px;
  --font-size-4xl: 32px;

  --line-height-tight: 1.4;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.6;

  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* Layout */
  --sidebar-width: 260px;
  --topbar-height: 64px;

  /* Transitions */
  --transition-fast: 100ms ease;
  --transition-normal: 150ms ease;
  --transition-slow: 200ms ease;
  --transition-easing: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================================
   Reset & Base Styles
   ============================================================================ */

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

html,
body {
  width: 100%;
  height: 100%;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--color-neutral-text);
  background-color: var(--color-neutral-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  margin: 0;
}

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }
h5 { font-size: var(--font-size-md); }
h6 { font-size: var(--font-size-base); }

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

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

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

/* ============================================================================
   Layout: Main Structure
   ============================================================================ */

.layout {
  display: flex;
  width: 100%;
  height: 100vh;
  background-color: var(--color-neutral-bg);
}

.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background-color: var(--color-neutral-white);
  border-right: 1px solid var(--color-neutral-border-light);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  overflow-y: auto;
  z-index: 40;
  box-shadow: var(--shadow-sm);
}

.main {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Legacy class names */
#app,
.app-layout { display: flex; width: 100%; height: 100%; }
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.sidebar-nav { flex: 1; padding: var(--space-lg) 0; }
.sidebar-header { padding: var(--space-lg); border-bottom: 1px solid var(--color-neutral-border-light); }
.page-container { flex: 1; overflow-y: auto; padding: var(--space-2xl); background-color: var(--color-neutral-bg); }

/* ============================================================================
   Sidebar Components
   ============================================================================ */

.sidebar-logo {
  padding: var(--space-xl);
  border-bottom: 1px solid var(--color-neutral-border-light);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-primary);
}

.sidebar-logo img,
.sidebar-logo svg {
  width: 40px;
  height: 40px;
}

.nav-section {
  margin-bottom: var(--space-xl);
}

.nav-section-title {
  padding: 0 var(--space-lg);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  color: var(--color-neutral-text-tertiary);
  margin-bottom: var(--space-md);
  letter-spacing: 0.05em;
}

.nav-item {
  padding: var(--space-md) var(--space-lg);
  margin: var(--space-xs) var(--space-lg);
  border-radius: var(--radius-md);
  color: var(--color-neutral-text-secondary);
  cursor: pointer;
  transition: all var(--transition-normal);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  user-select: none;
}

.nav-item:hover {
  background-color: var(--color-neutral-bg);
  color: var(--color-neutral-text);
}

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

.nav-icon,
.nav-item svg,
.nav-item i {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.nav-sep {
  height: 1px;
  background-color: var(--color-neutral-border-light);
  margin: var(--space-lg) var(--space-lg);
}

.sidebar-footer {
  margin-top: auto;
  padding: var(--space-lg);
  border-top: 1px solid var(--color-neutral-border-light);
}

.user-badge {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background-color: var(--color-neutral-bg);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color var(--transition-normal);
}

.user-badge:hover {
  background-color: var(--color-neutral-border-light);
}

.user-badge img {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
}

.user-badge-info {
  display: flex;
  flex-direction: column;
}

.user-name,
.user-badge-name {
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-sm);
  color: var(--color-neutral-text);
  margin: 0;
}

.user-role,
.user-badge-email {
  font-size: var(--font-size-xs);
  color: var(--color-neutral-text-tertiary);
}

.user-info {
  padding: var(--space-md);
  background-color: var(--color-neutral-bg);
  border-radius: var(--radius-md);
}

.logout-btn {
  padding: var(--space-md);
  background-color: transparent;
  border: 1px solid var(--color-neutral-border);
  border-radius: var(--radius-md);
  color: var(--color-danger);
  cursor: pointer;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  transition: all var(--transition-normal);
}

.logout-btn:hover {
  background-color: rgba(255, 69, 58, 0.05);
  border-color: var(--color-danger);
}

/* ============================================================================
   Topbar
   ============================================================================ */

.topbar,
.top-bar {
  height: var(--topbar-height);
  background-color: var(--color-neutral-white);
  border-bottom: 1px solid var(--color-neutral-border-light);
  padding: 0 var(--space-2xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.topbar h1,
.top-bar-title {
  font-size: var(--font-size-2xl);
  color: var(--color-neutral-text);
  margin: 0;
}

.topbar-actions,
.top-bar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
}

.topbar-action {
  cursor: pointer;
  color: var(--color-neutral-text-secondary);
  transition: color var(--transition-normal);
}

.topbar-action:hover {
  color: var(--color-neutral-text);
}

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

.content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-2xl);
  background-color: var(--color-neutral-bg);
}

/* ============================================================================
   Responsive Design
   ============================================================================ */

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
    z-index: 50;
  }

  .sidebar.active,
  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    margin-left: 0;
    width: 100%;
  }
}

@media (max-width: 640px) {
  :root {
    --sidebar-width: 240px;
    --topbar-height: 56px;
    --space-xl: 16px;
    --space-2xl: 24px;
  }

  .topbar,
  .top-bar {
    padding: 0 var(--space-lg);
  }

  .topbar h1,
  .top-bar-title {
    font-size: var(--font-size-xl);
  }

  .content,
  .page-container {
    padding: var(--space-lg);
  }

  .sidebar-logo {
    padding: var(--space-lg);
  }

  .topbar-actions,
  .top-bar-actions {
    gap: var(--space-lg);
  }
}

/* ============================================================================
   Utility Classes
   ============================================================================ */

.hidden {
  display: none !important;
}

.invisible {
  visibility: hidden;
}

.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;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

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

.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }

.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }

.mt-0 { margin-top: 0; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.mb-0 { margin-bottom: 0; }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.text-xs { font-size: var(--font-size-xs); }
.text-sm { font-size: var(--font-size-sm); }
.text-base { font-size: var(--font-size-base); }
.text-lg { font-size: var(--font-size-lg); }
.text-xl { font-size: var(--font-size-xl); }

.font-normal { font-weight: var(--font-weight-normal); }
.font-medium { font-weight: var(--font-weight-medium); }
.font-semibold { font-weight: var(--font-weight-semibold); }
.font-bold { font-weight: var(--font-weight-bold); }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.text-primary { color: var(--color-primary); }
.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-danger { color: var(--color-danger); }
.text-secondary { color: var(--color-neutral-text-secondary); }
.text-tertiary { color: var(--color-neutral-text-tertiary); }
.text-muted { color: var(--color-neutral-text-tertiary); }

.bg-primary { background-color: var(--color-primary); }
.bg-success { background-color: var(--color-success); }
.bg-warning { background-color: var(--color-warning); }
.bg-danger { background-color: var(--color-danger); }
.bg-white { background-color: var(--color-neutral-white); }

.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

.cursor-pointer { cursor: pointer; }
.cursor-default { cursor: default; }

.w-full { width: 100%; }
.max-w-full { max-width: 100%; }

.opacity-50 { opacity: 0.5; }
.opacity-75 { opacity: 0.75; }

.transition { transition: all var(--transition-normal); }
