/* 📱 FocusPoint CRM - Responsive Design System */

/* ================================================
   🏢 ABSA LOGO RESPONSIVE SYSTEM
   ================================================ */
.absa-logo {
  display: inline-block;
  vertical-align: middle;
  transition: opacity 0.3s ease;
  line-height: 1;
}

.absa-logo img {
  height: auto;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  display: block;
}

/* Logo size variants */
.absa-logo--large img {
  max-height: 60px;
}

.absa-logo--medium img {
  max-height: 36px;
}

.absa-logo--small img {
  max-height: 28px;
}

.absa-logo--tiny img {
  max-height: 20px;
}

.absa-logo--icon img {
  max-height: 18px;
}

/* Context variants */
.absa-logo--nav {
  margin-right: var(--space-sm, 0.5rem);
}

.absa-logo--header {
  margin-right: var(--space-md, 1rem);
}

/* Mobile responsive behavior */
@media (max-width: 640px) {
  .absa-logo--large img {
    max-height: 40px;
  }
  
  .absa-logo--medium img {
    max-height: 32px;
  }
  
  .absa-logo--small img {
    max-height: 24px;
  }
  
  .absa-logo--nav {
    margin-right: var(--space-xs, 0.25rem);
  }
}

@media (max-width: 480px) {
  .absa-logo--large img {
    max-height: 32px;
  }
  
  .absa-logo--medium img {
    max-height: 28px;
  }
}

/* Visual effects integrated with current system */
.absa-logo:hover {
  opacity: 0.8;
}

.absa-logo--with-shadow img {
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.1));
}

.absa-logo--brand-integration {
  display: flex;
  align-items: center;
  gap: var(--space-sm, 0.5rem);
}

