/* ═══════════════════════════════════════════════════
   FACTURALO HUB / LOBBY & AUTH MODAL STYLES
   Diseño Glassmorphism Premium, animaciones y Hub de Apps
   ═══════════════════════════════════════════════════ */

/* Modal Backdrop */
.lobby-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(6, 10, 25, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s;
}

.lobby-backdrop.active {
  opacity: 1;
  visibility: visible;
}

/* Modal Dialog */
.lobby-dialog {
  position: relative;
  background: #ffffff;
  border: 1px solid rgba(59, 86, 224, 0.15);
  border-radius: 28px;
  width: 100%;
  max-width: 580px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 
    0 25px 60px -15px rgba(15, 23, 42, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.9) inset,
    0 10px 30px rgba(59, 86, 224, 0.12);
  transform: translateY(20px) scale(0.96);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  padding: 32px;
  color: #0f172a;
}

.lobby-backdrop.active .lobby-dialog {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* Close Button */
.lobby-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(240, 244, 255, 0.8);
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 20px;
  z-index: 10;
}

.lobby-close-btn:hover {
  background: #ffffff;
  color: #0f172a;
  border-color: rgba(59, 86, 224, 0.3);
  transform: rotate(90deg);
}

/* Header */
.lobby-header {
  text-align: center;
  margin-bottom: 24px;
}

.lobby-brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: linear-gradient(135deg, rgba(59, 86, 224, 0.1), rgba(124, 92, 224, 0.12));
  border: 1px solid rgba(59, 86, 224, 0.2);
  border-radius: 100px;
  font-size: 13px;
  font-weight: 700;
  color: #3b56e0;
  margin-bottom: 12px;
}

.lobby-title {
  font-size: 24px;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 6px 0;
  letter-spacing: -0.02em;
}

.lobby-subtitle {
  font-size: 14px;
  color: #64748b;
  margin: 0;
  line-height: 1.5;
}

/* User Logged-in Profile Banner */
.lobby-user-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #f8faff 0%, #edf2fe 100%);
  border: 1px solid rgba(59, 86, 224, 0.16);
  border-radius: 18px;
  padding: 14px 18px;
  margin-bottom: 24px;
}

.lobby-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.lobby-avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #3b56e0, #7c5ce0);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(59, 86, 224, 0.25);
  flex-shrink: 0;
}

.lobby-user-meta {
  min-width: 0;
}

.lobby-user-name {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lobby-user-role-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  background: rgba(0, 184, 148, 0.15);
  color: #009670;
  border-radius: 6px;
  margin-top: 2px;
}

.lobby-btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: #ffffff;
  border: 1px solid rgba(220, 38, 38, 0.2);
  color: #dc2626;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.lobby-btn-logout:hover {
  background: #fee2e2;
  border-color: #dc2626;
}

/* Tabs for Auth View */
.lobby-tabs {
  display: flex;
  background: #f1f5f9;
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 20px;
  gap: 4px;
}

.lobby-tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.lobby-tab.active {
  background: #ffffff;
  color: #3b56e0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

/* Form Controls */
.lobby-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.lobby-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lobby-label {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

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

.lobby-input-icon {
  position: absolute;
  left: 14px;
  color: #94a3b8;
  font-size: 18px;
  pointer-events: none;
}

.lobby-input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  font-size: 14px;
  font-family: inherit;
  color: #0f172a;
  background: #f8faff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  outline: none;
  transition: all 0.2s ease;
}

.lobby-input:focus {
  background: #ffffff;
  border-color: #3b56e0;
  box-shadow: 0 0 0 3px rgba(59, 86, 224, 0.12);
}

.lobby-btn-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 20px;
  background: linear-gradient(135deg, #3b56e0, #4f46e5);
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(59, 86, 224, 0.35);
  transition: all 0.2s ease;
  margin-top: 4px;
}

.lobby-btn-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(59, 86, 224, 0.45);
  background: linear-gradient(135deg, #3448c5, #4338ca);
}

.lobby-btn-submit:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.lobby-alert {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  display: none;
  align-items: center;
  gap: 8px;
  line-height: 1.4;
}

.lobby-alert.error {
  display: flex;
  background: #fef2f2;
  border: 1px solid rgba(220, 38, 38, 0.25);
  color: #b91c1c;
}

.lobby-alert.success {
  display: flex;
  background: #f0fdf4;
  border: 1px solid rgba(22, 163, 74, 0.25);
  color: #15803d;
}

/* ══════════════════════════════════════════════════
   APPS GRID (LOBBY VIEW)
   ══════════════════════════════════════════════════ */
.lobby-apps-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 8px;
}

.lobby-app-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #f8faff;
  border: 1.5px solid #e2e8f0;
  border-radius: 18px;
  padding: 16px 20px;
  text-decoration: none;
  color: inherit;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.lobby-app-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
  background: var(--app-color, #3b56e0);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.lobby-app-card:hover {
  background: #ffffff;
  border-color: var(--app-color, #3b56e0);
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 10px 24px -6px rgba(59, 86, 224, 0.15);
}

.lobby-app-card:hover::before {
  opacity: 1;
}

.lobby-app-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--app-bg, rgba(59, 86, 224, 0.1));
  color: var(--app-color, #3b56e0);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.lobby-app-info {
  flex: 1;
  min-width: 0;
}

.lobby-app-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
}

.lobby-app-name {
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
}

.lobby-app-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--app-badge-bg, rgba(59, 86, 224, 0.12));
  color: var(--app-color, #3b56e0);
}

.lobby-app-desc {
  font-size: 13px;
  color: #64748b;
  margin: 0;
  line-height: 1.4;
}

.lobby-app-action {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(240, 244, 255, 0.9);
  color: var(--app-color, #3b56e0);
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.lobby-app-card:hover .lobby-app-action {
  background: var(--app-color, #3b56e0);
  color: #ffffff;
  transform: translateX(4px);
}

/* App specific accent definitions */
.app-factura {
  --app-color: #3b56e0;
  --app-bg: rgba(59, 86, 224, 0.12);
  --app-badge-bg: rgba(59, 86, 224, 0.14);
}

.app-scandallo {
  --app-color: #d97706;
  --app-bg: rgba(217, 119, 6, 0.12);
  --app-badge-bg: rgba(217, 119, 6, 0.15);
}

.app-cms {
  --app-color: #0891b2;
  --app-bg: rgba(8, 145, 178, 0.12);
  --app-badge-bg: rgba(8, 145, 178, 0.15);
}

/* Footer / Switch link */
.lobby-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 13px;
  color: #64748b;
}

.lobby-footer a {
  color: #3b56e0;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.lobby-footer a:hover {
  text-decoration: underline;
}

/* Micro helper classes */
.lobby-hidden {
  display: none !important;
}

@media (max-width: 600px) {
  .lobby-dialog {
    padding: 24px 18px;
    border-radius: 22px;
  }
  
  .lobby-app-card {
    padding: 14px;
    gap: 12px;
  }

  .lobby-app-icon {
    width: 44px;
    height: 44px;
    font-size: 22px;
  }

  .lobby-title {
    font-size: 20px;
  }
}
