/* CSS Reset & Variables */
:root {
  --bg-primary: #0a0a14;
  --bg-secondary: #111122;
  --bg-glass: rgba(20, 20, 35, 0.65);
  --bg-glass-hover: rgba(30, 30, 50, 0.8);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glass-active: rgba(99, 102, 241, 0.3);
  
  --color-text-main: #f8fafc;
  --color-text-muted: #94a3b8;
  --color-text-dark: #64748b;

  /* Accent Colors */
  --color-primary: #6366f1; /* Indigo */
  --color-primary-glow: rgba(99, 102, 241, 0.4);
  --color-success: #10b981; /* Emerald */
  --color-success-glow: rgba(16, 185, 129, 0.25);
  --color-warning: #f59e0b; /* Amber */
  --color-danger: #ef4444; /* Red */
  --color-danger-glow: rgba(239, 68, 68, 0.25);
  --color-pink: #ec4899; /* Fuchsia */

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  --gradient-success: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  --gradient-danger: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
  --gradient-warning: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  --gradient-luxury: linear-gradient(135deg, #c084fc 0%, #6366f1 50%, #38bdf8 100%);

  /* Typography */
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Shadows */
  --shadow-sm: 0 2px 8px -1px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 40px -15px rgba(0, 0, 0, 0.6);
  --shadow-neon: 0 0 15px rgba(99, 102, 241, 0.35);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--color-text-main);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

/* Background Decorative Glow Bubbles */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(140px);
  z-index: -1;
  pointer-events: none;
  opacity: 0.25;
}

.bg-glow-1 {
  width: 350px;
  height: 350px;
  background-color: #6366f1;
  top: -100px;
  left: -50px;
}

.bg-glow-2 {
  width: 400px;
  height: 400px;
  background-color: #ec4899;
  bottom: -150px;
  right: -50px;
  opacity: 0.2;
}

.bg-glow-3 {
  width: 300px;
  height: 300px;
  background-color: #10b981;
  top: 40%;
  left: 60%;
  opacity: 0.15;
}

/* App container */
#app {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Generic Helpers */
.hidden {
  display: none !important;
}

/* Views transition */
.view {
  width: 100%;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.view.active {
  display: flex;
  flex-direction: column;
  opacity: 1;
  transform: translateY(0);
}

/* 1. VIEW: LOGIN CUSTOM DESIGN */
#login-view {
  min-height: 100vh;
  justify-content: center;
  align-items: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-glass);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-glass);
  border-radius: 24px;
  padding: 40px 32px;
  box-shadow: var(--shadow-lg), 0 0 40px rgba(99, 102, 241, 0.05);
  position: relative;
  overflow: hidden;
}

/* Luxury border highlight for login */
.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--gradient-luxury);
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.logo-badge {
  width: 72px;
  height: 72px;
  background: var(--gradient-primary);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  box-shadow: var(--shadow-neon);
}

.logo-icon {
  width: 36px;
  height: 36px;
  color: white;
}

.login-header h1 {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
  background: var(--gradient-luxury);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.login-header .subtitle {
  font-size: 14px;
  color: var(--color-text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  font-weight: 500;
}

/* Input Fields Style */
.input-group {
  margin-bottom: 24px;
}

.input-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-muted);
  margin-bottom: 8px;
  padding-left: 4px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 16px;
  width: 18px;
  height: 18px;
  color: var(--color-text-dark);
  pointer-events: none;
  transition: color 0.3s ease;
}

.input-wrapper input {
  width: 100%;
  height: 52px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  border-radius: 14px;
  padding: 0 48px;
  color: white;
  font-family: var(--font-body);
  font-size: 15px;
  outline: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.input-wrapper input::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

.input-wrapper input:focus {
  background: rgba(255, 255, 255, 0.07);
  border-color: var(--color-primary);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.15);
}

.input-wrapper input:focus + .input-icon {
  color: var(--color-primary);
}

.password-toggle-btn {
  position: absolute;
  right: 16px;
  background: none;
  border: none;
  color: var(--color-text-dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  outline: none;
}

.password-toggle-btn:hover {
  color: var(--color-text-main);
}

/* Buttons */
.btn {
  height: 52px;
  border-radius: 14px;
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  border: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: var(--shadow-neon);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 22px rgba(99, 102, 241, 0.5);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-block {
  width: 100%;
}

.btn-icon {
  width: 18px;
  height: 18px;
}

/* Secondary Button with Icon */
.btn-secondary-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--color-text-main);
  height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: 13px;
}

.btn-secondary-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--color-text-muted);
}

/* Tertiary Button */
.btn-tertiary-icon {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 8px;
  transition: all 0.3s;
}

.btn-tertiary-icon:hover {
  background: rgba(255, 255, 255, 0.06);
  color: white;
}

/* Error Banner styling */
.error-banner {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 12px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #f87171;
  font-size: 13px;
  margin-bottom: 24px;
}

.error-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.login-footer {
  text-align: center;
  margin-top: 32px;
  font-size: 11px;
  color: var(--color-text-dark);
}

/* 2. VIEW: DASHBOARD DESIGN */
#dashboard-view {
  min-height: 100vh;
  padding-bottom: 72px; /* Espacio para el footer flotante */
}

