/* app/assets/stylesheets/features/custom_gantt_chart.css */
/* カスタムSVGガントチャート - スタイリッシュデザイン */

/* ============================================
   ガントチャートコンテナ
   ============================================ */
#gantt-chart-container {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  background: linear-gradient(to bottom, var(--color-white) 0%, var(--color-gray-50) 100%);
  border-radius: var(--radius-xl);
  padding: var(--space-6) var(--space-4) var(--space-4) var(--space-6);
  box-sizing: border-box;
  box-shadow: var(--shadow-sm), var(--shadow-xl);
  overflow: visible;
  position: relative;
  border: var(--border-width-1) solid var(--color-gray-200);
  /* max-height: 80vh; を削除して2重スクロールを防止 */
}

#gantt-chart-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--space-1);
  background: var(--gradient-primary);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

/* ============================================
   SVGガントチャート
   ============================================ */
.custom-gantt-chart {
  display: block;
  max-width: 100%;
  height: auto;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.05));
}

/* ヘッダーラベル */
.custom-gantt-chart .header-label {
  user-select: none;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.custom-gantt-chart .month-label {
  user-select: none;
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: all 0.2s ease;
}

.custom-gantt-chart .month-label:hover {
  fill: var(--color-secondary);
}

.custom-gantt-chart .year-label {
  user-select: none;
  font-weight: 700;
  opacity: 0.7;
  letter-spacing: 1px;
}

/* 圃場ラベル */
.custom-gantt-chart .field-label {
  user-select: none;
  cursor: help;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.custom-gantt-chart .field-label:hover {
  fill: var(--color-secondary);
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-base);
}

/* 栽培バー */
.custom-gantt-chart .cultivation-bar {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ドラッグ中はトランジションとフィルター効果を無効化（追随性を重視） */
.custom-gantt-chart .cultivation-bar.dragging {
  transition: none !important;
}

.custom-gantt-chart .cultivation-bar.dragging * {
  transition: none !important;
}

.custom-gantt-chart .cultivation-bar.dragging .bar-bg {
  filter: none !important;
}

.custom-gantt-chart .bar-bg {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.custom-gantt-chart .bar-bg:hover {
  filter: 
    brightness(1.05)
    drop-shadow(0 4px 12px rgba(45, 80, 22, 0.3));
  stroke-width: 3;
  transform: translateY(calc(var(--space-1) * -1));
}

.custom-gantt-chart .bar-label {
  user-select: none;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.custom-gantt-chart .bar-period {
  user-select: none;
  opacity: 0.85;
  font-weight: 500;
  letter-spacing: 0.2px;
}

/* ============================================
   カスタムポップアップ
   ============================================ */
.gantt-custom-popup {
  min-width: 320px;
  background: var(--color-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2xl), 0 0 0 var(--border-width-1) rgba(0, 0, 0, 0.05);
  z-index: var(--z-index-popover);
  animation: popupFadeIn var(--transition-base) var(--ease-in-out);
  overflow: hidden;
  backdrop-filter: blur(10px);
}

@keyframes popupFadeIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.gantt-custom-popup .popup-header {
  background: var(--gradient-primary);
  color: var(--color-white);
  padding: var(--space-5) var(--space-6);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  letter-spacing: 0.3px;
  box-shadow: var(--shadow-primary);
}

.gantt-custom-popup .popup-close {
  background: rgba(255, 255, 255, 0.2);
  border: var(--border-width-2) solid rgba(255, 255, 255, 0.3);
  color: var(--color-white);
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
  width: var(--space-8);
  height: var(--space-8);
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: var(--line-height-none);
  padding: 0;
  transition: all var(--transition-slow) var(--ease-in-out);
}

.gantt-custom-popup .popup-close:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
  transform: rotate(90deg) scale(1.1);
}

.gantt-custom-popup .popup-body {
  padding: var(--space-6);
  background: linear-gradient(to bottom, var(--color-white) 0%, var(--color-gray-50) 100%);
}

.gantt-custom-popup .popup-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) 0;
  border-bottom: var(--border-width-1) solid var(--color-gray-200);
  transition: all var(--transition-fast);
}

.gantt-custom-popup .popup-item:hover {
  padding-left: var(--space-1);
  border-color: var(--color-secondary);
}

.gantt-custom-popup .popup-item:last-child {
  border-bottom: none;
}

.gantt-custom-popup .popup-label {
  font-size: var(--font-size-sm);
  color: var(--color-gray-600);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.3px;
}

.gantt-custom-popup .popup-value {
  font-size: var(--font-size-base);
  color: var(--text-primary);
  font-weight: var(--font-weight-bold);
  text-align: right;
  letter-spacing: 0.2px;
}

.gantt-custom-popup .popup-value.profit {
  color: var(--color-success-dark);
  font-weight: var(--font-weight-extrabold);
  font-size: var(--font-size-base);
  text-shadow: 0 var(--space-1) var(--space-2) rgba(47, 133, 90, 0.1);
}

/* ============================================
   スクロールバーのスタイリング
   ============================================ */
#gantt-chart-container::-webkit-scrollbar {
  height: var(--space-3);
  background: var(--color-gray-100);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

#gantt-chart-container::-webkit-scrollbar-track {
  background: linear-gradient(to bottom, var(--color-gray-50) 0%, var(--color-gray-100) 100%);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

#gantt-chart-container::-webkit-scrollbar-thumb {
  background: var(--gradient-primary);
  border-radius: var(--radius-base);
  border: var(--border-width-2) solid var(--color-gray-100);
}

#gantt-chart-container::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, var(--color-secondary-dark) 0%, #653a8b 100%);
  border-color: var(--color-gray-200);
}

/* ============================================
   レスポンシブ
   ============================================ */
@media (max-width: 768px) {
  #gantt-chart-container {
    padding: var(--space-4) var(--space-3) var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
  }

  #gantt-chart-container::before {
    height: 3px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .gantt-custom-popup {
    min-width: 280px;
    max-width: 90vw;
    border-radius: var(--radius-lg);
  }

  .gantt-custom-popup .popup-header {
    padding: var(--space-4) var(--space-5);
    font-size: var(--font-size-base);
  }

  .gantt-custom-popup .popup-body {
    padding: var(--space-5);
  }

  .gantt-custom-popup .popup-label {
    font-size: var(--font-size-xs);
  }
  
  .gantt-custom-popup .popup-value {
    font-size: var(--font-size-sm);
  }

  .gantt-custom-popup .popup-value.profit {
    font-size: var(--font-size-base);
  }

  #gantt-chart-container::-webkit-scrollbar {
    height: var(--space-2);
  }
}

