/* ==========================================
   シルエット画像メーカー CSS
   プレフィックス: silhouette-
   カラーコンセプト: 南の島のおじぃ統一デザイン
   ========================================== */

/* 1. CSS変数定義 */
.silhouette-wrap {
  /* ベースカラー（70%） */
  --base: #FFFFFF;
  --base-light: #FAFAFA;
  --base-dark: #F5F5F5;
  
  /* メインカラー（25%） */
  --main: #1e3a5f;
  --main-light: #2d5a8f;
  --main-dark: #0f1e3a;
  
  /* アクセントカラー（5%） */
  --accent: #d4af37;
  --accent-light: #f4cf5f;
  --accent-dark: #b8941f;
  
  /* テキストカラー */
  --text: #2C3E50;
  --text-light: #7F8C8D;
  
  /* ボーダー */
  --border: #E8E8E8;
  
  /* シャドウ */
  --shadow: 0 4px 20px rgba(30, 58, 95, 0.1);
  --shadow-hover: 0 8px 30px rgba(30, 58, 95, 0.15);
}

/* 2. リセット */
.silhouette-wrap * {
  box-sizing: border-box !important;
  margin: 0;
  padding: 0;
}

/* 3. メインコンテナ */
.silhouette-wrap {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans JP", sans-serif !important;
  background: linear-gradient(135deg, #FFFFFF 0%, #F8F9FA 50%, #F0F2F5 100%);
  color: var(--text) !important;
  height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 4. ヘッダー（ブランドアイデンティティ） */
.silhouette-header {
  background: var(--main);
  border-top: 3px solid var(--accent);
  border-bottom: 3px solid var(--accent);
  border-radius: 20px;
  padding: clamp(16px, 2.5vh, 24px);
  box-shadow: 0 4px 20px rgba(30, 58, 95, 0.3);
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
}

.silhouette-header h1 {
  color: #ffffff !important;
  font-weight: 900 !important;
  font-size: clamp(18px, 3vw, 26px) !important;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  margin: 0 !important;
  text-align: center;
  letter-spacing: 0.05em;
}

.silhouette-badge {
  background: var(--accent);
  color: var(--main-dark);
  padding: 4px 12px;
  border-radius: 8px;
  font-size: clamp(10px, 1.5vw, 12px) !important;
  margin-left: 10px;
  font-weight: 900;
  text-shadow: none;
}

/* 光沢エフェクト */
.silhouette-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 200%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.15), transparent);
  animation: silhouette-shine 3s infinite;
}

@keyframes silhouette-shine {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* 5. コンテナレイアウト */
.silhouette-container {
  display: flex;
  flex: 1;
  overflow: hidden;
  gap: 0;
}

/* 6. サイドバー */
.silhouette-sidebar {
  width: 320px;
  background: var(--base);
  padding: clamp(16px, 2.5vw, 24px);
  border-right: 2px solid var(--border);
  border-radius: 0 0 0 20px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
  gap: 24px;
  box-shadow: 4px 0 20px rgba(30, 58, 95, 0.08);
}

.silhouette-control-group {
  border-bottom: 2px solid var(--border);
  padding-bottom: 20px;
}

.silhouette-control-group:last-child {
  border: none;
  padding-bottom: 0;
}

.silhouette-label-title {
  font-weight: 900 !important;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--main) !important;
  font-size: clamp(12px, 1.8vw, 14px) !important;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: relative;
  padding-left: 10px;
}

.silhouette-label-title::before {
  content: '';
  position: absolute;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
}

/* 7. ボタンスタイル */
.silhouette-btn {
  width: 100%;
  padding: clamp(12px, 2vh, 16px);
  border-radius: 14px;
  border: none;
  font-weight: 900 !important;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: clamp(13px, 1.8vw, 15px) !important;
  font-family: inherit !important;
}

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

/* アウトラインボタン（白背景） */
.silhouette-btn-outline {
  background: var(--base) !important;
  color: var(--main) !important;
  border: 2px solid var(--main) !important;
  box-shadow: 0 2px 8px rgba(30, 58, 95, 0.1);
}

.silhouette-btn-outline:hover {
  background: var(--main) !important;
  color: var(--accent) !important;
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(30, 58, 95, 0.3);
}

/* メインボタン（ネイビー） */
.silhouette-btn-fill {
  background: linear-gradient(135deg, var(--main-light) 0%, var(--main) 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(30, 58, 95, 0.3);
}

.silhouette-btn-fill:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--main) 0%, var(--main-dark) 100%) !important;
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(30, 58, 95, 0.4);
}

.silhouette-btn-fill:disabled {
  background: #cbd5e1 !important;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.6;
}

/* セカンダリボタン（ゴールド） */
.silhouette-btn-save {
  background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent) 100%) !important;
  color: var(--main-dark) !important;
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
  margin-top: 8px;
}

.silhouette-btn-save:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%) !important;
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(212, 175, 55, 0.4);
}

