/* Responsive Design Enhancements for UCC Filing Manager */

/* Extra Small Devices (< 576px) */
@media (max-width: 575.98px) {
  /* Navigation */
  .navbar-brand {
    font-size: 1.1rem;
  }
  
  .navbar-nav .nav-link {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
  }
  
  /* Tables - Make them scrollable */
  .table-responsive {
    -webkit-overflow-scrolling: touch;
  }
  
  .table {
    font-size: 0.875rem;
  }
  
  /* Forms */
  .form-label {
    font-size: 0.875rem;
  }
  
  .btn {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
  }
  
  /* Cards */
  .card {
    margin-bottom: 1rem;
  }
  
  /* Page Headers */
  .page-header h1 {
    font-size: 1.5rem;
  }
  
  .page-header .text-muted {
    font-size: 0.9rem;
  }
  
  .stat-card {
    padding: 1rem;
  }
  
  .stat-card .stat-value {
    font-size: 1.5rem;
  }
  
  .stat-card .stat-label {
    font-size: 0.75rem;
  }
  
  /* Search Results */
  .search-result-item {
    padding: 1rem;
  }
  
  .search-result-item .result-title {
    font-size: 1rem;
  }
  
  .search-result-item .result-actions {
    flex-direction: column;
    gap: 0.5rem;
  }
  
  .search-result-item .result-actions .btn {
    width: 100%;
  }
  
  /* Pagination */
  .pagination {
    font-size: 0.875rem;
  }
  
  .pagination .page-link {
    padding: 0.25rem 0.5rem;
  }
  
  /* Footer */
  .footer-modern {
    text-align: center;
  }
  
  .footer-modern .row > div {
    margin-bottom: 1.5rem;
  }
  
  .footer-bottom .row {
    text-align: center;
  }
  
  .footer-legal {
    text-align: center !important;
    margin-top: 1rem;
  }
  
  /* Touch-friendly elements */
  button, .btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  
  /* Exclude regular links from min-height */
  a:not(.btn):not(.nav-link):not(.dropdown-item) {
    min-height: auto;
  }
  
  /* Stack form elements */
  .row.g-3 > .col-md-3,
  .row.g-3 > .col-md-6,
  .row.g-3 > .col-md-9 {
    margin-bottom: 1rem;
  }
}

/* Small Devices (576px - 767px) */
@media (min-width: 576px) and (max-width: 767.98px) {
  /* Tables */
  .table {
    font-size: 0.9rem;
  }
  
  /* Cards grid */
  .stat-cards-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
  
  /* Search filters */
  .search-filters {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}

/* Medium Devices (768px - 991px) */
@media (min-width: 768px) and (max-width: 991.98px) {
  /* Navigation adjustments */
  .navbar-nav {
    font-size: 0.95rem;
  }
  
  /* Three column layout for stats */
  .stat-cards-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
  }
  
  /* Table adjustments */
  .table th,
  .table td {
    padding: 0.5rem;
  }
}

/* Large Devices (992px - 1199px) */
@media (min-width: 992px) and (max-width: 1199.98px) {
  /* Container width optimization */
  .container {
    max-width: 960px;
  }
}

/* Extra Large Devices (>= 1200px) */
@media (min-width: 1200px) {
  /* Container width optimization */
  .container {
    max-width: 1140px;
  }
}

/* Landscape Orientation Adjustments */
@media (orientation: landscape) and (max-height: 600px) {
  /* Reduce vertical spacing */
  .navbar {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
  }
  
  .card {
    margin-bottom: 0.5rem;
  }
  
  h1, h2, h3 {
    margin-bottom: 0.5rem;
  }
}

/* Print Styles */
@media print {
  /* Hide non-essential elements */
  .navbar,
  .btn-print,
  .btn-export,
  .pagination,
  footer,
  .alert-dismissible .btn-close {
    display: none !important;
  }
  
  /* Ensure content fills page */
  body {
    font-size: 12pt;
  }
  
  .container {
    max-width: 100%;
  }
  
  /* Ensure tables don't break across pages */
  table {
    page-break-inside: avoid;
  }
  
  /* Remove shadows and backgrounds */
  .card {
    box-shadow: none !important;
    border: 1px solid #000;
  }
  
  /* Black text on white background */
  * {
    color: #000 !important;
    background: #fff !important;
  }
}

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

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .btn-outline-primary {
    border-width: 2px;
  }
  
  .form-control,
  .form-select {
    border-width: 2px;
  }
  
  .card {
    border: 2px solid currentColor;
  }
}

/* Dark Mode Support - Uses unified color system from main.css */
/* Dark mode styles are primarily handled in main.css via @media (prefers-color-scheme: dark) */

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
  /* Increase touch targets */
  .btn,
  .form-control,
  .form-select,
  .form-check-input,
  a {
    min-height: 48px;
  }
  
  /* Remove hover effects on touch devices */
  .hover-shadow:hover {
    box-shadow: none;
  }
  
  /* Increase spacing between interactive elements */
  .btn + .btn {
    margin-left: 0.5rem;
  }
  
  .form-check {
    padding: 0.5rem 0;
  }
}

/* Specific Component Fixes */

/* Fix table overflow on mobile */
@media (max-width: 767.98px) {
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-left: -1rem;
    margin-right: -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
  }
  
  .table {
    min-width: 600px;
  }
}

/* Fix modal on small screens */
@media (max-width: 575.98px) {
  .modal-dialog {
    margin: 0.5rem;
  }
  
  .modal-content {
    border-radius: 0.25rem;
  }
  
  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 1rem;
  }
}

/* Fix dropdown menus on mobile */
@media (max-width: 991.98px) {
  .dropdown-menu {
    position: static !important;
    transform: none !important;
    width: 100%;
    margin-top: 0.5rem;
  }
}

/* Fix search form on mobile */
@media (max-width: 575.98px) {
  .search-form .row {
    margin-left: 0;
    margin-right: 0;
  }
  
  .search-form .col-md-3,
  .search-form .col-md-9 {
    padding-left: 0;
    padding-right: 0;
  }
  
  .state-selector {
    max-height: 150px !important;
  }
}