/* CineAsset Hub - Shared UI Component Library
   Cinema Theater, Vintage Film & Camera Telemetry Design System
*/
@import url('tokens.css');

/* ==========================================================================
   Buttons & Interactive Actions
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  padding: 10px 18px;
  border-radius: var(--hub-radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--hub-transition-smooth);
  user-select: none;
  white-space: nowrap;
  text-decoration: none;
}

.spin {
  animation: hubSpin 0.9s linear infinite;
}

@keyframes hubSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--hub-accent-primary);
  color: #0b0a10;
  font-weight: 700;
  border-color: rgba(255, 200, 87, 0.4);
  box-shadow: 0 4px 14px rgba(229, 169, 60, 0.35);
}

[data-theme="light"] .btn-primary {
  color: #f8f5ee;
  background: #1c1612;
  border-color: #b37b1b;
  box-shadow: 0 4px 12px rgba(28, 22, 18, 0.15);
}

.btn-primary:hover {
  background: var(--hub-accent-primary-hover);
  box-shadow: 0 6px 20px rgba(229, 169, 60, 0.55);
  transform: translateY(-1px);
}

[data-theme="light"] .btn-primary:hover {
  background: #95620f;
  color: #f8f5ee;
  box-shadow: 0 6px 16px rgba(149, 98, 15, 0.3);
}

.btn-gradient {
  background: var(--hub-accent-gradient);
  color: #0b0a10;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(229, 169, 60, 0.38);
}

[data-theme="light"] .btn-gradient {
  color: #f8f5ee;
}

.btn-gradient:hover {
  box-shadow: 0 6px 24px rgba(229, 169, 60, 0.6);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--hub-bg-surface);
  border-color: var(--hub-border-subtle);
  color: var(--hub-text-primary);
}

.btn-secondary:hover {
  background: var(--hub-bg-surface-hover);
  border-color: var(--hub-accent-primary);
  color: var(--hub-accent-primary);
}

.btn-cta {
  background: var(--hub-accent-tally);
  color: #ffffff;
  font-weight: 700;
  box-shadow: var(--hub-shadow-glow-rose);
}

.btn-cta:hover {
  background: #b71c1c;
  box-shadow: 0 6px 22px rgba(229, 57, 53, 0.55);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.775rem;
  border-radius: var(--hub-radius-sm);
}

.btn-icon {
  padding: 8px;
  border-radius: var(--hub-radius-sm);
  color: var(--hub-text-secondary);
  background: transparent;
  border: 1px solid transparent;
}

.btn-icon:hover {
  background: var(--hub-bg-surface-hover);
  color: var(--hub-accent-primary);
  border-color: var(--hub-border-subtle);
}

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ==========================================================================
   Cinema & Camera Telemetry Elements
   ========================================================================== */

/* 35mm Film Sprocket Ribbon */
.film-sprocket-ribbon {
  width: 100%;
  height: 22px;
  background-color: var(--film-sprocket-bg);
  border-top: 1px solid var(--film-sprocket-border);
  border-bottom: 1px solid var(--film-sprocket-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  overflow: hidden;
  user-select: none;
  position: relative;
}

.sprocket-holes-strip {
  width: 100%;
  height: 10px;
  background: repeating-linear-gradient(
    90deg,
    transparent 0px,
    transparent 14px,
    var(--film-sprocket-border) 14px,
    var(--film-sprocket-border) 15px,
    var(--film-sprocket-hole) 15px,
    var(--film-sprocket-hole) 27px,
    var(--film-sprocket-border) 27px,
    var(--film-sprocket-border) 28px,
    transparent 28px,
    transparent 40px
  );
  opacity: 0.85;
}

/* Camera REC Tally Badge */
.rec-tally-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  background: rgba(229, 57, 53, 0.12);
  border: 1px solid var(--hub-accent-tally);
  border-radius: var(--hub-radius-sm);
  font-family: var(--font-telemetry);
  font-size: 0.725rem;
  font-weight: 700;
  color: var(--hub-accent-tally);
  letter-spacing: 0.08em;
  box-shadow: 0 0 10px var(--hub-accent-tally-glow);
}

.rec-tally-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--hub-accent-tally);
  box-shadow: 0 0 6px var(--hub-accent-tally);
  animation: recBlink 1.4s infinite ease-in-out;
}

@keyframes recBlink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.3; transform: scale(0.8); }
}

/* Viewfinder Corner Framing Marks [ ] */
.viewfinder-box {
  position: relative;
}

.viewfinder-corner {
  position: absolute;
  width: 18px;
  height: 18px;
  border-color: var(--hub-accent-primary);
  border-style: solid;
  pointer-events: none;
  z-index: 10;
  opacity: 0.85;
  transition: all var(--hub-transition-smooth);
}

