/* Marketing Platform Design System - Responsive CSS */

/* ===================================
   MOBILE-FIRST RESPONSIVE DESIGN
   =================================== */

/* Base Mobile Styles (320px and up) */
@media (max-width: 575.98px) {
  /* Typography adjustments */
  h1, .h1 {
    font-size: var(--text-2xl);
    line-height: 1.3;
  }

  h2, .h2 {
    font-size: var(--text-xl);
    line-height: 1.4;
  }

  h3, .h3 {
    font-size: var(--text-lg);
    line-height: 1.4;
  }

  /* Dashboard Cards */
  .dashboard-card {
    padding: var(--space-4);
    margin-bottom: var(--space-4);
    border-radius: var(--radius-md);
  }

  .dashboard-card__title {
    font-size: var(--text-lg);
    margin-bottom: var(--space-3);
  }

  .dashboard-card__subtitle {
    font-size: var(--text-sm);
    margin-bottom: var(--space-4);
  }

  /* Dashboard Grid */
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
    padding: var(--space-4);
  }

  /* Stat Cards */
  .stat-card {
    padding: var(--space-4);
    text-align: center;
  }

  .stat-number {
    font-size: var(--text-2xl);
  }

  .stat-label {
    font-size: var(--text-xs);
  }

  /* Buttons */
  .btn-primary-custom,
  .btn-secondary-custom {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    min-height: 44px;
    width: 100%;
  }

  /* Forms */
  .form-control-custom {
    padding: var(--space-3);
    font-size: var(--text-base);
    min-height: 44px;
  }

  .form-label-custom {
    font-size: var(--text-sm);
    margin-bottom: var(--space-2);
  }

  /* Navigation */
  .navbar-brand-custom {
    font-size: var(--text-lg);
  }

  .navbar-brand-custom i {
    display: none; /* Hide icon on mobile to save space */
  }

  .nav-link-custom {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
    min-height: 44px;
  }

  .nav-link-custom i {
    font-size: var(--text-base);
  }

  /* Dropdown menus */
  .dropdown-menu-custom {
    width: 100vw;
    max-width: 300px;
    left: 0 !important;
    right: 0 !important;
    margin: 0 auto;
    transform: translateX(0) !important;
  }

  .dropdown-item-custom {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
    min-height: 44px;
  }

  /* Tables */
  .table-custom {
    font-size: var(--text-sm);
  }

  .table-custom th,
  .table-custom td {
    padding: var(--space-2) var(--space-3);
  }

  /* Modals */
  .modal-content-custom {
    margin: var(--space-4);
    border-radius: var(--radius-lg);
  }

  .modal-header-custom,
  .modal-body-custom,
  .modal-footer-custom {
    padding: var(--space-4);
  }

  /* Mobile Bottom Navigation */
  .mobile-bottom-nav {
    display: flex;
  }

  .desktop-navigation {
    display: none;
  }

  /* Empty States */
  .empty-state {
    padding: var(--space-8) var(--space-4);
  }

  .empty-state-icon {
    font-size: var(--text-2xl);
  }

  .empty-state-title {
    font-size: var(--text-lg);
  }

  .empty-state-text {
    font-size: var(--text-sm);
  }

  /* Alerts */
  .alert-custom {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-sm);
  }

  .alert-custom .alert-icon {
    font-size: var(--text-lg);
    margin-right: var(--space-2);
    margin-top: 0;
  }

  /* Badges */
  .badge-custom {
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
  }

  /* Container adjustments */
  .container-fluid {
    padding-left: var(--space-3);
    padding-right: var(--space-3);
  }

  /* Hide certain elements on mobile */
  .mobile-hidden {
    display: none !important;
  }

  /* Special mobile layouts */
  .mobile-stack {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
  }

  .mobile-center {
    text-align: center;
  }

  /* Touch targets for mobile */
  .touch-target {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Mobile card layouts */
  .mobile-card-stack {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
  }

  /* Mobile navigation adjustments */
  .navbar-nav {
    width: 100%;
  }

  .navbar-nav .nav-item {
    width: 100%;
  }

  .navbar-nav .nav-link-custom {
    width: 100%;
  }

  /* Mobile dropdown improvements */
  .dropdown-menu-custom.show {
    position: fixed !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1) !important;
    transform: translateY(0) !important;
  }

  /* Mobile table scrolling */
  .table-responsive {
    margin: 0 calc(-1 * var(--space-3));
    padding: 0 var(--space-3);
  }

  /* Mobile form layouts */
  .form-row-mobile {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
  }

  /* Mobile loading states */
  .loading-overlay {
    padding: var(--space-8);
  }
}

