/* ===================================
   Modern Reddit Search - Responsive CSS
   =================================== */

/* Root Variables */
:root {
  --primary-color: #0d6efd;
  --primary-dark: #0a58ca;
  --secondary-color: #6c757d;
  --success-color: #198754;
  --info-color: #0dcaf0;
  --highlight-bg: #8b5cf6;
  --highlight-text: #ffffff;
  --body-bg: #f8f9fa;
  --card-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  --card-shadow-hover: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* Global Styles */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: #212529;
  background-color: var(--body-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Navbar */
.navbar {
  padding: 1rem 0;
}

.navbar-brand {
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-icon {
  font-size: 1.5rem;
}

/* Main Content */
main {
  min-height: calc(100vh - 200px);
}

/* Cards */
.card {
  border-radius: 0.75rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-shadow-hover) !important;
}

/* Forms */
.form-control,
.form-select {
  border-radius: 0.5rem;
  border: 2px solid #e9ecef;
  padding: 0.75rem 1rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.15);
}

.form-control-lg {
  padding: 0.875rem 1.25rem;
  font-size: 1.125rem;
}

.form-label {
  margin-bottom: 0.5rem;
  color: #495057;
}

.form-text {
  font-size: 0.875rem;
  color: #6c757d;
}

/* Radio buttons */
.form-check {
  padding: 0.75rem;
  border-radius: 0.5rem;
  transition: background-color 0.15s ease;
}

.form-check:hover {
  background-color: #f8f9fa;
}

.form-check-input {
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.125rem;
  cursor: pointer;
}

.form-check-label {
  cursor: pointer;
  user-select: none;
}

/* Buttons */
.btn {
  border-radius: 0.5rem;
  font-weight: 500;
  padding: 0.625rem 1.5rem;
  transition: all 0.2s ease;
  border: 2px solid transparent;
}

.btn-lg {
  padding: 0.875rem 2rem;
  font-size: 1.125rem;
}

.btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-primary:hover {
  background-color: var(--primary-dark);
  border-color: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
}

.btn-outline-primary {
  color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-outline-primary:hover {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

/* Results */
.result-card {
  transition: all 0.2s ease;
}

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

.result-card .card-body {
  padding: 1.5rem !important;
}

@media (min-width: 768px) {
  .result-card .card-body {
    padding: 2rem !important;
  }
}

.result-content {
  font-size: 0.95rem;
  line-height: 1.7;
  color: #495057;
  overflow-wrap: break-word;
  word-wrap: break-word;
  padding: 0.75rem 0;
}

.result-content p {
  margin-bottom: 0.75rem;
}

.result-content p:last-child {
  margin-bottom: 0;
}

/* Highlighted search terms */
.result-content span[style*="purple"] {
  background-color: var(--highlight-bg) !important;
  color: var(--highlight-text) !important;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-weight: 500;
}

/* Badges */
.badge {
  font-weight: 500;
  letter-spacing: 0.025em;
  padding: 0.375rem 0.75rem;
  border-radius: 0.375rem;
}

/* Links */
a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

/* Footer */
footer {
  margin-top: auto;
  border-top: 1px solid #dee2e6;
}

/* Responsive Utilities */
@media (max-width: 576px) {
  .card-body {
    padding: 1rem !important;
  }
  
  .navbar-brand {
    font-size: 1.1rem;
  }
  
  .brand-icon {
    font-size: 1.25rem;
  }
  
  .display-5 {
    font-size: 2rem;
  }
  
  .lead {
    font-size: 1rem;
  }
  
  .result-content {
    font-size: 0.9rem;
  }
}

@media (max-width: 768px) {
  body {
    font-size: 15px;
  }
  
  .btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
  }
}

/* Touch devices */
@media (hover: none) and (pointer: coarse) {
  .form-check {
    padding: 1rem 0.75rem;
  }
  
  .form-check-input {
    width: 1.5rem;
    height: 1.5rem;
  }
  
  .btn {
    min-height: 48px;
  }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
  :root {
    --body-bg: #212529;
    --card-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.3);
  }
}

/* Loading Animation */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.loading {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Print styles */
@media print {
  .navbar,
  footer,
  .btn {
    display: none !important;
  }
  
  .card {
    box-shadow: none !important;
    border: 1px solid #dee2e6 !important;
    break-inside: avoid;
  }
}
