/* CineAsset Hub - Global Header, Navigation, and Cinema Console Layout
   Cinema Palace & Precision Camera Instrumentation Theme
*/
@import url('tokens.css');
@import url('components.css');

/* Base Reset & Document Setup */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: var(--hub-bg-base);
  color: var(--hub-text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--hub-transition-smooth), color var(--hub-transition-smooth);
}

/* ==========================================================================
   Global Hub Header & Navigation
   ========================================================================== */
.hub-header {
  height: 62px;
  background: var(--hub-bg-glass);
  backdrop-filter: var(--hub-blur-md);
  -webkit-backdrop-filter: var(--hub-blur-md);
  border-bottom: 1px solid var(--hub-border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 1000;
  width: 100%;
  transition: background var(--hub-transition-smooth), border-color var(--hub-transition-smooth);
}

.hub-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex-shrink: 0;
}

.hub-brand-logo {
  width: 34px;
  height: 34px;
  background: var(--hub-accent-gradient);
  border-radius: var(--hub-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(229, 169, 60, 0.4);
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.hub-brand-logo svg {
  width: 19px;
  height: 19px;
  color: #0b0a10;
}

[data-theme="light"] .hub-brand-logo svg {
  color: #f8f5ee;
}

.hub-brand-text {
  display: flex;
  flex-direction: column;
}

.hub-brand-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--hub-text-primary);
  line-height: 1.1;
}

.hub-brand-badge {
  font-family: var(--font-telemetry);
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--hub-accent-primary);
  letter-spacing: 0.1em;
}

/* Tool Switcher Tabs */
.hub-nav-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--hub-bg-input);
  border: 1px solid var(--hub-border-subtle);
  border-radius: var(--hub-radius-full);
  padding: 4px;
}

.hub-nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--hub-radius-full);
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--hub-text-secondary);
  transition: all var(--hub-transition-fast);
  white-space: nowrap;
}

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

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

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

.hub-nav-link svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.nav-label-short {
  display: none;
}

/* Header Right Actions */
.hub-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* ==========================================================================
   Mobile Tab Switcher (Controls vs Live Preview)
   ========================================================================== */
.mobile-view-tabs {
  display: none;
  background: var(--hub-bg-surface);
  border-bottom: 1px solid var(--hub-border-subtle);
  padding: 8px 16px;
  position: sticky;
  top: 62px;
  z-index: 99;
}

.mobile-view-tabs .segmented-control {
  width: 100%;
}

.mobile-view-tabs .segmented-btn {
  padding: 10px 14px;
  font-size: 0.85rem;
}

/* Floating Preview Button for Mobile */
.mobile-floating-preview-btn {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--hub-accent-gradient);
  color: #0b0a10;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 12px 18px;
  border-radius: var(--hub-radius-full);
  box-shadow: 0 6px 20px rgba(229, 169, 60, 0.5);
  border: none;
  cursor: pointer;
  z-index: 500;
  align-items: center;
  gap: 8px;
}

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

/* ==========================================================================
   Two-Column App Layout (Sidebar Editor + Live Canvas)
   ========================================================================== */
.app-layout {
  display: grid;
  grid-template-columns: 440px 1fr;
  height: calc(100vh - 62px);
  overflow: hidden;
  width: 100%;
}

.sidebar-panel {
  background: var(--hub-bg-glass);
  backdrop-filter: var(--hub-blur-md);
  border-right: 1px solid var(--hub-border-subtle);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.sidebar-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--hub-border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--hub-bg-surface);
}

.sidebar-title-group h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--hub-text-primary);
}

.sidebar-title-group p {
  font-size: 0.775rem;
  color: var(--hub-text-secondary);
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* Main Canvas Preview Area */
.canvas-area {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: var(--hub-bg-canvas);
  position: relative;
}

.canvas-toolbar {
  min-height: 52px;
  padding: 8px 20px;
  background: var(--hub-bg-surface);
  border-bottom: 1px solid var(--hub-border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
  gap: 12px;
}

.canvas-status {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-telemetry);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--hub-text-secondary);
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--hub-accent-success);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.canvas-viewport {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  position: relative;
}

/* Viewport HUD Optical Markings */
.viewport-telemetry-hud {
  position: absolute;
  top: 14px;
  left: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
  z-index: 20;
}

.viewport-telemetry-hud span {
  font-family: var(--font-telemetry);
  font-size: 0.7rem;
  color: var(--hub-text-muted);
  letter-spacing: 0.08em;
}

/* ==========================================================================
   Responsive Rules for Tablets and Mobile
   ========================================================================== */
@media (max-width: 1024px) {
  .app-layout {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - 62px);
    overflow: visible;
  }

  .mobile-view-tabs {
    display: block;
  }

  /* Show Controls Mode (default on mobile) */
  .mobile-mode-controls .sidebar-panel {
    display: flex;
    height: auto;
    border-right: none;
  }
  .mobile-mode-controls .canvas-area {
    display: none;
  }
  .mobile-mode-controls .mobile-floating-preview-btn {
    display: flex;
  }

  /* Show Preview Mode */
  .mobile-mode-preview .sidebar-panel {
    display: none;
  }
  .mobile-mode-preview .canvas-area {
    display: flex;
    min-height: calc(100vh - 120px);
  }
  .mobile-mode-preview .mobile-floating-preview-btn {
    display: none;
  }

  .sidebar-panel {
    height: auto;
    border-right: none;
  }

  .canvas-area {
    min-height: 480px;
  }
}

@media (max-width: 768px) {
  .hub-header {
    padding: 0 12px;
    height: 56px;
  }

  .hub-brand-badge {
    display: none;
  }

  .hub-brand-title {
    font-size: 0.95rem;
  }

  .hub-nav-tools {
    gap: 2px;
    padding: 2px;
  }

  .hub-nav-link {
    padding: 6px 10px;
    font-size: 0.725rem;
    gap: 4px;
  }

  .nav-label-full {
    display: none;
  }

  .nav-label-short {
    display: inline;
  }

  .theme-toggle-label {
    display: none;
  }

  .sidebar-content {
    padding: 14px 12px;
  }

  .canvas-toolbar {
    flex-direction: column;
    align-items: stretch;
    padding: 10px 12px;
    gap: 8px;
    height: auto;
  }

  .canvas-status {
    justify-content: space-between;
    width: 100%;
  }

  .canvas-toolbar > div:last-child {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 6px;
  }

  .canvas-toolbar select.form-control {
    flex: 1;
    min-width: 0;
    font-size: 0.75rem;
    padding: 8px 24px 8px 8px;
  }

  .canvas-toolbar .btn {
    flex: 1;
    padding: 8px 10px;
    font-size: 0.775rem;
    min-width: 0;
  }

  .canvas-viewport {
    padding: 16px 8px;
  }

  .capture-target-wrapper {
    max-width: 100%;
    overflow-x: auto;
  }

  .yt-comment-wrapper,
  .tw-comment-wrapper,
  .tt-comment-wrapper,
  .ig-comment-wrapper,
  .fb-comment-wrapper,
  .reddit-comment-wrapper,
  .th-comment-wrapper {
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .form-control,
  input[type="text"],
  input[type="number"],
  select,
  textarea {
    font-size: 16px !important;
  }

  .platform-btn {
    min-height: 44px;
    padding: 8px 4px;
  }

  .btn {
    min-height: 40px;
  }
}

@media (max-width: 480px) {
  .platform-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .sidebar-header {
    padding: 14px 12px;
  }

  .sidebar-title-group h2 {
    font-size: 1rem;
  }
}