/* Tablet Styles (576px to 1023px) */
@media (min-width: 576px) and (max-width: 1023.98px) {
  /* Dashboard Grid - 2 columns */
  .dashboard-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-5);
    padding: var(--space-5);
  }

  /* Dashboard Cards */
  .dashboard-card {
    padding: var(--space-5);
  }

  /* Typography */
  h1, .h1 {
    font-size: var(--text-3xl);
  }

  h2, .h2 {
    font-size: var(--text-2xl);
  }

  h3, .h3 {
    font-size: var(--text-xl);
  }

  /* Buttons */
  .btn-primary-custom,
  .btn-secondary-custom {
    padding: var(--space-3) var(--space-5);
    font-size: var(--text-base);
    width: auto;
  }

  /* Forms */
  .form-control-custom {
    padding: var(--space-3) var(--space-4);
  }

  /* Navigation */
  .navbar-brand-custom i {
    display: inline;
  }

  .nav-link-custom {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-base);
  }

  /* Dropdown menus */
  .dropdown-menu-custom {
    width: auto;
    max-width: 300px;
    left: auto !important;
    right: auto !important;
  }

  /* Tables */
  .table-custom {
    font-size: var(--text-base);
  }

  /* Stat Cards */
  .stat-number {
    font-size: var(--text-3xl);
  }

  .stat-label {
    font-size: var(--text-sm);
  }

  /* Mobile Bottom Navigation - Hide on tablet */
  .mobile-bottom-nav {
    display: none;
  }

  .desktop-navigation {
    display: block;
  }

  /* Container adjustments */
  .container-fluid {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }

  /* Empty States */
  .empty-state {
    padding: var(--space-12) var(--space-6);
  }

  .empty-state-icon {
    font-size: 2.5rem;
  }

  /* Alerts */
  .alert-custom {
    padding: var(--space-4) var(--space-5);
  }

  /* Form layouts */
  .form-row-mobile {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
  }

  /* Tablet-specific card layouts */
  .tablet-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
  }
}

