/* ==========================================================================
   STOORSTÅLKA BÄLTESVERKSTAN – SINGLE PAGE KIOSK STYLING
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  /* Brand Colors */
  --st-red: #E62A32;
  --st-red-hover: #c91f26;
  --st-red-light: rgba(230, 42, 50, 0.08);
  --st-red-border: rgba(230, 42, 50, 0.25);
  
  --st-black: #121417;
  --st-dark: #1E2227;
  --st-gray-900: #1B1E22;
  --st-gray-800: #2B3037;
  --st-gray-600: #555D67;
  --st-gray-400: #8E98A5;
  --st-gray-200: #E3E7EE;
  --st-gray-100: #F3F5F8;
  --st-white: #FFFFFF;
  
  /* UI Surface & Background */
  --bg-app: #F5F7FA;
  --bg-card: #FFFFFF;
  --border-subtle: #E2E7ED;
  --border-card: #E5E9F0;
  
  /* Typography */
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  
  /* Shadows */
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-card: 0 8px 24px rgba(18, 20, 23, 0.05);
  --shadow-card-hover: 0 14px 32px rgba(230, 42, 50, 0.14);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.12);
  
  /* Dimensions & Kiosk Touch Targets */
  --header-height: 48px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --touch-min-target: 48px;
}

/* Reset & Kiosk Optimization */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-app);
  color: var(--st-black);
  font-family: var(--font-main);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

/* App Wrapper */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ==========================================================================
   HEADER
   ========================================================================== */
.app-header {
  height: var(--header-height);
  background: var(--st-white);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-logo-link {
  display: flex;
  align-items: center;
  text-decoration: none;
  cursor: pointer;
  flex-shrink: 0;
}

.brand-logo-img {
  height: 20px;
  width: auto;
  display: block;
}

.header-divider {
  width: 1px;
  height: 18px;
  background: var(--border-subtle);
  flex-shrink: 0;
}

.brand-title-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-subtitle {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--st-black);
  letter-spacing: -0.01em;
  line-height: 1;
  white-space: nowrap;
  transform: translateY(2.5px);
}

.brand-tagline {
  display: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.kiosk-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 0.84rem;
  font-weight: 700;
  border: 1px solid var(--border-subtle);
  background: var(--st-white);
  color: var(--st-black);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease-in-out;
}

.kiosk-btn:active {
  transform: scale(0.97);
  background: var(--st-gray-100);
}

.header-nav-steps {
  display: flex;
  align-items: center;
  gap: 6px;
}

.kiosk-btn:disabled {
  opacity: 0.3;
  pointer-events: none;
  cursor: not-allowed;
}

.kiosk-btn-primary {
  background: var(--st-red);
  color: var(--st-white);
  border-color: var(--st-red);
}

.kiosk-btn-primary:active {
  background: var(--st-red-hover);
}

/* ==========================================================================
   MAIN LAYOUT & VIEWS
   ========================================================================== */
.main-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ==========================================================================
   VIEW 1: OVERVIEW GRID (CENTERED SINGLE PAGE)
   ========================================================================== */
.overview-view {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 32px 24px 48px 24px;
  animation: fadeIn 0.25s ease-out;
}

.overview-inner {
  width: 100%;
  max-width: 1060px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}

.hero-header {
  text-align: center;
  max-width: 680px;
}

.hero-badge {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--st-red);
  background: var(--st-red-light);
  padding: 6px 14px;
  border-radius: 20px;
  margin-bottom: 12px;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--st-black);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 8px;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--st-gray-600);
  font-weight: 500;
}

/* 2x2 CENTERED GRID OF CARDS */
.videos-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.grid-card {
  background: var(--bg-card);
  border: 2px solid var(--border-card);
  border-radius: var(--radius-xl);
  padding: 26px 28px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  box-shadow: var(--shadow-card);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.grid-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 6px;
  height: 100%;
  background: var(--st-red);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.grid-card:hover, .grid-card:active {
  transform: translateY(-3px) scale(1.01);
  border-color: var(--st-red);
  box-shadow: var(--shadow-card-hover);
}

.grid-card:hover::before, .grid-card:active::before {
  opacity: 1;
}

.grid-card-top {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.grid-card-number {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--st-gray-100);
  color: var(--st-black);
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.grid-card:hover .grid-card-number, .grid-card:active .grid-card-number {
  background: var(--st-red);
  color: var(--st-white);
}

.grid-card-info {
  flex: 1;
}

.grid-card-title {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--st-black);
  margin-bottom: 6px;
  line-height: 1.3;
}

.grid-card-desc {
  font-size: 0.95rem;
  color: var(--st-gray-600);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.grid-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid var(--st-gray-100);
}

.grid-card-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--st-red);
}

