/**
 * Camera Test - GreenGetWare Theme
 */

:root {
  --primary: #39d353;
  --primary-dark: #176f3c;
  --primary-hover: #2fb344;
  --primary-light: rgba(57, 211, 83, 0.15);
  --primary-gradient: linear-gradient(135deg, #39d353 0%, #176f3c 100%);
  --accent: #00c9ff;
  --secondary: #64748b;
  --success: #39d353;
  --warning: #f59e0b;
  --danger: #ef4444;
  
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-tertiary: #252540;
  --bg-card: rgba(26, 26, 46, 0.9);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border-color: rgba(255, 255, 255, 0.08);
  
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 60px rgba(57, 211, 83, 0.2);
  
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 400ms cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.9);
  --text-primary: #1a1a2e;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border-color: rgba(0, 0, 0, 0.08);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.12);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.text-gradient {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Header */
.app-header {
  background: var(--bg-card);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--border-color);
  padding: var(--space-md) 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.logo i {
  color: var(--primary);
  font-size: 1.75rem;
}

.brand-badge {
  font-size: 0.6875rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.5px;
}

.header-actions {
  display: flex;
  gap: var(--space-sm);
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--bg-tertiary);
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.btn-home {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--primary-gradient);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: 0 4px 15px rgba(57, 211, 83, 0.3);
}

.btn-home:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(57, 211, 83, 0.4);
  color: white;
}

.btn-home span {
  display: none;
}

@media (min-width: 768px) {
  .btn-home span {
    display: inline;
  }
}

/* Main Content */
.main-content {
  padding: var(--space-xl) 0;
}

/* Hero Section */
.hero-section {
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.hero-icon {
  width: 80px;
  height: 80px;
  background: var(--primary-gradient);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-lg);
  box-shadow: var(--shadow-glow);
}

.hero-icon i {
  font-size: 2.5rem;
  color: white;
}

.hero-section h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: var(--space-sm);
}

.hero-section p {
  color: var(--text-secondary);
  font-size: 1.125rem;
  max-width: 600px;
  margin: 0 auto;
}

/* Camera Layout */
.camera-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: var(--space-xl);
  align-items: start;
}

@media (max-width: 1024px) {
  .camera-layout {
    grid-template-columns: 1fr;
  }
}

/* Camera Section */
.camera-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.camera-container {
  position: relative;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 16/9;
  border: 2px solid var(--border-color);
}

.camera-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  gap: var(--space-md);
}

.camera-placeholder i {
  font-size: 4rem;
  opacity: 0.5;
}

.camera-placeholder h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.camera-placeholder p {
  font-size: 0.875rem;
}

#cameraPreview {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: none;
}

#cameraPreview.active {
  display: block;
}

#cameraPreview.mirrored {
  transform: scaleX(-1);
}

/* Camera Overlay */
.camera-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.overlay-grid {
  position: absolute;
  inset: 0;
  display: none;
  background: 
    linear-gradient(rgba(57, 211, 83, 0.3) 1px, transparent 1px),
    linear-gradient(90deg, rgba(57, 211, 83, 0.3) 1px, transparent 1px);
  background-size: 33.33% 33.33%;
}

.overlay-grid.active {
  display: block;
}

.overlay-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  display: none;
}

.overlay-center.active {
  display: block;
}

.overlay-center::before,
.overlay-center::after {
  content: '';
  position: absolute;
  background: var(--primary);
}

.overlay-center::before {
  width: 2px;
  height: 100%;
  left: 50%;
  transform: translateX(-50%);
}

.overlay-center::after {
  width: 100%;
  height: 2px;
  top: 50%;
  transform: translateY(-50%);
}

/* Recording Indicator */
.recording-indicator {
  position: absolute;
  top: var(--space-md);
  left: var(--space-md);
  display: none;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: rgba(239, 68, 68, 0.9);
  border-radius: var(--radius-full);
  color: white;
  font-weight: 600;
  font-size: 0.875rem;
}

.recording-indicator.active {
  display: flex;
}

.rec-dot {
  width: 10px;
  height: 10px;
  background: white;
  border-radius: 50%;
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Zoom Indicator */
.zoom-indicator {
  position: absolute;
  bottom: var(--space-md);
  right: var(--space-md);
  padding: var(--space-xs) var(--space-sm);
  background: rgba(0, 0, 0, 0.6);
  border-radius: var(--radius-sm);
  color: white;
  font-size: 0.875rem;
  font-weight: 600;
  display: none;
}

.zoom-indicator.active {
  display: block;
}

/* Camera Controls */
.camera-controls {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
  flex-wrap: wrap;
}

.ctrl-btn {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.ctrl-btn:hover:not(:disabled) {
  background: var(--bg-secondary);
  border-color: var(--primary);
}

.ctrl-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ctrl-btn.primary {
  background: var(--primary-gradient);
  border-color: transparent;
  color: white;
}

.ctrl-btn.primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(57, 211, 83, 0.4);
}

.ctrl-btn.recording {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
  animation: pulse 1s infinite;
}

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

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

/* Quick Tools */
.quick-tools {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
}

.tool-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.tool-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

/* Info Panel */
.info-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.panel-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.panel-card .card-header {
  padding: var(--space-md);
  border-bottom: 1px solid var(--border-color);
}

.panel-card .card-header h3 {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.panel-card .card-header h3 i {
  color: var(--primary);
}

.panel-card .card-body {
  padding: var(--space-md);
}

/* Form Elements */
.form-select {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.875rem;
  margin-bottom: var(--space-sm);
}

.btn-refresh {
  width: 100%;
  padding: var(--space-sm);
  background: transparent;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

/* Resolution Grid */
.resolution-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-sm);
}

.res-btn {
  padding: var(--space-sm);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.res-btn.active {
  background: var(--primary-gradient);
  border-color: transparent;
  color: white;
}

/* Info Grid */
.info-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-xs) 0;
}

