/* Common styles for all pages */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: #333;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
}

/* Mobile-first responsive navigation */
.nav-container {
  background: #2c3e50;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.nav-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 20px;
}

.nav-brand {
  color: white;
  text-decoration: none;
  font-size: 1.5rem;
  font-weight: bold;
  padding: 15px 0;
}

.nav-brand:hover {
  color: #667eea;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 10px;
}

.nav-menu {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-item {
  margin: 0;
}

.nav-link {
  display: block;
  color: white;
  text-decoration: none;
  padding: 15px 20px;
  transition: background 0.3s, color 0.3s;
  white-space: nowrap;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #667eea;
}

.nav-link.active {
  background: #667eea;
  color: white;
}

/* Dropdown styles */
.nav-dropdown {
  position: relative;
}

.nav-dropdown .dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #34495e;
  min-width: 200px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  border-radius: 0 0 8px 8px;
  z-index: 1000;
}

/* Desktop dropdown behavior - JavaScript controlled only */
@media (min-width: 769px) {
  /* Disable hover behavior completely - use JavaScript only */
  .nav-dropdown .dropdown-content {
    display: none;
  }

  /* Show dropdown only when active class is present */
  .nav-dropdown.active .dropdown-content {
    display: block;
  }

  /* Arrow rotation based on active state */
  .nav-dropdown.active > .nav-link::after {
    transform: rotate(180deg);
  }

  .nav-dropdown:not(.active) > .nav-link::after {
    transform: rotate(0deg);
  }
}

.dropdown-content .nav-link {
  padding: 12px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.9rem;
}

.dropdown-content .nav-link:last-child {
  border-bottom: none;
  border-radius: 0 0 8px 8px;
}

.dropdown-content .nav-link:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #667eea;
}

.nav-dropdown > .nav-link::after {
  content: " ▼";
  font-size: 0.8rem;
  margin-left: 5px;
  transition: transform 0.3s;
}

/* Mobile navigation */
@media (max-width: 768px) {
  .nav-toggle {
    display: block;
    z-index: 1001;
    position: relative;
  }

  .nav-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding-top: 80px;
    box-shadow: none;
    transform: translateX(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    backdrop-filter: blur(10px);
  }

  .nav-menu.active {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
  }

  .nav-item {
    margin: 10px 0;
    width: 90%;
    max-width: 300px;
  }

  .nav-link {
    padding: 20px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 1.2rem;
    font-weight: 500;
    text-align: center;
    border-radius: 12px;
    margin: 5px 0;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
  }

  .nav-link:hover,
  .nav-link.active {
    background: rgba(102, 126, 234, 0.8);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
  }

  .nav-link:last-child {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  /* Mobile dropdown styles */
  .nav-dropdown .dropdown-content {
    position: static;
    display: none;
    background: rgba(52, 73, 94, 0.8);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    margin-top: 10px;
    backdrop-filter: blur(10px);
    overflow: hidden;
  }

  .nav-dropdown.active .dropdown-content {
    display: block;
    animation: slideDown 0.3s ease;
  }

  @keyframes slideDown {
    from {
      opacity: 0;
      max-height: 0;
      transform: translateY(-10px);
    }
    to {
      opacity: 1;
      max-height: 300px;
      transform: translateY(0);
    }
  }

  .nav-dropdown > .nav-link {
    cursor: pointer;
    position: relative;
  }

  .nav-dropdown > .nav-link::after {
    transition: transform 0.3s ease;
  }

  .nav-dropdown.active > .nav-link::after {
    transform: rotate(180deg);
  }

  .dropdown-content .nav-link {
    padding: 15px 25px;
    font-size: 1rem;
    background: transparent;
    margin: 0;
    border-radius: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  }

  .dropdown-content .nav-link:last-child {
    border-bottom: none;
  }

  .dropdown-content .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
  }

  /* Navigation overlay effect */
  .nav-menu::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: -1;
  }

  /* Close button enhancement */
  .nav-toggle span {
    transition: all 0.3s ease;
  }

  .nav-menu.active ~ .nav-wrapper .nav-toggle span {
    transform: rotate(90deg);
  }
}