.grid-card-play-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--st-red-light);
  color: var(--st-red);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.grid-card:hover .grid-card-play-icon, .grid-card:active .grid-card-play-icon {
  background: var(--st-red);
  color: var(--st-white);
  transform: scale(1.1);
}

/* ==========================================================================
   VIEW 2: DEDICATED VIDEO PLAYER VIEW
   ========================================================================== */
.player-view {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 16px;
  animation: fadeIn 0.25s ease-out;
  min-height: 0;
  box-sizing: border-box;
}

.player-inner {
  width: 100%;
  max-width: 960px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-height: 0;
}

/* Compact Header directly above video */
.player-compact-header {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

.player-single-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.top-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-md);
  background: var(--st-white);
  border: 1px solid var(--border-subtle);
  color: var(--st-black);
  font-family: var(--font-main);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.top-back-btn:active {
  transform: scale(0.97);
  background: var(--st-gray-100);
}

.player-step-indicator {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--st-red);
  background: var(--st-red-light);
  padding: 5px 12px;
  border-radius: 14px;
  white-space: nowrap;
  flex-shrink: 0;
}

.details-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--st-black);
  letter-spacing: -0.01em;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.details-body {
  font-size: 0.92rem;
  line-height: 1.4;
  color: var(--st-gray-800);
  margin: 0;
  padding: 6px 12px;
  background: var(--st-white);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.video-container {
  position: relative;
  width: 100%;
  max-height: calc(100vh - var(--header-height) - 160px);
  max-height: calc(100dvh - var(--header-height) - 160px);
  max-width: min(960px, calc((100dvh - var(--header-height) - 160px) * (16 / 9)));
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-xl);
  background: #000000;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}

video#kioskVideo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}

/* Big Play Overlay for Kiosk */
.video-overlay-play {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 10;
}

.video-container.paused .video-overlay-play {
  opacity: 1;
  pointer-events: auto;
}

.play-circle-btn {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--st-red);
  color: var(--st-white);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(230, 42, 50, 0.45);
  transition: transform 0.15s ease;
}

.play-circle-btn svg {
  width: 40px;
  height: 40px;
  margin-left: 5px;
}

.play-circle-btn:active {
  transform: scale(0.92);
}

.play-prompt-text {
  color: var(--st-white);
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  margin-top: 14px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

/* Finished Video Overlay */
.video-overlay-ended {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(18, 20, 23, 0.88);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 20;
  padding: 24px;
  text-align: center;
}

.video-overlay-ended.show {
  opacity: 1;
  pointer-events: auto;
}

.ended-title {
  color: var(--st-white);
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
}

.ended-subtitle {
  color: var(--st-gray-200);
  font-size: 0.95rem;
  max-width: 420px;
}

.ended-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 8px;
}

.nav-step-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 24px;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: var(--st-white);
  color: var(--st-black);
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.nav-step-btn:hover {
  background: var(--st-gray-100);
}

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

.nav-step-btn.primary {
  background: var(--st-red);
  color: var(--st-white);
  border-color: var(--st-red);
  box-shadow: 0 4px 14px rgba(230, 38, 50, 0.35);
}

.nav-step-btn.primary:hover {
  background: #c81e29;
}

.nav-step-btn:disabled {
  opacity: 0.35;
  pointer-events: none;
}

/* Video Control Bar */
.custom-controls-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.4) 70%, transparent 100%);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 15;
  transition: opacity 0.3s ease;
}

.video-progress-container {
  width: 100%;
  height: 12px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  touch-action: none;
}

.video-progress-fill {
  height: 100%;
  background: var(--st-red);
  border-radius: 6px;
  width: 0%;
  position: relative;
}

.video-progress-fill::after {
  content: '';
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background: var(--st-white);
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.controls-left, .controls-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.ctrl-btn {
  background: transparent;
  border: none;
  color: var(--st-white);
  cursor: pointer;
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  transition: background 0.15s ease, transform 0.1s ease;
}

.ctrl-btn:active {
  transform: scale(0.9);
  background: rgba(255, 255, 255, 0.2);
}

.ctrl-btn svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
}

.time-display {
  color: var(--st-white);
  font-size: 0.88rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}



/* ==========================================================================
   IDLE TIMER / STANDBY BAR
   ========================================================================== */
