/* Mobile Responsive Styles for Serpent API */

/* Force viewport constraints on mobile */
@media (max-width: 768px) {
  html, body {
    overflow-x: hidden;
    max-width: 100vw;
  }

  /* Global text overflow handling */
  * {
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  /* Container constraints */
  .container,
  main,
  .card,
  .stat-card,
  section,
  article {
    max-width: 100%;
    overflow-x: hidden;
  }

  /* Grid fixes for billing page */
  .grid-2 {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
  }

  /* Stats grid mobile */
  .stats-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }

  /* Card text overflow prevention */
  .card p,
  .card span,
  .alert,
  .text-muted,
  .form-group small {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
  }

  /* Table responsiveness */
  .table, table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Docs page specific fixes */
  .docs-layout {
    display: block !important;
    padding: 5rem 1rem 2rem !important;
    max-width: 100% !important;
  }

  .docs-content {
    max-width: 100% !important;
    overflow-x: hidden !important;
    padding: 0 !important;
  }

  .docs-content h1 {
    font-size: 1.5rem !important;
    word-wrap: break-word;
  }

  .docs-content p,
  .docs-content li,
  .docs-content td {
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  .docs-content pre,
  .code-wrapper pre {
    max-width: 100%;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    font-size: 0.75rem !important;
  }

  .docs-content code {
    word-break: break-all;
    font-size: 0.8rem;
  }

  .endpoint {
    padding: 1rem !important;
  }

  .endpoint-path {
    word-break: break-all;
    font-size: 0.85rem !important;
  }

  .params-table {
    display: block;
    overflow-x: auto;
  }

  /* Security badges on billing */
  .security-badges {
    flex-wrap: wrap;
    gap: 1rem !important;
  }

  /* Amount buttons */
  .amount-buttons {
    flex-wrap: wrap;
  }

  .amount-btn {
    flex: 1 1 calc(33% - 0.5rem);
    min-width: 60px;
  }

  /* Page header mobile */
  .page-header {
    padding: 0 0 1.5rem 0;
  }

  .page-title {
    font-size: 1.5rem !important;
  }

  .page-subtitle {
    font-size: 0.9rem;
  }

}

/* Mobile Menu Toggle Button */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 1001;
}

.mobile-menu-btn svg {
  width: 24px;
  height: 24px;
  stroke: var(--text-primary);
  stroke-width: 2;
  stroke-linecap: round;
}

.mobile-menu-btn .close-icon {
  display: none;
}

.mobile-menu-btn.active .hamburger-icon {
  display: none;
}

.mobile-menu-btn.active .close-icon {
  display: block;
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--navbar-bg);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
  opacity: 1;
}

.mobile-menu {
  display: none;
  position: fixed;
  top: 70px;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-primary);
  z-index: 1000;
  padding: 2rem;
  overflow-y: auto;
  transform: translateY(-100%);
  transition: transform 0.3s ease;
}

.mobile-menu.active {
  transform: translateY(0);
}

.mobile-menu-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mobile-menu-links li {
  border-bottom: 1px solid var(--border);
}

.mobile-menu-links a {
  display: block;
  padding: 1.25rem 0;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-primary);
  transition: color 0.2s;
}

.mobile-menu-links a:hover {
  color: var(--accent);
}

