/* Turquoise and light pink color scheme */
:root {
  --primary-turquoise: #06B6D4;
  --dark-turquoise: #0891B2;
  --light-turquoise: #67E8F9;
  --light-pink: #FBCFE8;
  --medium-pink: #F9A8D4;
  --accent-pink: #EC4899;
  --dark-gray: #1F2937;
  --medium-gray: #6B7280;
  --light-gray: #F3F4F6;
  --white: #FFFFFF;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, 
    "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  background: var(--light-gray);
  color: var(--dark-gray);
  overflow-x: hidden;
}

/* iPhone container - 390px standard viewport */
.app-container {
  max-width: 390px;
  margin: 0 auto;
  min-height: 100vh;
  background: linear-gradient(180deg, #F8F8F8 0%, #FFFFFF 100%);
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 32px rgba(0, 0, 0, 0.12);
}

/* Header with gradient */
.app-header {
  background: linear-gradient(135deg, var(--primary-turquoise) 0%, var(--dark-turquoise) 100%);
  color: var(--white);
  padding: 24px 20px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.app-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 4px;
  letter-spacing: 0.02em;
}

.app-subtitle {
  font-size: 0.85rem;
  opacity: 0.9;
  margin: 0;
}

/* Main scrollable content */
.app-main {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Section styling */
.section-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--dark-gray);
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.hint {
  font-size: 0.8rem;
  color: var(--medium-gray);
  margin: -6px 0 10px;
}

/* Card containers */
.card {
  background: var(--white);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(0, 0, 0, 0.06);
}

/* Camera section */
.camera-section {
  background: var(--dark-gray);
  border-radius: 14px;
  padding: 14px;
  box-shadow: var(--shadow-lg);
}

.camera-section .section-title {
  color: var(--white);
  margin-bottom: 8px;
}

.camera-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  overflow: hidden;
  background: #1a1a1a;
}

.camera-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-overlay {
  position: absolute;
  top: 10px;
  right: 10px;
}

.status-badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  backdrop-filter: blur(8px);
}

.status-live {
  background: rgba(236, 72, 153, 0.9);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Form elements */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--medium-gray);
}

.form-select {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #E0E0E0;
  border-radius: 10px;
  font-size: 0.9rem;
  background: var(--white);
  color: var(--dark-gray);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

.form-select:focus {
  outline: none;
  border-color: var(--primary-turquoise);
}

/* Camera controls */
.camera-controls {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.btn {
  flex: 1;
  padding: 12px 16px;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--primary-turquoise);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3);
}

.btn-secondary {
  background: var(--medium-gray);
  color: var(--white);
}

.btn-action {
  width: 100%;
  background: linear-gradient(135deg, var(--primary-turquoise) 0%, var(--dark-turquoise) 100%);
  color: var(--white);
  padding: 16px;
  font-size: 1rem;
  box-shadow: 0 6px 18px rgba(6, 182, 212, 0.4);
}

/* AI section */
.ai-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #F0F0F0;
}

.ai-status:last-child {
  border-bottom: none;
}

.ai-label {
  font-size: 0.85rem;
  color: var(--medium-gray);
}

.ai-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--dark-gray);
}

/* Category grid */
.category-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.category-item {
  background: linear-gradient(135deg, #F8F8F8 0%, #FFFFFF 100%);
  border: 2px solid #E0E0E0;
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  cursor: pointer;
}

.category-item.active {
  border-color: var(--primary-turquoise);
  background: linear-gradient(135deg, var(--light-pink) 0%, #FFF5F9 100%);
}

.category-icon {
  font-size: 2rem;
}

.category-name {
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  color: var(--dark-gray);
}

.category-toggle {
  margin-top: auto;
}

.category-toggle input[type="checkbox"] {
  display: none;
}

.toggle-label {
  display: block;
  width: 40px;
  height: 22px;
  background: #CCC;
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s;
}

.toggle-label::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.category-toggle input:checked + .toggle-label {
  background: var(--primary-turquoise);
}

.category-toggle input:checked + .toggle-label::after {
  transform: translateX(18px);
}

/* Control section */
.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #F0F0F0;
}

.control-row:last-of-type {
  border-bottom: none;
  margin-bottom: 16px;
}

.control-label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--medium-gray);
  flex: 1;
}

.control-value {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary-turquoise);
  min-width: 60px;
  text-align: right;
}

/* Switch toggle */
.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  inset: 0;
  background: #CCC;
  border-radius: 999px;
  transition: 0.3s;
  cursor: pointer;
}

.switch-slider::before {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.switch input:checked + .switch-slider {
  background: var(--primary-turquoise);
}

.switch input:checked + .switch-slider::before {
  transform: translateX(22px);
}

/* Stats grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.stat-box {
  background: linear-gradient(135deg, var(--light-pink) 0%, #FFF5F9 100%);
  border: 1px solid var(--medium-pink);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary-turquoise);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--medium-gray);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Footer */
.app-footer {
  padding: 14px 20px;
  text-align: center;
  font-size: 0.75rem;
  color: #999;
  background: var(--white);
  border-top: 1px solid #E0E0E0;
}

/* Responsive adjustments for smaller iPhones */
@media (max-width: 375px) {
  .app-header {
    padding: 20px 16px;
  }

  .app-title {
    font-size: 1.3rem;
  }

  .app-main {
    padding: 14px;
    gap: 14px;
  }

  .card {
    padding: 14px;
  }
}