.idle-banner {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(18, 20, 23, 0.94);
  color: var(--st-white);
  padding: 12px 24px;
  border-radius: 30px;
  font-size: 0.92rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  align-items: center;
  gap: 12px;
  animation: fadeIn 0.3s ease;
}

.idle-banner.show {
  display: flex;
}

.idle-pulse {
  width: 10px;
  height: 10px;
  background: var(--st-red);
  border-radius: 50%;
  animation: pulse 1.5s infinite;
}

/* ==========================================================================
   RESPONSIVE DESIGN (PORTRAIT / VERTICAL TABLETS)
   ========================================================================== */
@media (max-width: 820px), (orientation: portrait) and (max-width: 900px) {
  .app-header {
    padding: 0 14px;
    height: 60px;
  }

  .brand-section {
    gap: 10px;
  }

  .brand-logo-img {
    height: 22px;
  }

  .brand-subtitle {
    font-size: 0.98rem;
  }

  .brand-tagline {
    display: none;
  }

  .kiosk-btn {
    height: 38px;
    padding: 0 12px;
    font-size: 0.86rem;
  }

  .hero-title {
    font-size: 1.7rem;
  }

  .hero-subtitle {
    font-size: 0.98rem;
  }

  .videos-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .grid-card {
    padding: 20px;
  }

  .player-view {
    padding: 12px 14px;
  }

  .player-single-row {
    gap: 10px;
  }

  .details-title {
    font-size: 1.2rem;
  }

  .details-body {
    font-size: 0.95rem;
    padding: 8px 12px;
  }
}

@media (max-width: 520px) {
  .kiosk-btn .btn-text {
    display: none;
  }

  .kiosk-btn {
    padding: 0 10px;
  }
}

/* ==========================================================================
   LANDSCAPE COMPACT HEIGHT OPTIMIZATION (e.g. 1280x720, 1920x1080 scaled)
   ========================================================================== */
@media (max-height: 760px) and (orientation: landscape) {
  .app-header {
    height: 44px;
    padding: 0 14px;
  }

  .brand-logo-img {
    height: 18px;
  }

  .brand-subtitle {
    font-size: 0.92rem;
  }

  .brand-tagline {
    display: none;
  }

  .kiosk-btn {
    height: 30px;
    padding: 0 10px;
    font-size: 0.8rem;
  }

  .overview-view {
    padding: 12px 16px;
  }

  .overview-inner {
    gap: 12px;
  }

  .hero-badge {
    padding: 3px 8px;
    font-size: 0.7rem;
    margin-bottom: 2px;
  }

  .hero-title {
    font-size: 1.45rem;
    margin-bottom: 2px;
  }

  .hero-subtitle {
    font-size: 0.85rem;
  }

  .videos-grid {
    gap: 10px;
  }

  .grid-card {
    padding: 12px 14px;
    gap: 8px;
    border-radius: var(--radius-md);
  }

  .grid-card-number {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }

  .grid-card-title {
    font-size: 1.05rem;
    margin-bottom: 2px;
  }

  .grid-card-desc {
    font-size: 0.82rem;
    line-height: 1.3;
  }

  .grid-card-footer {
    padding-top: 6px;
  }

  .player-view {
    padding: 6px 14px;
  }

  .player-inner {
    gap: 6px;
  }

  .player-compact-header {
    gap: 4px;
  }

  .top-back-btn {
    height: 32px;
    padding: 0 10px;
    font-size: 0.84rem;
  }

  .player-step-indicator {
    padding: 3px 8px;
    font-size: 0.72rem;
  }

  .details-title {
    font-size: 1.1rem;
  }

  .details-body {
    font-size: 0.84rem;
    padding: 4px 8px;
    line-height: 1.3;
  }

  .video-container {
    max-height: calc(100vh - 44px - 110px);
    max-height: calc(100dvh - 44px - 110px);
    max-width: min(900px, calc((100dvh - 44px - 110px) * (16 / 9)));
    border-radius: var(--radius-md);
  }

  .custom-controls-bar {
    padding: 6px 12px;
    gap: 6px;
  }

  .ctrl-btn {
    width: 36px;
    height: 36px;
    padding: 6px;
  }

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

  .time-display {
    font-size: 0.82rem;
  }

  .ended-title {
    font-size: 1.25rem;
  }

  .ended-subtitle {
    font-size: 0.85rem;
  }

  .nav-step-btn {
    height: 40px;
    padding: 0 16px;
    font-size: 0.88rem;
  }
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(230, 42, 50, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(230, 42, 50, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(230, 42, 50, 0); }
}
