/* =====================================================
   REENGAGEMENT ROOM - TAB SYSTEM & CONTENT AREAS
   Phase 4 CSS Extraction
   Created: December 9, 2025
   Purpose: Tab navigation, content areas, form sections
   ===================================================== */

/* ===== TAB NAVIGATION ===== */

/* Sidebar layout overrides */
body.sidebar-layout .tab-navigation {
  display: flex !important;
  background: #ffffff !important;
  border-bottom: 2px solid #e5e7eb !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 999 !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05) !important;
  justify-content: flex-start !important;
  padding: 0.875rem 1.5rem !important;
  gap: 0.75rem !important;
  flex-wrap: nowrap !important;
  min-height: 64px !important;
  align-items: center !important;
  /* Ensure proper scrolling on all browsers */
  -webkit-overflow-scrolling: touch !important;
  scroll-behavior: smooth !important;
  /* Show scrollbar for better UX */
  scrollbar-width: thin !important;
  scrollbar-color: rgba(102, 0, 0, 0.3) transparent !important;
}

/* Webkit scrollbar styling for tabs */
body.sidebar-layout .tab-navigation::-webkit-scrollbar {
  height: 6px !important;
}

body.sidebar-layout .tab-navigation::-webkit-scrollbar-track {
  background: transparent !important;
}

body.sidebar-layout .tab-navigation::-webkit-scrollbar-thumb {
  background: rgba(102, 0, 0, 0.3) !important;
  border-radius: 3px !important;
}

body.sidebar-layout .tab-navigation::-webkit-scrollbar-thumb:hover {
  background: rgba(102, 0, 0, 0.5) !important;
}

body.sidebar-layout .tab-navigation::before {
  display: none !important;
}

.tab-navigation {
  display: flex;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 999;
  overflow-x: auto;
  overflow-y: hidden;
  box-shadow: 0 4px 12px rgba(0, 48, 87, 0.08);
  justify-content: flex-start;
  padding: 0.5rem 1rem;
  gap: 0.5rem;
  /* Ensure tabs are always visible */
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(102, 0, 0, 0.3) transparent;
}

/* Webkit scrollbar for default layout */
.tab-navigation::-webkit-scrollbar {
  height: 6px;
}

.tab-navigation::-webkit-scrollbar-track {
  background: transparent;
}

.tab-navigation::-webkit-scrollbar-thumb {
  background: rgba(102, 0, 0, 0.3);
  border-radius: 3px;
}

.tab-navigation::-webkit-scrollbar-thumb:hover {
  background: rgba(102, 0, 0, 0.5);
}

/* ===== TAB BUTTONS ===== */

body.sidebar-layout .tab-btn {
  flex: 0 0 auto !important;
  white-space: nowrap !important;
  padding: 0.75rem 1rem !important;
  font-size: 0.875rem !important;
  font-weight: 600 !important;
  border-radius: 8px !important;
  transition: all 0.2s ease !important;
  background: transparent !important;
  border: none !important;
  cursor: pointer !important;
  color: #4b5563 !important;
  display: flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
  min-height: 40px !important;
  /* Prevent tabs from shrinking */
  flex-shrink: 0 !important;
}

@media (max-width: 1400px) {
  body.sidebar-layout .tab-btn {
    padding: 0.625rem 0.75rem !important;
    font-size: 0.8125rem !important;
  }
}

body.sidebar-layout .tab-btn:hover {
  background: #f3f4f6 !important;
  color: #1f2937 !important;
  transform: translateY(-1px) !important;
}

body.sidebar-layout .tab-btn.active {
  background: linear-gradient(135deg, #003057, #005a9e) !important;
  color: white !important;
  box-shadow: 0 2px 8px rgba(0, 48, 87, 0.25) !important;
}

.tab-btn {
  flex: 0 0 auto;
  padding: 0.75rem 1.25rem;
  background: transparent;
  border: none;
  cursor: pointer;
  font-weight: 600;
  color: #64748b;
  transition: all 0.25s ease;
  border-radius: 8px;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  flex-shrink: 0;
}

.tab-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, var(--accent) 0%, var(--primary) 100%);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  transform: translateY(100%);
  z-index: -1;
}

.tab-btn::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 3px;
  background: var(--accent);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateX(-50%);
}