/* Main container */
.container {
  max-width: 1200px;
  margin: 20px auto;
  background: white;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

/* Header */
.header {
  background: #34495e;
  color: white;
  padding: 30px;
  text-align: center;
}

.header h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

.header p {
  font-size: 1.1rem;
  opacity: 0.9;
}

/* Content */
.content {
  padding: 40px;
}

.demo-section {
  margin-bottom: 40px;
}

.demo-section h2 {
  color: #2c3e50;
  margin-bottom: 20px;
  font-size: 1.8rem;
}

.demo-section h3 {
  color: #546e7a;
  margin: 20px 0 10px;
  font-size: 1.3rem;
}

/* Code blocks */
.code-block {
  background: #f4f4f4;
  border: 1px solid #ddd;
  border-radius: 5px;
  padding: 20px;
  margin: 15px 0;
  font-family: "Courier New", monospace;
  overflow-x: auto;
}

.code-block pre {
  margin: 0;
  white-space: pre-wrap;
}

/* Iframe containers */
.iframe-container {
  margin: 20px 0;
  border: 2px solid #667eea;
  border-radius: 10px;
  padding: 0;
  background: #f9f9f9;
  height: calc(100vh - 400px);
  min-height: 600px;
}

.iframe-basic {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.iframe-responsive {
  position: relative;
  width: 100%;
  padding-bottom: 75%; /* 4:3 aspect ratio */
  overflow: hidden;
  border-radius: 8px;
  min-height: 450px; /* Ensure minimum height for very small screens */
}

.iframe-responsive iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 8px;
}

/* Mobile adjustments for iframe responsive */
@media (max-width: 768px) {
  .iframe-responsive {
    padding-bottom: 85%; /* Slightly taller aspect ratio for mobile */
    min-height: 500px;
  }
}

@media (max-width: 480px) {
  .iframe-responsive {
    padding-bottom: 100%; /* Square aspect ratio for very small screens */
    min-height: 400px;
  }
}

/* Floating widget */
.floating-widget {
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 1000;
}

.floating-button {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: #667eea;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
  transition: transform 0.3s;
}

.floating-button:hover {
  transform: scale(1.1);
}

.floating-iframe-container {
  position: absolute;
  bottom: 70px;
  right: 0;
  width: 450px;
  height: 650px;
  background: white;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  display: none;
  overflow: hidden;
}

.floating-iframe-container.active {
  display: block;
}

.floating-iframe-container iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Info boxes */
.info-box {
  background: #e3f2fd;
  border-left: 4px solid #2196f3;
  padding: 15px;
  margin: 20px 0;
}

.warning-box {
  background: #fff3e0;
  border-left: 4px solid #ff9800;
  padding: 15px;
  margin: 20px 0;
}

.success-box {
  background: #e8f5e9;
  border-left: 4px solid #4caf50;
  padding: 15px;
  margin: 20px 0;
}

/* Buttons */
.button-group {
  display: flex;
  gap: 10px;
  margin: 20px 0;
  flex-wrap: wrap;
}

.btn {
  padding: 10px 20px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.3s;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn:hover {
  background: #5a67d8;
}

.btn-secondary {
  background: #6c757d;
}

.btn-secondary:hover {
  background: #5a6268;
}

/* Status indicators */
.status-indicator {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 5px;
}

.status-indicator.online {
  background: #4caf50;
  animation: pulse 2s infinite;
}

.status-indicator.offline {
  background: #f44336;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(76, 175, 80, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
  }
}

/* Metrics */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin: 20px 0;
}

.metric-card {
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.metric-card h4 {
  color: #546e7a;
  margin-bottom: 10px;
}

.metric-card .value {
  font-size: 2rem;
  color: #667eea;
  font-weight: bold;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  body {
    padding: 0;
  }

  .container {
    margin: 0;
    border-radius: 0;
  }

  .header {
    padding: 20px;
  }

  .header h1 {
    font-size: 2rem;
  }

  .content {
    padding: 20px;
  }

  .floating-iframe-container {
    width: 90vw;
    height: 80vh;
    right: 5vw;
    bottom: 80px;
  }

  .iframe-container {
    height: 70vh;
    min-height: 400px;
  }

  .iframe-responsive {
    height: 70vh;
    min-height: 400px;
  }

  .button-group {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

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

@media (max-width: 480px) {
  .header h1 {
    font-size: 1.5rem;
  }

  .demo-section h2 {
    font-size: 1.5rem;
  }

  .demo-section h3 {
    font-size: 1.2rem;
  }

  .content {
    padding: 15px;
  }

  .floating-button {
    width: 50px;
    height: 50px;
    font-size: 20px;
  }

  .floating-widget {
    bottom: 20px;
    right: 20px;
  }
}