/* ============================================
   RESPONSIVE BREAKPOINTS SYSTEM
   ============================================
   
   Mobile: < 576px (phones)
   Tablet Portrait: 576px - 768px (small tablets)
   Tablet Landscape: 768px - 1024px (iPad, tablets)
   Desktop: 1024px - 1440px (laptops, desktops)
   Large Desktop: > 1440px (large screens)
   
   ============================================ */

/* ============================================
   GLOBAL RESPONSIVE UTILITIES
   ============================================ */

/* Container max-widths for different screens */
.container {
  width: 100%;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  margin-left: auto;
  margin-right: auto;
}

/* Mobile First - Base styles for mobile */
@media (min-width: 576px) {
  .container {
    max-width: 540px;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

/* Tablet Portrait - iPad Air / iPad Mini (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
  .container {
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
}

/* Tablet Landscape - iPad Pro and larger (1024px+) */
@media (min-width: 1025px) and (max-width: 1279px) {
  .container {
    max-width: 100%;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
}

/* Small Desktop */
@media (min-width: 1280px) {
  .container {
    max-width: 1200px;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

/* Desktop */
@media (min-width: 1200px) {
  .container {
    max-width: 1140px;
  }
}

/* Large Desktop */
@media (min-width: 1440px) {
  .container {
    max-width: 1320px;
  }
}

/* ============================================
   GRID SYSTEM RESPONSIVE
   ============================================ */

/* Base row styles */
.row {
  display: flex;
  flex-wrap: wrap;
  margin-left: -0.5rem;
  margin-right: -0.5rem;
}

.row > * {
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

/* Mobile ONLY: Stack all columns (< 576px) */
@media (max-width: 575px) {
  [class*="col-"] {
    width: 100%;
    margin-bottom: 1rem;
  }
}

/* Tablet Portrait: 2 columns */
@media (min-width: 576px) {
  .col-sm-6 {
    flex: 0 0 50%;
    max-width: 50%;
  }
  
  .col-sm-12 {
    flex: 0 0 100%;
    max-width: 100%;
  }
}

/* Tablet Landscape: 3-4 columns */
@media (min-width: 768px) {
  .col-md-3 {
    flex: 0 0 25%;
    max-width: 25%;
  }
  
  .col-md-4 {
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
  }
  
  .col-md-6 {
    flex: 0 0 50%;
    max-width: 50%;
  }
  
  .col-md-8 {
    flex: 0 0 66.666667%;
    max-width: 66.666667%;
  }
  
  .col-md-12 {
    flex: 0 0 100%;
    max-width: 100%;
  }
}

/* Desktop: Full grid */
@media (min-width: 992px) {
  .col-lg-2 {
    flex: 0 0 16.666667%;
    max-width: 16.666667%;
  }
  
  .col-lg-3 {
    flex: 0 0 25%;
    max-width: 25%;
  }
  
  .col-lg-4 {
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
  }
  
  .col-lg-6 {
    flex: 0 0 50%;
    max-width: 50%;
  }
  
  .col-lg-8 {
    flex: 0 0 66.666667%;
    max-width: 66.666667%;
  }
  
  .col-lg-9 {
    flex: 0 0 75%;
    max-width: 75%;
  }
  
  .col-lg-12 {
    flex: 0 0 100%;
    max-width: 100%;
  }
}

/* ============================================
   SUMMARY CARDS RESPONSIVE
   ============================================ */

/* Mobile: Stack cards */
.summary-card {
  width: 100%;
  margin-bottom: 1rem;
}

/* Tablet Portrait: 2 columns */
@media (min-width: 576px) {
  .summary-card {
    margin-bottom: 1.5rem;
  }
}

/* Tablet Landscape: 4 columns */
@media (min-width: 768px) {
  .summary-card {
    margin-bottom: 1.5rem;
  }
}

/* Desktop: Optimized spacing */
@media (min-width: 992px) {
  .summary-card {
    margin-bottom: 2rem;
  }
}

/* ============================================
   TABLES RESPONSIVE STRATEGY
   ============================================

   Mobile (< 768px): Card layout
   Tablet (768px - 1024px): Hybrid (scrollable table with larger cells)
   Desktop (> 1024px): Full table
   
   ============================================ */

/* Tablet: Hybrid table display */
@media (min-width: 768px) and (max-width: 1279px) {
  table {
    display: table;
    width: 100%;
    font-size: 0.9rem;
  }
  
  table thead {
    display: table-header-group;
  }
  
  table tbody {
    display: table-row-group;
  }
  
  table tr {
    display: table-row;
    margin-bottom: 0;
    border: none;
    padding: 0;
    background: transparent;
  }
  
  table td {
    display: table-cell;
    padding: 0.75rem 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: left;
  }
  
  table td::before {
    display: none; /* Hide labels on tablet */
  }
}


/* Desktop: Full table display */
@media (min-width: 1280px) {
  table {
    display: table;
    width: 100%;
    font-size: 1rem;
  }
  
  table thead {
    display: table-header-group;
  }
  
  table tbody {
    display: table-row-group;
  }
  
  table tr {
    display: table-row;
    margin-bottom: 0;
    border: none;
    padding: 0;
    background: transparent;
  }
  
  table td {
    display: table-cell;
    padding: 1rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: left;
  }
  
  table td::before {
    display: none;
  }
  
  .table-responsive {
    overflow-x: visible !important;
    overflow: visible !important;
  }
  
  /* Prevent horizontal scroll on desktop */
  .dashboard-container {
    overflow-x: hidden;
  }
}

/* ============================================
   DASHBOARD HEADER RESPONSIVE
   ============================================ */

.dashboard-header {
  padding: 2rem 0;
}

/* Dashboard title sizes are defined in dashboard.scss which uses a compact header.
   These fallback values apply only to non-dashboard pages using .dashboard-header/.dashboard-title */
@media (max-width: 575px) {
  .dashboard-header {
    padding: 1rem 0;
  }

  .dashboard-subtitle {
    font-size: 0.85rem;
  }
}

@media (min-width: 576px) and (max-width: 767px) {
  .dashboard-header {
    padding: 1.25rem 0;
  }
}

@media (min-width: 768px) and (max-width: 1279px) {
  .dashboard-header {
    padding: 1.5rem 0;
  }
}

@media (min-width: 1280px) {
  .dashboard-header {
    padding: 2rem 0;
  }
}

/* ============================================
   SECTION HEADERS RESPONSIVE
   ============================================ */

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

@media (max-width: 767px) {
  .section-header {
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
  }
  
  .section-header .btn {
    width: 100%;
  }
}

@media (min-width: 768px) and (max-width: 1279px) {
  .section-header {
    flex-direction: row;
    gap: 1rem;
  }
  
  .section-header .btn {
    min-width: auto;
    flex: 0 0 auto;
  }
}

@media (min-width: 1280px) {
  .section-header {
    gap: 1.5rem;
  }
}

/* ============================================
   NAVIGATION TABS RESPONSIVE
   ============================================ */

.dashboard-tabs .nav-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  border-bottom: none !important;
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-radius: 0;
  padding: 0.75rem 1rem 0 1rem;
  box-shadow: none !important;
  border: none !important;
  position: relative;
  overflow: visible;
}

.dashboard-tabs .nav-tabs::before {
  display: none;
}

.dashboard-tabs .nav-link {
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-bottom: none !important;
  border-radius: 0.875rem 0.875rem 0 0;
  background: rgba(35, 35, 55, 0.5) !important;
  color: rgba(255, 255, 255, 0.6) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.dashboard-tabs .nav-link::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(0, 212, 170, 0.08) 0%, rgba(0, 168, 255, 0.06) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.dashboard-tabs .nav-link:hover {
  background: rgba(50, 50, 70, 0.7) !important;
  color: rgba(255, 255, 255, 0.85) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.dashboard-tabs .nav-link:hover::before {
  opacity: 1;
}

.dashboard-tabs .nav-link.active {
  color: #fff !important;
  background: linear-gradient(135deg, rgba(0, 212, 170, 0.18) 0%, rgba(0, 168, 255, 0.14) 100%) !important;
  border-color: rgba(0, 212, 170, 0.35) !important;
  font-weight: 600;
  box-shadow: 
    0 6px 20px rgba(0, 212, 170, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    inset 0 -1px 0 rgba(0, 212, 170, 0.2);
  transform: translateY(-2px);
}

.dashboard-tabs .nav-link.active::before {
  opacity: 1;
  background: linear-gradient(135deg, rgba(0, 212, 170, 0.12) 0%, rgba(0, 168, 255, 0.1) 100%);
}

.dashboard-tabs .nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #00d4aa 0%, #00a8ff 100%);
  border-radius: 3px 3px 0 0;
  box-shadow: 
    0 0 16px rgba(0, 212, 170, 0.8),
    0 0 32px rgba(0, 212, 170, 0.4);
  animation: tab-glow 2s ease-in-out infinite;
}

.dashboard-tabs .nav-link i {
  color: inherit !important;
  flex-shrink: 0;
}

.dashboard-tabs .nav-link.active i {
  filter: drop-shadow(0 0 6px rgba(0, 212, 170, 0.6));
}

@keyframes tab-glow {
  0%, 100% {
    opacity: 1;
    box-shadow: 
      0 0 16px rgba(0, 212, 170, 0.8),
      0 0 32px rgba(0, 212, 170, 0.4);
  }
  50% {
    opacity: 0.85;
    box-shadow: 
      0 0 20px rgba(0, 212, 170, 0.9),
      0 0 40px rgba(0, 212, 170, 0.5);
  }
}

@media (max-width: 575px) {
  .dashboard-tabs .nav-link {
    padding: 10px 12px;
    font-size: 0.8rem;
    min-height: 44px;
  }
}

@media (min-width: 576px) and (max-width: 767px) {
  .dashboard-tabs .nav-link {
    padding: 12px 16px;
    font-size: 0.85rem;
    min-height: 44px;
  }
}

@media (min-width: 768px) {
  .dashboard-tabs .nav-link {
    padding: 12px 20px;
    font-size: 0.9rem;
    min-height: 48px;
  }
}

/* ============================================
   BUTTONS RESPONSIVE
   ============================================ */

.btn {
  padding: 12px 20px;
  font-size: 0.9rem;
  min-height: 44px;
  white-space: nowrap;
}

@media (max-width: 575px) {
  .btn {
    padding: 10px 16px;
    font-size: 0.85rem;
    width: 100%;
    margin-bottom: 0.5rem;
  }
  
  .btn:last-child {
    margin-bottom: 0;
  }
}

@media (min-width: 576px) and (max-width: 767px) {
  .btn {
    padding: 12px 18px;
    font-size: 0.875rem;
  }
}

@media (min-width: 768px) {
  .btn {
    width: auto;
    margin-bottom: 0;
  }
}

/* Button groups responsive */
.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

@media (max-width: 575px) {
  .btn-group {
    flex-direction: column;
    width: 100%;
  }
  
  .btn-group .btn {
    width: 100%;
  }
}

/* ============================================
   FORMS RESPONSIVE
   ============================================ */

.form-control,
.form-select {
  width: 100%;
  padding: 12px 16px;
  font-size: 16px; /* Prevent iOS zoom */
  min-height: 44px;
}

@media (min-width: 768px) {
  .form-control,
  .form-select {
    font-size: 1rem;
  }
}

/* Form groups */
.form-group {
  margin-bottom: 1.5rem;
}

@media (max-width: 575px) {
  .form-group {
    margin-bottom: 1.25rem;
  }
}

/* ============================================
   MODALS RESPONSIVE
   ============================================ */

.modal-dialog {
  margin: 1rem;
  max-width: 500px;
}

@media (min-width: 576px) {
  .modal-dialog {
    margin: 1.75rem auto;
    max-width: 500px;
  }
}

@media (min-width: 768px) {
  .modal-dialog {
    max-width: 600px;
  }
}

@media (min-width: 992px) {
  .modal-dialog {
    max-width: 700px;
  }
}

/* ============================================
   CARDS RESPONSIVE
   ============================================ */

.card,
.summary-card,
.feature-card {
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 575px) {
  .card,
  .summary-card,
  .feature-card {
    padding: 1rem;
    margin-bottom: 1rem;
  }
}

@media (min-width: 768px) {
  .card,
  .summary-card,
  .feature-card {
    padding: 2rem;
  }
}

/* ============================================
   OPPORTUNITIES GRID RESPONSIVE
   ============================================ */

.opportunities-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 576px) {
  .opportunities-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
}

@media (min-width: 768px) {
  .opportunities-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
  }
}

@media (min-width: 992px) {
  .opportunities-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
  }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Hide on mobile */
@media (max-width: 575px) {
  .hide-mobile {
    display: none !important;
  }
}

/* Hide on mobile and tablet */
@media (max-width: 1279px) {
  .hide-mobile-tablet {
    display: none !important;
  }
}

/* Hide on tablet */
@media (min-width: 576px) and (max-width: 1279px) {
  .hide-tablet {
    display: none !important;
  }
}

/* Hide on desktop */
@media (min-width: 1280px) {
  .hide-desktop {
    display: none !important;
  }
}

/* Show only on mobile */
.show-mobile {
  display: none;
}

@media (max-width: 575px) {
  .show-mobile {
    display: block;
  }
}

/* Show only on tablet */
.show-tablet {
  display: none;
}

@media (min-width: 576px) and (max-width: 1279px) {
  .show-tablet {
    display: block;
  }
}

/* Show only on desktop */
.show-desktop {
  display: none;
}

@media (min-width: 1280px) {
  .show-desktop {
    display: block;
  }
}

/* ============================================
   SPACING RESPONSIVE
   ============================================ */

/* Responsive margins */
@media (max-width: 575px) {
  .mb-mobile {
    margin-bottom: 1rem;
  }
  
  .mt-mobile {
    margin-top: 1rem;
  }
}

@media (min-width: 768px) {
  .mb-tablet {
    margin-bottom: 1.5rem;
  }
  
  .mt-tablet {
    margin-top: 1.5rem;
  }
}

@media (min-width: 1280px) {
  .mb-desktop {
    margin-bottom: 2rem;
  }

  .mt-desktop {
    margin-top: 2rem;
  }
}

/* === LIGHT MODE === */
[data-theme="light"] .dashboard-tabs .nav-link.active {
  color: var(--text-primary) !important;
  background: rgba(0, 160, 128, 0.12) !important;
  border-color: rgba(0, 160, 128, 0.3) !important;
  box-shadow:
    0 4px 12px rgba(0, 160, 128, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

[data-theme="light"] .dashboard-tabs .nav-link.active::after {
  background: linear-gradient(90deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  box-shadow:
    0 0 8px rgba(0, 160, 128, 0.4),
    0 0 16px rgba(0, 160, 128, 0.2);
}

[data-theme="light"] .dashboard-tabs .nav-link.active i {
  filter: none;
}