.corner-tl { top: 8px; left: 8px; border-width: 2px 0 0 2px; }
.corner-tr { top: 8px; right: 8px; border-width: 2px 2px 0 0; }
.corner-bl { bottom: 8px; left: 8px; border-width: 0 0 2px 2px; }
.corner-br { bottom: 8px; right: 8px; border-width: 0 2px 2px 0; }

.viewfinder-box:hover .viewfinder-corner {
  border-color: var(--hub-accent-secondary);
  opacity: 1;
}

/* Telemetry Badge / Optical Chip */
.telemetry-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-telemetry);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--hub-radius-sm);
  background: rgba(229, 169, 60, 0.08);
  color: var(--hub-accent-primary);
  border: 1px solid var(--hub-border-subtle);
  letter-spacing: 0.06em;
}

[data-theme="light"] .telemetry-chip {
  background: var(--hub-bg-surface-hover);
  color: var(--hub-text-primary);
  border-color: var(--hub-border-medium);
}

/* Cinema Theme Toggle Switch */
.cinema-theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--hub-radius-full);
  background: var(--hub-bg-surface);
  border: 1px solid var(--hub-border-subtle);
  color: var(--hub-text-primary);
  cursor: pointer;
  font-family: var(--font-telemetry);
  font-size: 0.725rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  transition: all var(--hub-transition-fast);
  user-select: none;
}

.cinema-theme-toggle:hover {
  border-color: var(--hub-accent-primary);
  color: var(--hub-accent-primary);
  box-shadow: var(--hub-shadow-glow);
}

.cinema-theme-toggle svg {
  width: 14px;
  height: 14px;
  color: var(--hub-accent-primary);
}

/* Clapperboard Take Badge */
.clapper-take-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  font-family: var(--font-telemetry);
  font-size: 0.675rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--hub-text-primary);
  background: var(--hub-bg-surface);
  border: 1px solid var(--hub-border-subtle);
  border-radius: var(--hub-radius-sm);
}

/* ==========================================================================
   Form Controls, Inputs, and Selects
   ========================================================================== */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--hub-text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-control {
  width: 100%;
  background: var(--hub-bg-input);
  border: 1px solid var(--hub-border-subtle);
  border-radius: var(--hub-radius-md);
  padding: 10px 14px;
  color: var(--hub-text-primary);
  font-family: var(--font-body);
  font-size: 0.875rem;
  outline: none;
  transition: all var(--hub-transition-fast);
}

.form-control:hover {
  border-color: var(--hub-border-active);
}

.form-control:focus {
  border-color: var(--hub-accent-primary);
  background: var(--hub-bg-surface);
  box-shadow: 0 0 0 3px rgba(229, 169, 60, 0.2);
}

textarea.form-control {
  min-height: 80px;
  resize: vertical;
  line-height: 1.5;
}

select.form-control {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23e5a93c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

/* Range Sliders */
.slider-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.slider-group input[type="range"] {
  flex: 1;
  appearance: none;
  height: 6px;
  background: var(--hub-border-medium);
  border-radius: var(--hub-radius-full);
  outline: none;
  cursor: pointer;
}

.slider-group input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--hub-accent-primary);
  box-shadow: 0 0 8px rgba(229, 169, 60, 0.6);
  cursor: pointer;
  transition: transform var(--hub-transition-fast);
}

.slider-group input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.slider-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--hub-text-muted);
  min-width: 38px;
  text-align: right;
}

/* ==========================================================================
   Segmented Controls & Chips
   ========================================================================== */
.segmented-control {
  display: flex;
  background: var(--hub-bg-input);
  border: 1px solid var(--hub-border-subtle);
  border-radius: var(--hub-radius-md);
  padding: 3px;
  gap: 3px;
}

.segmented-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  font-family: var(--font-body);
  font-size: 0.775rem;
  font-weight: 600;
  color: var(--hub-text-secondary);
  background: transparent;
  border: none;
  border-radius: var(--hub-radius-sm);
  cursor: pointer;
  transition: all var(--hub-transition-fast);
}

.segmented-btn:hover {
  color: var(--hub-text-primary);
  background: var(--hub-bg-surface-hover);
}

.segmented-btn.active {
  background: var(--hub-accent-primary);
  color: #0b0a10;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(229, 169, 60, 0.4);
}

[data-theme="light"] .segmented-btn.active {
  background: #1c1612;
  color: #f8f5ee;
}

/* ==========================================================================
   Tactile Switch Toggles
   ========================================================================== */
.switch-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--hub-border-subtle);
}

.switch-group:last-child {
  border-bottom: none;
}

.switch-label-group {
  display: flex;
  flex-direction: column;
}

.switch-title {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--hub-text-primary);
}