.silhouette-btn-save:disabled {
  background: #cbd5e1 !important;
  cursor: not-allowed;
  opacity: 0.6;
}

/* 8. 背景選択セレクトボックス */
.silhouette-bg-select {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 2px solid var(--border) !important;
  font-size: clamp(13px, 1.8vw, 14px) !important;
  font-weight: 600 !important;
  background: var(--base-dark) !important;
  color: var(--text) !important;
  cursor: pointer;
  margin-bottom: 5px;
  transition: all 0.3s ease;
  font-family: inherit !important;
}

.silhouette-bg-select:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.15);
  outline: none;
}

.silhouette-bg-select:hover {
  border-color: var(--main-light) !important;
}

/* 9. 入力フィールド */
.silhouette-range {
  width: 100%;
  cursor: pointer;
  margin: 10px 0;
  accent-color: var(--accent);
  height: 8px;
  background: linear-gradient(to right, var(--base-dark), var(--accent));
  border-radius: 4px;
  outline: none;
}

.silhouette-range::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(212, 175, 55, 0.4);
  transition: all 0.2s;
}

.silhouette-range::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.6);
}

.silhouette-color-picker {
  width: 100%;
  height: 40px;
  border: 2px solid var(--border) !important;
  border-radius: 12px;
  cursor: pointer;
  padding: 4px !important;
  transition: all 0.3s ease;
}

.silhouette-color-picker:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.15);
  outline: none;
}

/* 10. トグルスイッチ */
.silhouette-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  cursor: pointer;
  user-select: none;
  padding: 8px 12px;
  background: var(--base-light);
  border-radius: 12px;
  transition: all 0.3s ease;
}

.silhouette-toggle-row:hover {
  background: var(--base-dark);
}

.silhouette-toggle-row span {
  font-size: clamp(12px, 1.8vw, 14px) !important;
  font-weight: 600 !important;
  color: var(--text) !important;
}

.silhouette-toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  background: var(--border);
  border-radius: 20px;
  transition: 0.3s;
}

.silhouette-toggle-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .silhouette-toggle-switch {
  background: var(--accent);
}

input:checked + .silhouette-toggle-switch::after {
  transform: translateX(20px);
}

/* 11. メインエリア */
.silhouette-main-area {
  flex: 1;
  background-color: #e2e2e2;
  background-image:
    linear-gradient(45deg, #ffffff 25%, transparent 25%, transparent 75%, #ffffff 75%, #ffffff),
    linear-gradient(45deg, #ffffff 25%, transparent 25%, transparent 75%, #ffffff 75%, #ffffff);
  background-size: 20px 20px;
  background-position: 0 0, 10px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 20px;
  border-radius: 0 0 20px 0;
}

#silhouetteCanvas {
  box-shadow: 0 10px 30px rgba(30, 58, 95, 0.2);
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 12px;
}

/* 12. ステータスバッジ */
.silhouette-status-badge {
  position: absolute;
  top: 20px;
  right: 20px;
  padding: 8px 16px;
  background: rgba(30, 58, 95, 0.95);
  color: var(--accent);
  border-radius: 20px;
  font-size: clamp(11px, 1.5vw, 13px) !important;
  font-weight: 900 !important;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border: 2px solid var(--accent);
}

/* 13. メッセージ */
.silhouette-message {
  color: var(--text-light) !important;
  font-weight: 900 !important;
  font-size: clamp(16px, 2.5vw, 22px) !important;
  pointer-events: none;
  text-align: center;
  background: var(--base);
  padding: 24px 32px;
  border-radius: 16px;
  border: 3px solid var(--accent);
  box-shadow: var(--shadow);
}

/* 14. レスポンシブ対応 */
@media (max-width: 900px) {
  .silhouette-container {
    flex-direction: column;
  }
  
  .silhouette-sidebar {
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 2px solid var(--border);
    border-radius: 0;
    max-height: 50vh;
  }
  
  .silhouette-main-area {
    border-radius: 0 0 20px 20px;
  }
  
  .silhouette-wrap {
    height: auto;
    max-height: none;
  }
}

@media (max-width: 600px) {
  .silhouette-header {
    border-radius: 12px;
    padding: 12px;
  }
  
  .silhouette-header h1 {
    font-size: 14px !important;
  }
  
  .silhouette-badge {
    font-size: 9px !important;
    padding: 2px 6px;
  }
  
  .silhouette-sidebar {
    padding: 12px;
    gap: 16px;
  }
  
  .silhouette-main-area {
    min-height: 300px;
  }
}

/* 15. スクロールバーカスタマイズ */
.silhouette-sidebar::-webkit-scrollbar {
  width: 8px;
}

.silhouette-sidebar::-webkit-scrollbar-track {
  background: var(--base-dark);
  border-radius: 4px;
}

.silhouette-sidebar::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 4px;
}

.silhouette-sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--accent-dark);
}