.info-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.info-value {
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

.status-dot.offline {
  background: var(--text-muted);
}

/* Adjustments */
.adjustment-item {
  margin-bottom: var(--space-md);
}

.adjustment-item label {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-xs);
}

.adjustment-item .form-range {
  width: calc(100% - 50px);
  display: inline-block;
  vertical-align: middle;
}

.range-value {
  display: inline-block;
  width: 45px;
  text-align: right;
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 600;
}

.form-range {
  -webkit-appearance: none;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  cursor: pointer;
}

.form-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
}

.btn-reset {
  width: 100%;
  padding: var(--space-sm);
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-top: var(--space-sm);
}

.btn-reset:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* Gallery Section */
.gallery-section {
  margin-top: var(--space-2xl);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
}

.section-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.section-header h2 i {
  color: var(--primary);
}

.gallery-actions {
  display: flex;
  gap: var(--space-sm);
}

.btn-action {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.btn-action.danger:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-md);
}

.gallery-item {
  position: relative;
  aspect-ratio: 16/9;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-secondary);
}

.gallery-item img,
.gallery-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-item .item-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 50%, rgba(0,0,0,0.8));
  opacity: 0;
  transition: opacity var(--transition-fast);
  display: flex;
  align-items: flex-end;
  padding: var(--space-sm);
}

.gallery-item:hover .item-overlay {
  opacity: 1;
}

.item-actions {
  display: flex;
  gap: var(--space-xs);
  width: 100%;
}

.item-actions button {
  flex: 1;
  padding: var(--space-xs);
  background: rgba(255,255,255,0.2);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.item-actions button:hover {
  background: var(--primary);
}

/* Features Section */
.features-section {
  margin-top: var(--space-2xl);
  padding-top: var(--space-2xl);
  border-top: 1px solid var(--border-color);
}

.features-section h2 {
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: var(--space-xl);
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-lg);
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  text-align: center;
  transition: all var(--transition-normal);
}

.feature-card:hover {
  transform: translateY(-5px);
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

.feature-icon {
  width: 60px;
  height: 60px;
  background: var(--primary-light);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-md);
}

.feature-icon i {
  font-size: 1.75rem;
  color: var(--primary);
}

.feature-card h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.feature-card p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Footer */
.app-footer {
  padding: var(--space-xl) 0;
  text-align: center;
  border-top: 1px solid var(--border-color);
  margin-top: var(--space-2xl);
}

.app-footer p {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-lg);
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.modal-header h3 i {
  color: var(--primary);
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--space-xs);
}

.btn-close-modal:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: var(--space-lg);
}

.modal-body img {
  width: 100%;
  border-radius: var(--radius-md);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border-color);
}

.btn-secondary {
  padding: var(--space-sm) var(--space-lg);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.btn-primary {
  padding: var(--space-sm) var(--space-lg);
  background: var(--primary-gradient);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(57, 211, 83, 0.4);
}

/* Beautify Presets */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.preset-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 4px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.7rem;
  color: var(--text-secondary);
}
.preset-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.preset-card.active { border-color: var(--primary); background: rgba(57, 211, 83, 0.08); color: var(--primary); }

.preset-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  color: white;
  font-size: 0.875rem;
}

/* Photo Frames */
.frame-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.frame-btn {
  padding: 8px 4px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.2s;
}
.frame-btn:hover { border-color: var(--primary); }
.frame-btn.active { border-color: var(--primary); background: rgba(57, 211, 83, 0.08); color: var(--primary); }

/* Frame Effects on Camera */
.camera-container.frame-rounded { border-radius: 20px; overflow: hidden; }
.camera-container.frame-circle { border-radius: 50%; overflow: hidden; }
.camera-container.frame-border { border: 4px solid var(--primary); }
.camera-container.frame-shadow { box-shadow: 0 0 40px rgba(57, 211, 83, 0.3); }
.camera-container.frame-polaroid { padding: 10px 10px 40px; background: white; border-radius: 4px; box-shadow: 0 4px 20px rgba(0,0,0,0.2); }

/* Responsive */
@media (max-width: 768px) {
  .hero-section h1 {
    font-size: 1.75rem;
  }
  
  .camera-controls {
    flex-direction: column;
  }
  
  .ctrl-btn {
    width: 100%;
    justify-content: center;
  }
  
  .features-grid {
    grid-template-columns: 1fr;
  }
}
