/* === RESPONSIVE.CSS - Media Queries and Mobile Optimizations === */

/* Tablet (768px) */
@media (max-width: 768px) {
  :root {
    --spacing-md: 0.75rem;
    --spacing-lg: 1rem;
    --spacing-xl: 1.5rem;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .theme-main,
  .theme-login {
    padding: 1rem;
    align-items: flex-start;
    padding-top: 2rem;
  }

  .theme-main .container,
  .theme-login .container {
    padding: var(--spacing-lg);
    border-radius: var(--radius-xl);
    margin-bottom: 8rem;
  }

  .logo {
    font-size: 1.75rem;
  }

  .logo::before {
    font-size: 1.5rem;
  }

  .table th,
  .table td {
    padding: 0.75rem 0.5rem;
  }

  .service-status {
    bottom: 110px;
    right: 15px;
    left: 15px;
    font-size: 0.6875rem;
    padding: 0.625rem 0.875rem;
    text-align: center;
  }
}

/* Mobile (640px) */
@media (max-width: 640px) {
  body.theme-main {
    padding: 1rem 0.75rem 10rem 0.75rem;
    align-items: flex-start;
    padding-top: 2rem;
    min-height: 100vh;
  }

  .theme-main {
    min-height: 100vh;
    overflow-x: hidden;
    padding: 2rem 0.75rem 10rem;
    align-items: flex-start;
  }

  .theme-main .container {
    padding: var(--spacing-lg);
    margin: 0 auto 6rem;
    border-radius: var(--radius-xl);
    max-width: 100%;
    overflow-x: hidden;
    scroll-margin-top: 1rem;
    scroll-margin-bottom: 6rem;
  }

  .logo {
    font-size: 1.75rem;
  }

  .logo::before {
    font-size: 1.5rem;
  }

  .subtitle {
    font-size: 1rem;
  }

  .url-input {
    padding: 1rem 1.25rem;
    font-size: 16px; /* Prevents iOS zoom */
  }

  .scan-button {
    padding: 1rem;
    font-size: 1rem;
  }

  .result {
    padding: 1.25rem;
    font-size: 1rem;
    margin-bottom: 2rem;
    scroll-margin-top: 1rem;
    scroll-margin-bottom: 2rem;
  }

  .result.rate-limit,
  .result.unsafe,
  .result.warning {
    padding: 1.25rem;
    font-size: 1rem;
  }
  
  .result.rate-limit .result-text,
  .result.unsafe .result-text,
  .result.warning .result-text {
    font-size: 1.125rem;
    line-height: 1.3;
    margin-bottom: 0.75rem;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
  }
  
  .result.rate-limit .result-details,
  .result.unsafe .result-details,
  .result.warning .result-details {
    font-size: 0.875rem;
    line-height: 1.4;
    opacity: 0.95;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
  }

  .result-icon {
    font-size: 2.5rem;
  }

  .footer {
    padding: 0.75rem var(--spacing-md);
  }

  .footer-content {
    font-size: 0.6875rem;
    line-height: 1.3;
  }

  .cta-content {
    padding: 1.25rem;
  }

  .cta-title {
    font-size: 1rem;
  }

  .cta-description {
    font-size: 0.8125rem;
  }

  .cta-button {
    padding: 0.625rem 1.25rem;
    font-size: 0.8125rem;
  }

  .result-details-expanded,
  .security-tips {
    padding: var(--spacing-md);
    margin: var(--spacing-md) 0.5rem 2rem;
    scroll-margin-top: 1rem;
  }
  
  .detail-item {
    flex-direction: column;
    gap: 0.25rem;
  }
  
  .detail-item strong {
    min-width: auto;
  }
  
  .detail-item span:last-child {
    text-align: left;
    font-size: 0.8125rem;
  }

  .legend-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.25rem;
  }

  .legend-item {
    padding: 0.25rem;
    font-size: 0.6875rem;
  }

  .legend-icon {
    font-size: 0.875rem;
  }

  .score-legend {
    padding: 0.75rem;
  }

  .score-legend h5 {
    font-size: 0.8125rem;
  }

  .understood-button {
    padding: 0.875rem var(--spacing-md);
    font-size: 0.9rem;
    margin-top: var(--spacing-md);
  }

  .bot-message {
    padding: 0.875rem;
    font-size: 0.875rem;
    line-height: 1.4;
    margin: var(--spacing-md) 0.5rem 2rem;
  }

  #scrollToTop {
    bottom: 120px;
    right: 15px;
    width: 45px;
    height: 45px;
    font-size: 18px;
  }
}

/* Small Mobile (480px) */
@media (max-width: 480px) {
  body.theme-main {
    padding: 1rem 0.5rem 10rem 0.5rem;
  }

  .theme-main .container,
  .theme-login .container {
    padding: 1.25rem;
  }

  .logo {
    font-size: 1.5rem;
  }

  .subtitle {
    font-size: 0.9rem;
  }

  .result {
    font-size: 1rem;
  }
}

/* Scroll to Top Button */
#scrollToTop {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--primary-orange);
  color: white;
  border: none;
  font-size: 20px;
  cursor: pointer;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(255, 120, 73, 0.3);
  transition: var(--transition-normal);
  display: none;
}

#scrollToTop:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(255, 120, 73, 0.4);
}

#scrollToTop.show {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Service Status Badge */
.service-status {
  position: fixed;
  bottom: 80px;
  right: 20px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 0.5rem 1rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(0, 0, 0, 0.05);
  font-size: 0.75rem;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
}

.service-status:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* Print Styles */
@media print {
  .theme-main::before,
  .floating-shape,
  #scrollToTop,
  .service-status,
  footer {
    display: none !important;
  }
  
  body {
    background: white !important;
    color: black !important;
  }
  
  .theme-main {
    background: white !important;
    min-height: auto;
    padding: 0;
  }
  
  .container {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
    max-width: 100% !important;
  }
  
  .btn,
  .scan-button,
  .understood-button {
    display: none !important;
  }
  
  .result {
    page-break-inside: avoid;
  }
  
  a {
    color: black !important;
    text-decoration: underline !important;
  }
  
  .source-badge::before,
  .confidence-indicator::before,
  .dual-check-badge::before {
    display: none;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  :root {
    --primary-orange: #ff6600;
    --primary-orange-dark: #cc5200;
    --success: #00cc00;
    --warning: #ffcc00;
    --danger: #ff0000;
  }
  
  .container {
    border: 2px solid black !important;
  }
  
  .btn {
    border: 2px solid currentColor !important;
  }
  
  .form-input {
    border-width: 2px !important;
  }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  html {
    scroll-behavior: auto;
  }
}

/* Progressive Enhancement for Modern Browsers */
@supports (backdrop-filter: blur(10px)) {
  .container,
  .card,
  .modal-content,
  .service-status {
    background: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(10px);
  }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
  :root {
    --primary-orange: #ff8a65;
    --primary-orange-dark: #ff7043;
    --shadow-orange: 0 8px 25px rgba(255, 138, 101, 0.4);
  }
  
  body {
    background: #0f172a;
    color: #e2e8f0;
  }
  
  .container {
    background: rgba(30, 41, 59, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
  }
  
  .form-input {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    color: white;
  }
  
  .result.safe {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.9), rgba(34, 197, 94, 0.85));
  }
  
  .result.unsafe {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.9), rgba(220, 38, 38, 0.85));
  }
  
  .result.warning {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.9), rgba(245, 158, 11, 0.85));
  }
}