.tab-btn:hover {
  background: rgba(102,0,0,0.08);
  color: var(--accent);
  transform: translateY(-2px);
}

.tab-btn:hover::before {
  opacity: 0.12;
  transform: translateY(0);
}

.tab-btn:hover::after {
  width: 60%;
}

.tab-btn.active {
  background: linear-gradient(to bottom, rgba(102,0,0,0.05), transparent);
  color: var(--accent);
  border-bottom-color: transparent;
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(102, 0, 0, 0.12);
}

.tab-btn.active::before {
  opacity: 0.08;
  transform: translateY(0);
}

.tab-btn.active::after {
  width: 100%;
  background: linear-gradient(90deg, var(--accent), var(--primary), var(--accent));
}

/* Keyboard Focus Indicators - Accessibility */
.tab-btn:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);
  border-color: rgba(59, 130, 246, 0.8);
}

/* ===== TAB BADGE NOTIFICATIONS ===== */

.tab-badge {
  margin-left: 8px;
  display: none;
  align-items: center;
  gap: 4px;
}

.tab-badge.visible {
  display: inline-flex;
}

.tab-badge-count {
  background: #dc3545;
  color: white;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
  animation: badgePulse 2s ease-in-out infinite;
  box-shadow: 0 2px 6px rgba(220, 53, 69, 0.4);
}

@keyframes badgePulse {
  0%, 100% { 
    opacity: 1;
    transform: scale(1);
  }
  50% { 
    opacity: 0.8;
    transform: scale(1.05);
  }
}

/* ===== TAB CONTENT ===== */

.tab-content {
  display: none;
  padding: var(--spacing-xl);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.tab-content.active {
  display: block;
  animation: fadeInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes fadeInUp {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== FORM SECTIONS ===== */

.form-section {
  background: var(--card);
  border-radius: 12px;
  padding: var(--spacing-xl);
  margin-bottom: var(--spacing-xl);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: fadeInUp 0.6s ease-out;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.form-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, transparent 0%, var(--accent) 50%, var(--primary) 75%, transparent 100%);
  transition: left 0.8s ease;
}

.form-section::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(102,0,0,0.02) 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.form-section:hover::before {
  left: 100%;
}

.form-section:hover::after {
  opacity: 1;
}

.form-section:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  border-color: rgba(102,0,0,0.2);
}

/* ===== SECTION HEADERS ===== */

.form-section-header {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-sm);
  border-bottom: 2px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  cursor: pointer;
  user-select: none;
  transition: all 0.3s ease;
  position: relative;
}

.form-section-header:hover {
  background: rgba(102, 0, 0, 0.05);
  padding-left: var(--spacing-sm);
  border-radius: var(--border-radius);
}

.form-section-header.collapsible::after {
  content: '▼';
  position: absolute;
  right: var(--spacing-md);
  font-size: 0.875rem;
  transition: transform 0.3s ease;
  color: var(--accent);
}

.form-section-header.collapsed::after {
  transform: rotate(-90deg);
}

.form-section-header .emoji {
  font-size: 1.5rem;
}

.form-section-header .step-indicator {
  display: inline-block;
  background: var(--accent);
  color: white;
  padding: 0.25rem 0.625rem;
  border-radius: 12px;
  font-size: 0.75rem;
  margin-left: auto;
  margin-right: var(--spacing-xl);
}

/* ===== COLLAPSIBLE CONTENT ===== */

.form-section-content {
  max-height: 5000px;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
              opacity 0.3s ease,
              padding 0.3s ease;
  opacity: 1;
}

.form-section-content.collapsed {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin: 0;
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */

@media (max-width: 768px) {
  .tab-navigation {
    padding: 0.375rem;
    gap: 0.375rem;
    flex-wrap: wrap;
  }

  .tab-btn {
    flex: 1 1 calc(50% - 0.375rem);
    min-width: 120px;
    padding: 0.625rem 1rem;
    font-size: 0.8125rem;
  }

  .tab-content {
    padding: var(--spacing-lg);
  }

  .form-section {
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
  }

  .form-section-header {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .tab-btn {
    flex: 1 1 100%;
    padding: 0.5rem 0.75rem;
  }

  .tab-badge-count {
    font-size: 0.625rem;
    padding: 2px 6px;
  }

  .form-section {
    padding: var(--spacing-md);
  }

  .tab-content {
    padding: var(--spacing-md);
  }
}