/* Brand integration with FocusPoint */
.brand-integration {
  display: flex;
  align-items: center;
  gap: var(--space-xs, 0.25rem);
  font-weight: 600;
  color: var(--text-primary, #1f2937);
}

.brand-integration__separator {
  font-size: 0.875rem;
  color: var(--text-secondary, #6b7280);
  font-weight: 400;
}

.brand-integration__focuspoint {
  color: var(--primary-600, #2563eb);
  font-weight: 700;
}

/* Footer brand integration */
.footer-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm, 0.5rem);
  padding: var(--space-md, 1rem);
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  border-top: 1px solid var(--border-color, #e5e7eb);
  margin-top: var(--space-xl, 2rem);
}

@media (max-width: 640px) {
  .footer-brand {
    flex-direction: column;
    gap: var(--space-xs, 0.25rem);
    text-align: center;
  }
}

/* ================================================
   🎯 VARIABLES CSS PARA DISEÑO CONSISTENTE
   ================================================ */
:root {
  /* Breakpoints */
  --mobile-max: 640px;
  --tablet-max: 1024px;
  --desktop-min: 1025px;
  
  /* Espaciado responsivo */
  --space-xs: 0.25rem;  /* 4px */
  --space-sm: 0.5rem;   /* 8px */
  --space-md: 1rem;     /* 16px */
  --space-lg: 1.5rem;   /* 24px */
  --space-xl: 2rem;     /* 32px */
  
  /* Typography responsive */
  --text-xs: 0.75rem;   /* 12px */
  --text-sm: 0.875rem;  /* 14px */
  --text-base: 1rem;    /* 16px */
  --text-lg: 1.125rem;  /* 18px */
  --text-xl: 1.25rem;   /* 20px */
  --text-2xl: 1.5rem;   /* 24px */
  --text-3xl: 1.875rem; /* 30px */
  
  /* Colors for dark/light themes */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-accent: #3b82f6;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

/* ================================================
   📱 MOBILE-FIRST BASE STYLES
   ================================================ */

/* Container responsivo global */
.container-responsive {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: var(--space-sm);
}

@media (min-width: 640px) {
  .container-responsive {
    max-width: 640px;
    padding: var(--space-md);
  }
}

@media (min-width: 768px) {
  .container-responsive {
    max-width: 768px;
    padding: var(--space-lg);
  }
}

@media (min-width: 1024px) {
  .container-responsive {
    max-width: 1024px;
    padding: var(--space-xl);
  }
}

@media (min-width: 1280px) {
  .container-responsive {
    max-width: 1280px;
  }
}

/* ================================================
   🎮 GAMIFICACIÓN RESPONSIVE
   ================================================ */

/* Badge grid responsive */
.badges-grid-responsive {
  display: grid;
  gap: var(--space-sm);
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 640px) {
  .badges-grid-responsive {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
  }
}

@media (min-width: 768px) {
  .badges-grid-responsive {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 1024px) {
  .badges-grid-responsive {
    grid-template-columns: repeat(6, 1fr);
    gap: var(--space-lg);
  }
}

/* Badge card responsive */
.badge-card-responsive {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: var(--space-sm);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  text-align: center;
  transition: all 0.3s ease;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

@media (min-width: 640px) {
  .badge-card-responsive {
    padding: var(--space-md);
    min-height: 140px;
  }
}

@media (min-width: 1024px) {
  .badge-card-responsive {
    padding: var(--space-lg);
    min-height: 160px;
  }
  
  .badge-card-responsive:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
  }
}

/* XPS Score responsive */
.xps-score-responsive {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 16px;
  padding: var(--space-md);
  text-align: center;
  margin-bottom: var(--space-lg);
}

@media (min-width: 768px) {
  .xps-score-responsive {
    padding: var(--space-xl);
    border-radius: 24px;
  }
}

.xps-number-responsive {
  font-size: var(--text-3xl);
  font-weight: bold;
  margin-bottom: var(--space-xs);
}

@media (min-width: 640px) {
  .xps-number-responsive {
    font-size: 3rem; /* 48px */
  }
}

@media (min-width: 1024px) {
  .xps-number-responsive {
    font-size: 4rem; /* 64px */
  }
}

/* Leaderboard responsive */
.leaderboard-responsive {
  background: var(--bg-secondary);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  margin-bottom: var(--space-lg);
}

.leaderboard-header-responsive {
  background: var(--bg-accent);
  color: white;
  padding: var(--space-md);
  font-weight: 600;
  font-size: var(--text-lg);
}

.leaderboard-item-responsive {
  display: flex;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border-color);
  transition: background-color 0.2s ease;
}

.leaderboard-item-responsive:hover {
  background-color: #f8fafc;
}

.leaderboard-rank-responsive {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: var(--text-sm);
  flex-shrink: 0;
  margin-right: var(--space-md);
}

@media (min-width: 640px) {
  .leaderboard-rank-responsive {
    width: 40px;
    height: 40px;
    font-size: var(--text-base);
  }
}

.leaderboard-info-responsive {
  flex-grow: 1;
  min-width: 0; /* Para truncar texto */
}

.leaderboard-name-responsive {
  font-weight: 600;
  color: var(--text-primary);
  font-size: var(--text-sm);
  truncate: true;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 640px) {
  .leaderboard-name-responsive {
    font-size: var(--text-base);
  }
}

.leaderboard-score-responsive {
  font-weight: bold;
  color: var(--bg-accent);
  font-size: var(--text-lg);
  flex-shrink: 0;
  margin-left: var(--space-md);
}

@media (min-width: 640px) {
  .leaderboard-score-responsive {
    font-size: var(--text-xl);
  }
}

/* ================================================
   💼 CRM RESPONSIVE
   ================================================ */

/* CRM Dashboard Grid */
.crm-dashboard-responsive {
  display: grid;
  gap: var(--space-md);
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .crm-dashboard-responsive {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1024px) {
  .crm-dashboard-responsive {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
  }
}

/* CRM Cards */
.crm-card-responsive {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: var(--space-md);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

@media (min-width: 768px) {
  .crm-card-responsive {
    padding: var(--space-lg);
  }
}

/* CRM Status Indicators */
.crm-status-responsive {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}

.status-dot-responsive {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot-responsive.connected {
  background-color: #10b981;
}

.status-dot-responsive.disconnected {
  background-color: #ef4444;
}

.status-dot-responsive.pending {
  background-color: #f59e0b;
}

/* CRM Tables responsive */
.crm-table-responsive {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  margin-top: var(--space-md);
}

.crm-table-responsive th,
.crm-table-responsive td {
  text-align: left;
  padding: var(--space-sm);
  border-bottom: 1px solid var(--border-color);
}

.crm-table-responsive th {
  background-color: #f8fafc;
  font-weight: 600;
  color: var(--text-primary);
}

/* Mobile: Stack table rows vertically */
@media (max-width: 640px) {
  .crm-table-responsive {
    font-size: var(--text-xs);
  }
  
  .crm-table-responsive thead {
    display: none;
  }
  
  .crm-table-responsive tr {
    display: block;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: var(--space-sm);
    padding: var(--space-sm);
    background: var(--bg-secondary);
  }
  
  .crm-table-responsive td {
    display: block;
    text-align: right;
    padding: var(--space-xs) 0;
    border-bottom: none;
    position: relative;
    padding-left: 50%;
  }
  
  .crm-table-responsive td:before {
    content: attr(data-label) ": ";
    position: absolute;
    left: 0;
    width: 45%;
    padding-right: var(--space-xs);
    white-space: nowrap;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
  }
}

/* ================================================
   🎯 4DX COMPONENTS RESPONSIVE
   ================================================ */

/* WIG Cards responsive */
.wig-card-responsive {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: var(--space-md);
  box-shadow: var(--shadow-md);
  border-left: 4px solid var(--bg-accent);
  margin-bottom: var(--space-md);
}

@media (min-width: 768px) {
  .wig-card-responsive {
    padding: var(--space-lg);
  }
}

.wig-title-responsive {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
  line-height: 1.4;
}

@media (min-width: 768px) {
  .wig-title-responsive {
    font-size: var(--text-xl);
  }
}

/* Progress bars responsive */
.progress-bar-responsive {
  width: 100%;
  height: 8px;
  background-color: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
  margin: var(--space-sm) 0;
}

@media (min-width: 768px) {
  .progress-bar-responsive {
    height: 12px;
    border-radius: 6px;
  }
}

.progress-fill-responsive {
  height: 100%;
  background: linear-gradient(90deg, #10b981 0%, #059669 100%);
  border-radius: inherit;
  transition: width 0.6s ease;
}

/* ================================================
   🔘 BOTONES Y FORMULARIOS RESPONSIVE
   ================================================ */

/* Botones responsive */
.btn-responsive {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  min-height: 44px; /* Mejor para touch targets */
}

@media (min-width: 640px) {
  .btn-responsive {
    padding: var(--space-sm) var(--space-lg);
    font-size: var(--text-base);
    min-height: auto;
  }
}

.btn-primary-responsive {
  background: var(--bg-accent);
  color: white;
}

.btn-primary-responsive:hover {
  background: #2563eb;
  transform: translateY(-1px);
}

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

.btn-secondary-responsive:hover {
  background: #f8fafc;
}

/* Formularios responsive */
.form-responsive {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.form-group-responsive {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

@media (min-width: 768px) {
  .form-row-responsive {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
  }
}

.input-responsive {
  padding: var(--space-sm) var(--space-md);
  font-size: var(--text-base);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  min-height: 44px; /* Touch target */
  transition: border-color 0.2s ease;
}

.input-responsive:focus {
  outline: none;
  border-color: var(--bg-accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ================================================
   📊 MODAL Y OVERLAY RESPONSIVE
   ================================================ */

.modal-overlay-responsive {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-md);
}

.modal-content-responsive {
  background: var(--bg-secondary);
  border-radius: 16px;
  padding: var(--space-lg);
  max-width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  width: 100%;
}

@media (min-width: 640px) {
  .modal-content-responsive {
    width: auto;
    min-width: 500px;
    max-width: 600px;
  }
}

@media (min-width: 1024px) {
  .modal-content-responsive {
    min-width: 600px;
    max-width: 800px;
    padding: var(--space-xl);
  }
}

/* ================================================
   🚀 NAVEGACIÓN RESPONSIVE
   ================================================ */

.nav-responsive {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  padding: var(--space-sm) var(--space-md);
  position: sticky;
  top: 0;
  z-index: 100;
}

@media (min-width: 768px) {
  .nav-responsive {
    padding: var(--space-md) var(--space-lg);
  }
}

.nav-container-responsive {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1280px;
  margin: 0 auto;
}

.nav-menu-responsive {
  display: none;
}

@media (min-width: 768px) {
  .nav-menu-responsive {
    display: flex;
    gap: var(--space-lg);
    align-items: center;
  }
}

.nav-mobile-responsive {
  display: flex;
  gap: var(--space-sm);
}

@media (min-width: 768px) {
  .nav-mobile-responsive {
    display: none;
  }
}

/* ================================================
   🎨 UTILIDADES RESPONSIVE
   ================================================ */

/* Espaciado responsive */
.p-responsive { padding: var(--space-md); }
.px-responsive { padding-left: var(--space-md); padding-right: var(--space-md); }
.py-responsive { padding-top: var(--space-md); padding-bottom: var(--space-md); }
.m-responsive { margin: var(--space-md); }
.mb-responsive { margin-bottom: var(--space-md); }
.mt-responsive { margin-top: var(--space-md); }

@media (min-width: 768px) {
  .p-responsive { padding: var(--space-lg); }
  .px-responsive { padding-left: var(--space-lg); padding-right: var(--space-lg); }
  .py-responsive { padding-top: var(--space-lg); padding-bottom: var(--space-lg); }
  .m-responsive { margin: var(--space-lg); }
  .mb-responsive { margin-bottom: var(--space-lg); }
  .mt-responsive { margin-top: var(--space-lg); }
}

/* Visibilidad responsive */
.hide-mobile { display: none; }
@media (min-width: 640px) { .hide-mobile { display: block; } }

.hide-desktop { display: block; }
@media (min-width: 640px) { .hide-desktop { display: none; } }

.show-tablet { display: none; }
@media (min-width: 640px) and (max-width: 1023px) { .show-tablet { display: block; } }

/* Grid responsive utilities */
.grid-responsive-1 { display: grid; grid-template-columns: 1fr; gap: var(--space-md); }
.grid-responsive-2 { display: grid; grid-template-columns: 1fr; gap: var(--space-md); }
.grid-responsive-3 { display: grid; grid-template-columns: 1fr; gap: var(--space-md); }

@media (min-width: 640px) {
  .grid-responsive-2 { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 768px) {
  .grid-responsive-3 { grid-template-columns: repeat(3, 1fr); }
}

/* ================================================
   🌙 DARK MODE SUPPORT (Opcional)
   ================================================ */

@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
  }
  
  .badge-card-responsive:hover {
    background: #334155;
  }
  
  .leaderboard-item-responsive:hover {
    background: #334155;
  }
}

/* ================================================
   📱 TOUCH GESTURES & ACCESSIBILITY
   ================================================ */

/* Mejores touch targets para móvil */
@media (max-width: 640px) {
  .touchable {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Focus states para navegación por teclado */
.focusable:focus {
  outline: 2px solid var(--bg-accent);
  outline-offset: 2px;
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Disable animations for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}