/* Header */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  background: rgba(10, 10, 20, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-glass);
  position: sticky;
  top: 0;
  z-index: 50;
}

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

.brand-logo {
  width: 40px;
  height: 40px;
  background: var(--gradient-primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.2);
}

.brand-icon {
  width: 22px;
  height: 22px;
  color: white;
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.2px;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--color-text-muted);
}

/* Sync Bar */
.sync-status-container {
  padding: 12px 20px;
  display: flex;
  justify-content: center;
}

.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
  transition: all 0.4s ease;
  width: 100%;
  max-width: 600px;
  justify-content: center;
}

.sync-icon {
  width: 14px;
  height: 14px;
}

/* Sync States */
.sync-online {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.sync-offline {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  box-shadow: 0 0 15px rgba(239, 68, 68, 0.1);
  animation: pulse-border 2s infinite alternate;
}

.sync-loading {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-glass);
  color: var(--color-text-muted);
}

/* Content Area */
.dashboard-content {
  padding: 10px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Metrics Grid - Grid pattern for 2x2 on small, 4x1 on large */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

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

.metric-card {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: 18px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.metric-card:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-glass-active);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card-icon-wrapper {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* Colors for Card Badges */
.color-indigo { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
.color-emerald { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.color-amber { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.color-fuchsia { background: rgba(236, 72, 153, 0.15); color: #f472b6; }

.card-icon {
  width: 20px;
  height: 20px;
}

.card-data {
  margin-top: 4px;
}

.card-value {
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.card-label {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.card-indicator {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.trend {
  display: inline-flex;
  align-items: center;
}

.trend.positive { color: var(--color-success); }
.trend.neutral { color: var(--color-text-muted); }

/* Live Status Dot animation */
.status-live {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--color-success);
}

.pulse-indicator {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  background-color: var(--color-success);
  border: 2px solid var(--bg-primary);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--color-success);
}

.pulse-indicator.active {
  animation: pulse-live 1.6s infinite ease-in-out;
}

/* Columns Section */
.two-column-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 900px) {
  .two-column-layout {
    grid-template-columns: 1.1fr 0.9fr;
  }
}

.dashboard-section {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.section-title-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-icon {
  width: 20px;
  height: 20px;
}

.text-pink { color: var(--color-pink); }
.text-violet { color: var(--color-primary); }

.section-header h2 {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

.section-badge {
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-text-main);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 100px;
}

/* Responsiveness on lists (cards list for expiring memberships) */
.responsive-card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.membership-item-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-glass);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
}

.membership-item-card:hover {
  background: rgba(255, 255, 255, 0.04);
  transform: translateX(3px);
}

.member-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.member-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-main);
}

.member-plan {
  font-size: 11px;
  color: var(--color-text-muted);
}

.urgency-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 100px;
  text-align: center;
}

.urgency-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.urgency-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.urgency-neutral {
  background: rgba(255, 255, 255, 0.05);
  color: var(--color-text-muted);
  border: 1px solid var(--border-glass);
}

/* Activity Feed (Recent Visits) */
.activity-feed {
  display: flex;
  flex-direction: column;
  position: relative;
  padding-left: 12px;
}

/* Feed line timeline */
.activity-feed::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: rgba(255, 255, 255, 0.05);
}

.feed-item {
  position: relative;
  padding-bottom: 14px;
  padding-left: 14px;
}

.feed-item:last-child {
  padding-bottom: 0;
}

/* Dot on feed line */
.feed-item::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-primary);
  box-shadow: 0 0 6px var(--color-primary);
}

.feed-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.feed-name {
  font-size: 13px;
  font-weight: 500;
}

.feed-time {
  font-size: 11px;
  color: var(--color-text-muted);
}

/* Empty states and skeletons */
.empty-state {
  text-align: center;
  padding: 30px 20px;
  color: var(--color-text-dark);
}

.empty-icon {
  width: 28px;
  height: 28px;
  margin-bottom: 8px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 13px;
}

/* Skeleton loader anim */
.skeleton-item {
  height: 48px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.02) 25%, rgba(255, 255, 255, 0.05) 50%, rgba(255, 255, 255, 0.02) 75%);
  background-size: 200% 100%;
  animation: loading-skeleton 1.5s infinite;
  border-radius: 10px;
  margin-bottom: 8px;
}

/* Bottom Nav bar */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(10, 10, 20, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-glass);
  padding: 10px 16px;
  text-align: center;
  font-size: 11px;
  color: var(--color-text-dark);
  z-index: 40;
}

.highlight-domain {
  color: var(--color-primary);
  font-weight: 600;
}

/* Animations declarations */
@keyframes pulse-live {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  }
  70% {
    transform: scale(1.15);
    box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
  }
}

@keyframes pulse-border {
  0% {
    border-color: rgba(239, 68, 68, 0.3);
  }
  100% {
    border-color: rgba(239, 68, 68, 0.8);
  }
}

@keyframes animate-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes loading-skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.animate-spin {
  animation: spin 1.2s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Screen Optimizations for iPhone/Android Touch Gestures */
@media (hover: none) {
  .metric-card:hover {
    transform: none;
    background: var(--bg-glass);
  }
  
  .btn:active {
    opacity: 0.8;
  }
}
