﻿/* ==========================================================================
   Tool Detail Page Redesign - Custom Premium Layout & Interface
   ========================================================================== */

/* Main Container spacing */
.tool-detail-container {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Premium Header Banner */
.tool-header-banner {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.tool-header-icon-wrap {
  width: 52px;
  height: 52px;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}

.tool-header-icon-wrap svg {
  width: 24px;
  height: 24px;
}

.tool-header-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tool-header-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0;
}

.tool-badges-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.tool-badge-item {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--bg-surface2);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.tool-badge-item.active {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.25);
  color: #10b981;
}

/* Stable Media Gallery & Buy Box Row */
.tool-main-section {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 20px;
  align-items: stretch; /* Stretch children to align heights exactly */
}

@media (max-width: 991.98px) {
  .tool-main-section {
    grid-template-columns: 1fr;
    align-items: start;
  }
}

/* Left: Interactive Media Gallery */
.tool-media-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
  height: 100%; /* Cover full stretched height */
}

.tool-media-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tool-media-viewport {
  width: 100%;
  height: 360px; /* Absolutely locked height to guarantee zero visual shift (trồi sụt) */
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: #000000;
}

.tool-media-viewport .carousel,
.tool-media-viewport .carousel-inner,
.tool-media-viewport .carousel-item {
  height: 100% !important;
  width: 100% !important;
}

.tool-media-viewport img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important; /* Perfect aspect ratio containment without stretching or cropping */
  background: #000000;
}

/* Thumbnail Strip with horizontal overflow control */
.tool-media-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
  justify-content: flex-start;
}

.tool-media-thumbs::-webkit-scrollbar {
  height: 4px;
}

.tool-media-thumbs::-webkit-scrollbar-thumb {
  background: var(--border-subtle);
  border-radius: 4px;
}

.media-thumb-btn {
  width: 68px;
  height: 46px;
  border-radius: 6px;
  border: 1.5px solid var(--border-subtle);
  cursor: pointer;
  object-fit: cover;
  opacity: 0.6;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.media-thumb-btn:hover,
.media-thumb-btn.active {
  border-color: var(--accent);
  opacity: 1;
  transform: translateY(-1px);
}

/* Right: Custom Buy Box Widget */
.tool-buy-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  height: 100%; /* Stretch height to match the media column exactly */
}

.rent-period-list-wrap {
  flex-grow: 1;
}

.rent-action-box {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.buy-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

/* Custom Period Selector List */
.rent-period-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rent-period-item {
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface2);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.15s ease;
}

.rent-period-item:hover {
  border-color: var(--border-strong);
  transform: translateX(2px);
}

.rent-period-item.active {
  border-color: #2563eb;
  background: rgba(37, 99, 235, 0.04);
}

.period-item-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.period-radio-indicator {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.rent-period-item.active .period-radio-indicator {
  border-color: #2563eb;
}

.rent-period-item.active .period-radio-indicator::after {
  content: "";
  width: 8px;
  height: 8px;
  background: #2563eb;
  border-radius: 50%;
}

.period-label-wrap {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.period-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
}

.period-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
}

.period-price-wrap {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.period-old-price {
  font-size: 11px;
  text-decoration: line-through;
  color: var(--text-muted);
}

.period-price {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  color: #2563eb;
}

.period-discount-badge {
  font-size: 12px;
  font-weight: 700;
  background: #ef4444;
  color: #fff;
  padding: 2px 4px;
  border-radius: 4px;
  margin-top: 2px;
}

/* Beautiful Action Solid Button (Clean Solid Color - High Contrast Blue) */
.btn-buy-submit {
  width: 100%;
  height: 42px;
  border-radius: 10px;
  border: none;
  background: #2563eb !important; /* Premium clean Solid Blue, strictly NO gradient */
  color: #ffffff !important;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-buy-submit:hover:not(:disabled) {
  background: #1d4ed8 !important; /* Solid hover darker blue */
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.btn-buy-submit:active:not(:disabled) {
  transform: translateY(0);
}

.btn-buy-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

/* Full Width Panels: Video and Documentation */
.tool-info-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.tool-info-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 8px;
}

.tool-info-content {
  color: var(--text-secondary);
  line-height: 1.7;
  font-size: 14px;
}

/* Video Frame ratio lock */
.tool-video-frame-wrap {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  aspect-ratio: 16/9;
  width: 100%;
}

.tool-video-frame-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Dark theme overrides - matched perfectly to var(--bg-surface) (#223047) and background (#1a2333) */
[data-theme="dark"] .tool-media-card,
[data-theme="dark"] .tool-buy-card,
[data-theme="dark"] .tool-info-card {
  background: var(--bg-surface) !important;
  border-color: var(--border-subtle) !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25) !important;
}

[data-theme="dark"] .buy-card-title,
[data-theme="dark"] .tool-info-title {
  border-color: var(--border-subtle) !important;
}

[data-theme="dark"] .rent-period-item {
  background: var(--bg-surface2) !important;
  border-color: var(--border-subtle) !important;
}

[data-theme="dark"] .rent-period-item.active {
  border-color: #2563eb !important;
  background: rgba(37, 99, 235, 0.08) !important;
}

[data-theme="dark"] .rent-period-item .period-radio-indicator {
  border-color: var(--border-strong) !important;
}

[data-theme="dark"] .rent-period-item.active .period-radio-indicator {
  border-color: #2563eb !important;
}

[data-theme="dark"] .rent-period-item.active .period-radio-indicator::after {
  background: #2563eb !important;
}

[data-theme="dark"] .period-price {
  color: #60a5fa !important;
}