/* Desktop Styles (1024px and up) */
@media (min-width: 1024px) {
  /* Dashboard Grid - 3+ columns */
  .dashboard-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-6);
    padding: var(--space-6);
  }

  /* Full width grid for large screens */
  @media (min-width: 1400px) {
    .dashboard-grid {
      grid-template-columns: repeat(4, 1fr);
    }
  }

  /* Dashboard Cards */
  .dashboard-card {
    padding: var(--space-6);
    transition: all var(--transition-fast);
  }

  .dashboard-card:hover {
    transform: translateY(-4px);
  }

  /* Typography */
  h1, .h1 {
    font-size: var(--text-3xl); /* 30px */
  }

  h2, .h2 {
    font-size: var(--text-2xl); /* 24px */
  }

  h3, .h3 {
    font-size: var(--text-xl); /* 20px */
  }

  /* Buttons */
  .btn-primary-custom,
  .btn-secondary-custom {
    padding: var(--space-3) var(--space-6);
    font-size: var(--text-base);
  }

  /* Navigation */
  .navbar-brand-custom {
    font-size: var(--text-xl);
  }

  .nav-link-custom {
    padding: var(--space-3) var(--space-4);
  }

  /* Dropdown menus */
  .dropdown-menu-custom {
    min-width: 200px;
  }

  /* Tables */
  .table-custom {
    font-size: var(--text-base);
  }

  .table-custom th,
  .table-custom td {
    padding: var(--space-4);
  }

  /* Stat Cards */
  .stat-number {
    font-size: var(--text-4xl);
  }

  /* Mobile Bottom Navigation - Hide on desktop */
  .mobile-bottom-nav {
    display: none;
  }

  .desktop-navigation {
    display: block;
  }

  /* Container adjustments */
  .container-fluid {
    padding-left: var(--space-6);
    padding-right: var(--space-6);
  }

  /* Empty States */
  .empty-state {
    padding: var(--space-16) var(--space-8);
  }

  .empty-state-icon {
    font-size: var(--text-3xl);
  }

  /* Alerts */
  .alert-custom {
    padding: var(--space-4) var(--space-6);
  }

  /* Desktop-specific layouts */
  .desktop-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-6);
  }

  .desktop-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-6);
  }

  /* Desktop-specific card hover effects */
  .dashboard-card:hover {
    box-shadow: var(--shadow-hover);
  }

  /* Desktop button hover effects */
  .btn-primary-custom:hover {
    transform: translateY(-2px);
  }

  .btn-secondary-custom:hover {
    transform: translateY(-2px);
  }

  /* Enhanced desktop navigation */
  .navbar-nav .nav-link-custom {
    border-radius: var(--radius-md);
    margin: 0 var(--space-1);
  }

  .navbar-nav .nav-link-custom:hover {
    background: var(--navy-50);
    transform: translateY(-1px);
  }

  /* Desktop dropdown enhancements */
  .dropdown-menu-custom {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: dropdownSlide 0.2s ease-out;
  }

  @keyframes dropdownSlide {
    from {
      opacity: 0;
      transform: translateY(-10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  /* Desktop table enhancements */
  .table-custom tbody tr {
    transition: background-color var(--transition-fast);
  }

  .table-custom tbody tr:hover {
    background-color: var(--navy-50);
  }

  /* Desktop form enhancements */
  .form-control-custom:focus {
    box-shadow:
      0 0 0 3px rgba(44, 82, 130, 0.1),
      inset 0 1px 2px rgba(0,0,0,0.05);
  }
}

/* Large Desktop Styles (1400px and up) */
@media (min-width: 1400px) {
  /* Larger containers for ultra-wide screens */
  .container-xl {
    max-width: 1320px;
  }

  /* Enhanced dashboard grid for ultra-wide screens */
  .dashboard-grid {
    grid-template-columns: repeat(4, 1fr);
    max-width: 1400px;
    margin: 0 auto;
  }

  /* Larger typography for ultra-wide screens */
  h1, .h1 {
    font-size: var(--text-4xl);
  }

  h2, .h2 {
    font-size: var(--text-3xl);
  }

  h3, .h3 {
    font-size: var(--text-2xl);
  }

  /* Enhanced stat cards */
  .stat-number {
    font-size: var(--text-4xl);
  }

  /* Enhanced button sizes */
  .btn-primary-custom,
  .btn-secondary-custom {
    padding: var(--space-4) var(--space-8);
    font-size: var(--text-lg);
  }

  /* Ultra-wide specific layouts */
  .ultra-wide-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: var(--space-8);
  }
}

/* ===================================
   ORIENTATION-SPECIFIC STYLES
   =================================== */

/* Landscape orientation for mobile */
@media (max-width: 1023px) and (orientation: landscape) {
  .dashboard-card {
    padding: var(--space-3);
  }

  .dashboard-card__title {
    font-size: var(--text-base);
  }

  .stat-number {
    font-size: var(--text-2xl);
  }

  .empty-state {
    padding: var(--space-6) var(--space-4);
  }

  .mobile-bottom-nav {
    display: none; /* Hide bottom nav in landscape */
  }
}

/* ===================================
   HIGH-DPI (RETINA) DISPLAYS
   =================================== */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* Enhanced icon rendering for retina displays */
  .bi {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  /* Sharper shadows for retina displays */
  .dashboard-card {
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.15),
      0 4px 8px rgba(0,0,0,0.12);
  }

  .dashboard-card:hover {
    box-shadow:
      inset 0 2px 0 rgba(255,255,255,0.2),
      0 8px 16px rgba(0,0,0,0.16);
  }
}

/* ===================================
   REDUCED MOTION PREFERENCES
   =================================== */

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .dashboard-card:hover {
    transform: none !important;
  }

  .btn-primary-custom:hover,
  .btn-secondary-custom:hover {
    transform: none !important;
  }
}

/* ===================================
   DARK MODE SUPPORT (Future Enhancement)
   =================================== */

@media (prefers-color-scheme: dark) {
  /* This section can be implemented when dark mode is added */
  /* Currently keeping the light theme as per design system */
}