.switch-subtitle {
  font-size: 0.725rem;
  color: var(--hub-text-muted);
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--hub-border-medium);
  border: 1px solid var(--hub-border-subtle);
  transition: 0.25s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: var(--hub-text-secondary);
  transition: 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

input:checked + .slider {
  background-color: var(--hub-accent-primary);
  border-color: transparent;
}

input:checked + .slider:before {
  transform: translateX(20px);
  background-color: #0b0a10;
}

[data-theme="light"] input:checked + .slider:before {
  background-color: #f8f5ee;
}

/* ==========================================================================
   Accordion / Collapsible Sidebar Sections
   ========================================================================== */
.accordion-item {
  border: 1px solid var(--hub-border-subtle);
  border-radius: var(--hub-radius-md);
  margin-bottom: 12px;
  background: var(--hub-bg-glass-card);
  overflow: hidden;
  transition: border-color var(--hub-transition-fast);
}

.accordion-item:hover {
  border-color: var(--hub-border-active);
}

.accordion-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  background: rgba(255, 255, 255, 0.02);
}

[data-theme="light"] .accordion-header {
  background: rgba(28, 22, 18, 0.02);
}

.accordion-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--hub-text-primary);
}

.accordion-icon {
  width: 18px;
  height: 18px;
  color: var(--hub-accent-primary);
}

.accordion-arrow {
  width: 16px;
  height: 16px;
  color: var(--hub-text-muted);
  transition: transform var(--hub-transition-smooth);
}

.accordion-item.open .accordion-arrow {
  transform: rotate(180deg);
}

.accordion-body {
  padding: 16px;
  display: none;
  border-top: 1px solid var(--hub-border-subtle);
}

.accordion-item.open .accordion-body {
  display: block;
}

/* ==========================================================================
   Platform Selector Grid
   ========================================================================== */
.platform-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.platform-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 6px;
  background: var(--hub-bg-surface);
  border: 1px solid var(--hub-border-subtle);
  border-radius: var(--hub-radius-md);
  cursor: pointer;
  transition: all var(--hub-transition-fast);
  color: var(--hub-text-secondary);
  user-select: none;
}

.platform-btn:hover {
  background: var(--hub-bg-surface-hover);
  border-color: var(--hub-border-active);
  color: var(--hub-text-primary);
}

.platform-btn.active {
  background: var(--hub-bg-surface-hover);
  border-color: var(--hub-accent-primary);
  color: var(--hub-text-primary);
  box-shadow: 0 0 12px rgba(229, 169, 60, 0.25);
}

.platform-btn svg {
  width: 20px;
  height: 20px;
}

.platform-label {
  font-family: var(--font-body);
  font-size: 0.725rem;
  font-weight: 500;
}

/* ==========================================================================
   Canvas Backdrop Modes & Transparency Checkers
   ========================================================================== */
.canvas-backdrop-checker {
  background-color: #100f17;
  background-image: 
    linear-gradient(45deg, #181622 25%, transparent 25%), 
    linear-gradient(-45deg, #181622 25%, transparent 25%), 
    linear-gradient(45deg, transparent 75%, #181622 75%), 
    linear-gradient(-45deg, transparent 75%, #181622 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

[data-theme="light"] .canvas-backdrop-checker {
  background-color: #f0ece3;
  background-image: 
    linear-gradient(45deg, #e3ded2 25%, transparent 25%), 
    linear-gradient(-45deg, #e3ded2 25%, transparent 25%), 
    linear-gradient(45deg, transparent 75%, #e3ded2 75%), 
    linear-gradient(-45deg, transparent 75%, #e3ded2 75%);
}

.canvas-backdrop-green {
  background-color: #00ff00 !important;
  background-image: none !important;
}

.canvas-backdrop-blue {
  background-color: #0000ff !important;
  background-image: none !important;
}

.canvas-backdrop-dark {
  background-color: #0b0a10 !important;
  background-image: radial-gradient(circle at center, #1a1724 0%, #0b0a10 100%) !important;
}

/* ==========================================================================
   Toast Notifications
   ========================================================================== */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 400px;
  background: var(--hub-bg-surface);
  backdrop-filter: blur(16px);
  border: 1px solid var(--hub-border-focus);
  border-radius: var(--hub-radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--hub-shadow-lg);
  transform: translateY(20px);
  opacity: 0;
  transition: all var(--hub-transition-smooth);
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast-success .toast-icon { color: var(--hub-accent-success); }
.toast-info .toast-icon { color: var(--hub-accent-primary); }
.toast-error .toast-icon { color: var(--hub-accent-rose); }

.toast-content {
  flex: 1;
}

.toast-title {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--hub-text-primary);
}

.toast-message {
  font-size: 0.775rem;
  color: var(--hub-text-secondary);
}