.mobile-menu-buttons {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.mobile-menu-buttons .btn {
  width: 100%;
  text-align: center;
  padding: 1rem;
  font-size: 1rem;
}

/* Tablet Breakpoint */
@media (max-width: 1024px) {
  .navbar {
    padding: 1.5rem 2rem;
  }

  .nav-links {
    gap: 1.5rem;
  }

  .hero-title {
    font-size: 3rem;
  }

  .hero-stats {
    gap: 3rem;
  }

  .stat-value {
    font-size: 2rem;
  }

  .section-title {
    font-size: 2rem;
  }

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

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

/* Mobile Breakpoint */
@media (max-width: 768px) {
  /* Show mobile menu button */
  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .mobile-menu {
    display: block;
  }

  /* Hide desktop nav */
  .nav-links {
    display: none !important;
  }

  .nav-buttons {
    display: none !important;
  }

  .nav-user {
    display: none !important;
  }

  /* Navbar adjustments - consistent across all pages */
  .navbar {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    padding: 0.75rem 1rem !important;
    min-height: 60px !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 9999 !important;
    background: var(--navbar-bg) !important;
  }

  /* Nav container: logo left, hamburger right - consistent for ALL pages */
  .nav-container {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    height: 100%;
  }

  .nav-brand {
    font-size: 1.2rem !important;
    color: var(--accent) !important;
    flex: 0 0 auto;
    white-space: nowrap;
    overflow: visible;
  }

  .nav-brand .brand-api {
    display: inline !important;
  }

  .infinity-serpent {
    flex-shrink: 0;
  }

  .infinity-serpent svg {
    width: 32px !important;
    height: 14px !important;
  }

  /* Hamburger button always on the right */
  .mobile-menu-btn {
    flex: 0 0 auto;
    margin-left: auto;
  }

  /* Hero Section */
  .hero {
    padding: 6rem 1rem 3rem;
    min-height: auto;
  }

  .hero-content {
    padding: 0 0.5rem;
  }

  .hero-badge {
    font-size: 0.75rem;
    padding: 0.3rem 0.8rem;
    margin-bottom: 1.5rem;
  }

  .hero-title {
    font-size: 2rem;
    line-height: 1.2;
    margin-bottom: 1rem;
  }

  .hero-subtitle {
    font-size: 1rem;
    margin-bottom: 2rem;
    line-height: 1.6;
  }

  .hero-buttons {
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
  }

  .hero-buttons .btn {
    width: 100%;
    padding: 1rem;
  }

  .hero-stats {
    flex-direction: column;
    gap: 1.5rem;
    padding-top: 2rem;
  }

  .stat-value {
    font-size: 1.75rem;
  }

  .stat-label {
    font-size: 0.85rem;
  }

  /* Sections */
  .features,
  .how-it-works,
  .pricing,
  .code-section,
  .cta-section {
    padding: 4rem 1rem;
  }

  .section-title {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
  }

  .section-subtitle {
    font-size: 0.95rem;
  }

  /* Features Grid */
  .features-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    max-width: 100%;
  }

  .feature-card {
    padding: 1.5rem;
  }

  .feature-icon {
    width: 48px;
    height: 48px;
    font-size: 1.25rem;
  }

  .feature-title {
    font-size: 1.1rem;
  }

  /* Pricing Grid */
  .pricing-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    max-width: 100%;
  }

  .pricing-card {
    padding: 1.5rem;
  }

  .pricing-card.featured {
    transform: none;
  }

  .plan-name {
    font-size: 1.1rem;
  }

  .plan-price {
    font-size: 2rem;
  }

  /* How It Works */
  .steps {
    flex-direction: column;
    gap: 2rem;
  }

  .step {
    flex-direction: column;
    text-align: center;
    padding: 1.5rem;
  }

  .step-number {
    width: 48px;
    height: 48px;
    font-size: 1.25rem;
    margin-bottom: 1rem;
  }

  /* Code Section */
  .code-container {
    padding: 0;
  }

  .code-header h2 {
    font-size: 1.5rem;
  }

  .code-block {
    border-radius: 8px;
  }

  .code-content {
    padding: 1rem;
    font-size: 0.75rem;
    line-height: 1.6;
  }

  .code-content pre {
    white-space: pre-wrap;
    word-break: break-all;
  }

  /* CTA Section */
  .cta-content h2 {
    font-size: 1.75rem;
  }

  .cta-content p {
    font-size: 1rem;
  }

  /* Footer */
  .footer {
    padding: 3rem 1rem 2rem;
  }

  .footer-container {
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
  }

  .footer-brand {
    justify-content: center;
  }

  .footer-links {
    justify-content: center;
  }

  .footer-links h4 {
    margin-bottom: 0.75rem;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  /* Buttons */
  .btn {
    padding: 0.75rem 1.25rem;
    font-size: 0.9rem;
  }

  .btn-lg {
    padding: 1rem 1.5rem;
    font-size: 1rem;
  }

  /* Forms */
  .form-group {
    margin-bottom: 1.25rem;
  }

  .form-group label {
    font-size: 0.9rem;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 0.875rem;
    font-size: 1rem;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* Tables */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 600px;
  }

  th, td {
    padding: 0.75rem 0.5rem;
    font-size: 0.85rem;
  }

  /* Cards */
  .card, .dashboard-card {
    padding: 1.25rem;
  }

  .card-title {
    font-size: 1.1rem;
  }

  /* Dashboard specific */
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .dashboard-sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    bottom: 0;
    width: 280px;
    z-index: 1000;
    transition: left 0.3s ease;
  }

  .dashboard-sidebar.active {
    left: 0;
  }

  .dashboard-main {
    margin-left: 0;
    padding: 1rem;
  }

  .dashboard-header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

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

  .stat-card {
    padding: 1rem;
  }

  .stat-card .value {
    font-size: 1.5rem;
  }

  /* API Key display */
  .api-key-display {
    flex-direction: column;
    gap: 0.75rem;
  }

  .api-key-display code {
    font-size: 0.75rem;
    word-break: break-all;
  }

  .api-key-actions {
    width: 100%;
    justify-content: flex-end;
  }

  /* Modal */
  .modal-content {
    margin: 1rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
  }

  .modal-header {
    padding: 1rem;
  }

  .modal-body {
    padding: 1rem;
  }

  .modal-footer {
    padding: 1rem;
    flex-direction: column;
    gap: 0.75rem;
  }

  .modal-footer .btn {
    width: 100%;
  }

  /* Docs page */
  .docs-container {
    flex-direction: column;
  }

  .docs-sidebar {
    position: fixed;
    left: -280px;
    top: 70px;
    bottom: 0;
    width: 280px;
    z-index: 100;
    transition: left 0.3s ease;
    background: var(--bg-primary);
  }

  .docs-sidebar.active {
    left: 0;
  }

  .docs-content {
    padding: 1.5rem 1rem;
  }

  .docs-content h1 {
    font-size: 1.75rem;
  }

  .docs-content h2 {
    font-size: 1.4rem;
  }

  .docs-content h3 {
    font-size: 1.2rem;
  }

  /* Login page */
  .login-container,
  .auth-container {
    padding: 1rem;
    min-height: calc(100vh - 70px);
  }

  .login-card,
  .auth-card {
    padding: 1.5rem;
    max-width: 100%;
  }

  .login-title,
  .auth-title {
    font-size: 1.5rem;
  }

  .social-login-btn {
    padding: 0.875rem;
    font-size: 0.95rem;
  }

  /* Billing page */
  .billing-grid {
    grid-template-columns: 1fr;
  }

  .billing-card {
    padding: 1.25rem;
  }

  .amount-input {
    font-size: 1.5rem;
  }

  .quick-amounts {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .quick-amount-btn {
    flex: 1 1 calc(50% - 0.25rem);
    min-width: 80px;
  }

  /* Usage page */
  .usage-grid {
    grid-template-columns: 1fr;
  }

  .chart-container {
    height: 250px;
  }

  /* Contact page */
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .contact-info {
    order: 2;
  }

  .contact-form {
    order: 1;
  }

  /* About page */
  .about-hero {
    padding: 6rem 1rem 3rem;
  }

  .about-hero h1 {
    font-size: 2rem;
  }

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

  /* API Info bar */
  .api-info {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .api-info-item {
    justify-content: space-between;
  }

  /* Search input */
  .search-input-wrap {
    flex-direction: column;
    gap: 0.75rem;
  }

  .search-input-wrap input {
    width: 100%;
  }

  .search-input-wrap .btn {
    width: 100%;
  }

  /* Playground */
  .playground-container {
    flex-direction: column;
  }

  .playground-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .playground-main {
    width: 100%;
  }

  .response-container {
    max-height: 300px;
  }

  /* Alerts/Toasts */
  .alert, .toast {
    padding: 1rem;
    font-size: 0.9rem;
  }

  /* Hide decorative elements on mobile */
  .snake-bg {
    opacity: 0.3;
  }

  .snake-path {
    width: 150px;
    height: 150px;
  }
}

/* Small Mobile Breakpoint */
@media (max-width: 480px) {
  .hero-title {
    font-size: 1.75rem;
  }

  .hero-subtitle {
    font-size: 0.95rem;
  }

  .stat-value {
    font-size: 1.5rem;
  }

  .section-title {
    font-size: 1.5rem;
  }

  .code-content {
    font-size: 0.7rem;
  }

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

  .quick-amount-btn {
    flex: 1 1 100%;
  }

  .nav-brand {
    font-size: 1.1rem;
  }

  .nav-brand .infinity-serpent svg {
    width: 32px;
    height: 14px;
  }
}

/* Landscape phone */
@media (max-width: 768px) and (orientation: landscape) {
  .hero {
    min-height: auto;
    padding: 5rem 1rem 2rem;
  }

  .hero-stats {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }

  .stat {
    flex: 0 0 33.333%;
  }
}

/* Print styles */
@media print {
  .navbar,
  .mobile-menu-btn,
  .mobile-menu,
  .footer,
  .snake-bg {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }

  .hero {
    padding-top: 2rem;
  }
}
