/* Responsive Design */

/* Large Tablets and Small Desktops */
@media (max-width: 1024px) {
  .main-content {
    margin-left: 0;
    padding: 1rem;
  }
  
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .dashboard-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
  
  .analytics-grid {
    grid-template-columns: 1fr;
  }
  
  .tables-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  }
}

/* Tablets */
@media (max-width: 768px) {
  .login-card {
    margin: 1rem;
  }
  
  .main-content {
    padding: 1rem;
  }
  
  .section-header h1 {
    font-size: 1.5rem;
  }
  
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  
  .table-controls {
    flex-direction: column;
  }
  
  .search-input {
    max-width: none;
  }
  
  .data-table {
    font-size: 0.875rem;
  }
  
  .data-table th,
  .data-table td {
    padding: 0.75rem 0.5rem;
  }
  
  .table-actions {
    flex-direction: column;
  }
  
  .pagination {
    flex-direction: column;
    gap: 1rem;
  }
  
  .modal {
    width: 95%;
    margin: 1rem;
  }
  
  .notification {
    min-width: 250px;
    right: 0.5rem;
    left: 0.5rem;
  }
  
  .tables-grid {
    grid-template-columns: 1fr;
  }
  
  .analytics-grid {
    grid-template-columns: 1fr;
  }
}

/* Mobile Phones */
@media (max-width: 480px) {
  .login-card {
    padding: 1.5rem;
  }
  
  .sidebar {
    width: 100%;
  }
  
  .main-content {
    padding: 0.75rem;
  }
  
  .section-header {
    margin-bottom: 1.5rem;
  }
  
  .section-header h1 {
    font-size: 1.25rem;
  }
  
  .stat-card {
    padding: 1rem;
  }
  
  .stat-value {
    font-size: 1.5rem;
  }
  
  .chart-container {
    padding: 1rem;
  }
  
  .data-table-container {
    overflow-x: auto;
  }
  
  .data-table {
    min-width: 500px;
  }
  
  .btn {
    padding: 0.625rem 1rem;
    font-size: 0.75rem;
  }
  
  .btn-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.7rem;
  }
  
  .modal {
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }
  
  .modal-header,
  .modal-body,
  .modal-footer {
    padding: 1rem;
  }
  
  .modal-footer {
    flex-direction: column;
  }
  
  .modal-footer .btn {
    width: 100%;
  }
  
  .notification {
    right: 0.5rem;
    left: 0.5rem;
    min-width: auto;
  }
  
  .table-card {
    padding: 1rem;
  }
  
  .chart-container canvas {
    max-height: 200px;
  }
}

/* Landscape Orientation for Mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .login-card {
    padding: 1rem;
  }
  
  .login-card h1 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
  }
  
  .form-group {
    margin-bottom: 1rem;
  }
  
  .modal {
    max-height: 90vh;
  }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .spinner {
    border-width: 2px;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .spinner {
    animation: none;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  :root {
    --background-color: #0f172a;
    --surface-color: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --border-color: #334155;
  }
  
  .login-container {
    background: linear-gradient(135deg, #1e40af, #1e3a8a);
  }
  
  .data-table th {
    background-color: #334155;
  }
  
  .data-table tr:hover {
    background-color: #334155;
  }
  
  .modal-close:hover {
    background-color: #334155;
  }
}

/* Print Styles */
@media print {
  .sidebar,
  .loading-overlay,
  .notification-container,
  .modal-container,
  .btn,
  .table-controls,
  .pagination {
    display: none !important;
  }
  
  .main-content {
    margin-left: 0;
    padding: 0;
  }
  
  .content-section {
    display: block !important;
  }
  
  .data-table {
    border-collapse: collapse;
    width: 100%;
  }
  
  .data-table th,
  .data-table td {
    border: 1px solid #000;
    padding: 0.5rem;
  }
  
  .stat-card,
  .chart-container,
  .table-card {
    border: 1px solid #000;
    break-inside: avoid;
    margin-bottom: 1rem;
  }
}