/**
 * Responsive Styles for GeoTax Application
 * Mobile-first approach with breakpoints for different screen sizes
 */

/* Mobile First - Base styles are for mobile devices */

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) {
  .container {
    max-width: 540px;
  }

  .login-card {
    margin: 20px;
  }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
  .container {
    max-width: 720px;
  }

  /* Navigation adjustments for tablets */
  .nav-menu ul {
    flex-wrap: nowrap;
  }

  .nav-menu li {
    min-width: auto;
  }

  /* Form layout improvements */
  .form-row {
    margin: 0 -15px;
  }

  .form-col {
    padding: 0 15px;
  }

  /* Table improvements */
  .table-responsive {
    overflow-x: visible;
  }

  /* Stats grid adjustments */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
  .container {
    max-width: 960px;
  }

  /* Dashboard layout improvements */
  .dashboard-content {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 30px;
  }

  .dashboard-sidebar {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    height: fit-content;
  }

  .dashboard-main {
    min-width: 0; /* Prevent flex item from overflowing */
  }

  /* Stats grid for desktop */
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  /* Form improvements for desktop */
  .form-col-half {
    flex: 0 0 50%;
  }

  .form-col-third {
    flex: 0 0 33.333%;
  }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
  .container {
    max-width: 1140px;
  }
}

/* Extra extra large devices (larger desktops, 1400px and up) */
@media (min-width: 1400px) {
  .container {
    max-width: 1320px;
  }
}

/* Mobile-specific styles (max-width: 767px) */
@media (max-width: 767px) {
  /* Login page mobile adjustments */
  .login-page {
    padding: 10px;
  }

  .login-header {
    padding: 20px 15px;
  }

  .login-header h1 {
    font-size: 1.5rem;
  }

  .login-form {
    padding: 20px 15px;
  }

  /* Navigation mobile menu */
  .nav-menu ul {
    flex-direction: column;
  }

  .nav-menu li {
    min-width: auto;
  }

  .nav-menu a {
    border-right: none;
    border-bottom: 1px solid #e9ecef;
  }

  .nav-menu li:last-child a {
    border-bottom: none;
  }

  /* Dashboard mobile adjustments */
  .dashboard-nav {
    flex-direction: column;
    gap: 15px;
    text-align: center;
  }

  .dashboard-nav .user-info {
    justify-content: center;
  }

  /* Form mobile adjustments */
  .form-row {
    flex-direction: column;
    margin: 0;
  }

  .form-col,
  .form-col-half,
  .form-col-third {
    flex: none;
    width: 100%;
    padding: 0;
    margin-bottom: 15px;
  }

  /* Table mobile adjustments */
  .table-responsive {
    font-size: 14px;
  }

  .table th,
  .table td {
    padding: 8px 10px;
  }

  /* Hide less important columns on mobile */
  .table .hide-mobile {
    display: none;
  }

  /* Card adjustments */
  .card-header,
  .card-body,
  .card-footer {
    padding: 15px;
  }

  /* Button adjustments */
  .btn {
    width: 100%;
    margin-bottom: 10px;
  }

  .btn-group .btn {
    width: auto;
    margin-bottom: 0;
  }

  /* Stats grid mobile */
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .stat-card {
    padding: 20px 15px;
  }

  .stat-card .stat-icon {
    font-size: 2.5rem;
  }

  .stat-card .stat-number {
    font-size: 2rem;
  }

  /* Image upload mobile */
  .image-upload-container {
    padding: 20px 15px;
  }

  .image-preview {
    justify-content: center;
  }

  .image-preview-item {
    width: 80px;
    height: 80px;
  }
}

/* Tablet portrait adjustments (768px to 991px) */
@media (min-width: 768px) and (max-width: 991px) {
  /* Form adjustments for tablet portrait */
  .form-col-half {
    flex: 0 0 100%;
    margin-bottom: 15px;
  }

  .form-col-third {
    flex: 0 0 50%;
    margin-bottom: 15px;
  }

  /* Stats grid for tablet */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  /* Increase touch targets */
  .btn {
    min-height: 44px;
    padding: 12px 20px;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    min-height: 44px;
    padding: 12px 15px;
  }

  .nav-menu a {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  /* Remove hover effects on touch devices */
  .btn:hover,
  .nav-menu a:hover,
  .card:hover,
  .stat-card:hover {
    transform: none;
    box-shadow: initial;
  }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* Optimize images and icons for retina displays */
  .login-header h1 {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}

/* Landscape orientation adjustments */
@media (orientation: landscape) and (max-height: 500px) {
  .login-page {
    padding: 10px;
  }

  .login-card {
    max-width: 600px;
    display: flex;
  }

  .login-header {
    flex: 0 0 40%;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .login-form {
    flex: 1;
  }
}

/* Print media adjustments */
@media print {
  /* Hide navigation and interactive elements */
  .nav-menu,
  .dashboard-nav,
  .btn,
  .form-group input,
  .form-group select,
  .form-group textarea {
    display: none !important;
  }

  /* Optimize layout for printing */
  .container {
    max-width: none;
    padding: 0;
  }

  .card {
    break-inside: avoid;
    margin-bottom: 20px;
  }

  .table {
    font-size: 12px;
  }

  .table th,
  .table td {
    padding: 5px;
  }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
  /* Disable animations for users who prefer reduced motion */
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Dark mode support (if browser supports it) */
@media (prefers-color-scheme: dark) {
  /* This can be implemented later if dark mode is required */
  /* For now, we'll stick with the light theme */
}

/* Focus improvements for keyboard navigation */
@media (any-hover: none) {
  /* Improve focus indicators on devices without hover */
  .btn:focus,
  .form-group input:focus,
  .form-group select:focus,
  .form-group textarea:focus,
  .nav-menu a:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
  }
}
