.chat-input-container {
  width: 100%;
  max-width: 768px;
  padding: 0;
  margin-top: 30px;
  position: relative;
  z-index: 2;
}

.chat-input-wrapper {
  display: flex;
  gap: 12px;
  align-items: center;
  background: white;
  border: 2px solid #c0c0c0;
  border-radius: 32px;
  padding: 6px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.chat-input-wrapper:focus-within {
  border-color: #1a1a1a;
  box-shadow: 0 6px 30px rgba(0,0,0,0.15);
}

.chat-input-box { flex: 1; position: relative; }

.chat-input {
  width: 100%;
  border: none;
  outline: none;
  font-size: 16px;
  font-family: inherit;
  resize: none;
  max-height: 120px;
  min-height: 44px;
  line-height: 24px;
  padding: 10px 12px;
  background: transparent;
  color: #1a1a1a;
  overflow-y: hidden;
  overflow-x: hidden;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.chat-input::placeholder { 
  color: #999;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.generate-btn-chat {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #1a1a1a;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  color: white;
  font-size: 18px;
  padding: 0;
  flex-shrink: 0;
}

.generate-btn-chat:hover:not(:disabled) { background: #000; }
.generate-btn-chat:disabled {
  background: #e8e8e8;
  color: #aaa;
  cursor: not-allowed;
}

.upload-btn-chat {
  width: 44px;
  height: 44px;
  border-radius: 22px;
  background: #1a1a1a;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  color: white;
  flex-shrink: 0;
  position: relative;
  animation: pulse 2s ease-in-out infinite;
}

.upload-btn-chat:hover { background: #333; animation: none; }

.upload-btn-chat::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: -32px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a1a;
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.upload-btn-chat:hover::after {
  opacity: 1;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(26, 26, 26, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(26, 26, 26, 0); }
}

.settings-toggle-btn {
  display: none !important;
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: white;
  color: #1a1a1a;
  border: 1px solid #e0e0e0;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
  z-index: 998;
  transition: all 0.2s ease;
}

.settings-toggle-btn:active {
  transform: scale(0.92);
  box-shadow: 0 1px 6px rgba(0,0,0,0.2);
}

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  margin-right: 12px;
  order: -1;
  transition: all 0.3s ease;
}

.hamburger:hover { opacity: 0.7; }
.hamburger span {
  width: 26px;
  height: 3px;
  background: #000;
  border-radius: 2px;
  transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(10px, 10px); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(10px, -10px); }

.mobile-menu-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 999;
  backdrop-filter: blur(2px);
}

.mobile-menu-backdrop.active { display: block; }

.mobile-menu {
  display: none;
  position: fixed;
  top: 0;
  left: -100%;
  width: 85%;
  max-width: 350px;
  height: 100vh;
  background: white;
  flex-direction: column;
  z-index: 1000;
  overflow-y: auto;
  box-shadow: 2px 0 12px rgba(0,0,0,0.15);
}

.mobile-menu.active {
  display: flex;
  animation: slideInLeft 0.35s ease forwards;
}

.mobile-menu a,
.mobile-menu button,
.mobile-menu select {
  padding: 20px 28px;
  text-align: left;
  border: none;
  background: white;
  cursor: pointer;
  color: #1d1d1f;
  font-size: 1.25rem;
  font-weight: 400;
  border-bottom: 1px solid #f0f0f0;
  text-decoration: none;
  transition: all 0.2s ease;
  width: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
  letter-spacing: -0.02em;
  line-height: 1.4;
}

.mobile-menu a:active,
.mobile-menu button:active {
  background: #f8f8f8;
}

.mobile-menu > div:first-child {
  padding: 24px 28px !important;
  border-bottom: 1px solid #e8e8e8 !important;
}

.mobile-menu > div:first-child span {
  font-size: 1.35rem !important;
  font-weight: 600 !important;
  letter-spacing: -0.03em;
  color: #1d1d1f;
}

@keyframes slideInLeft {
  from { left: -100%; }
  to { left: 0; }
}

@media (max-width: 1024px) {
  .main-content { grid-template-columns: 1fr; height: auto; }
  .left-panel { 
    display: flex !important;
    padding: 20px 20px 100px 20px;
    background: #fafafa;
    border-right: none;
  }
  .left-panel::after {
    display: none;
  }
  .right-panel { display: none !important; }
  .settings-toggle-btn { display: flex !important; align-items: center !important; justify-content: center !important; }
  .chat-input-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e0e0e0;
    z-index: 998;
    margin-top: 0;
  }
  .chat-input-wrapper {
    max-width: 100%;
  }
  .hamburger { display: flex !important; }
  .header > div:last-child { display: none !important; }
  .header { padding: 12px 20px; }
  h1 { font-size: 1.3rem; }
}

@media (max-width: 1024px) {
  .results-section { padding: 20px; margin-right: 0; }
  
  .download-btn {
    position: static;
    width: 100%;
    margin-top: 10px;
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .header { padding: 10px 16px; min-height: 60px; }
  h1 { font-size: 1.1rem; }
  .results-section { padding: 16px; }
  
  .download-btn {
    position: static;
    width: 100%;
    margin-top: 10px;
    justify-content: center;
  }
  
  /* iOS Safari button fixes */
  .option-btn {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
    min-height: 44px; /* iOS minimum touch target */
  }
  
  .button-group {
    gap: 12px; /* Larger gaps for easier touch */
  }
  
  /* Ensure buttons are properly sized for touch */
  .btn, .generate-btn-chat, .upload-btn-chat {
    min-height: 44px;
    min-width: 44px;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
}
