/* コンポーネント別スタイル */

/* メインコンテナ */
.main-container {
    display: flex;
    flex-direction: column;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    padding: 0;
    background: #ffffff;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    min-height: calc(100vh - 130px);
}

/* 入力エリア */
.input-area {
    background: #ffffff;
    padding: 1.5rem 2rem;
}

.input-area h2 {
    display: none;
}

/* セクション見出し（番号付き赤色） */
.section-heading {
    color: var(--section-heading-color);
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

/* 入力グループ */
.input-group {
    margin-bottom: 1.5rem;
}

.input-group fieldset,
fieldset.input-group {
    border: 1px solid #ddd;
    border-radius: 2px;
    padding: 1rem 1.5rem;
    margin: 0 0 1.5rem 0;
}

.input-group legend,
fieldset.input-group > legend {
    color: var(--section-heading-color);
    font-size: 1rem;
    font-weight: 700;
    padding: 0 0.5rem;
    border-bottom: none;
    width: auto;
    margin-bottom: 0.5rem;
}

.input-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.9rem;
}

/* 入力フィールド */
.number-input,
.select-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.number-input:focus,
.select-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 0.2rem rgba(196, 0, 0, 0.15);
}

.number-input.error,
.select-input.error {
    border-color: var(--danger-color);
}

.number-input.valid,
.select-input.valid {
    border-color: var(--success-color);
}

/* ラジオボタングループ */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.radio-group.horizontal {
    flex-direction: row;
    gap: 1.5rem;
}

.radio-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: normal;
    margin-bottom: 0;
    padding: 0.25rem 0;
}

.radio-group input[type="radio"] {
    margin-right: 0.5rem;
    accent-color: var(--accent-color);
    transform: scale(1.1);
}

/* ヘッドタイプ グリッドレイアウト */
.head-type-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    align-items: start;
}

/* ヘッド画像プレビューエリア（グリッド内） */
.head-preview-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fafafa;
    padding: 0.75rem;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.head-preview-area.visible {
    opacity: 1;
}

.head-preview-area img {
    max-width: 100%;
    max-height: 200px;
    width: auto;
    height: auto;
    display: block;
}

.head-preview-area .head-preview-label {
    text-align: center;
    font-size: 0.85rem;
    color: #555;
    margin-top: 0.5rem;
    font-weight: 600;
}

/* エラーメッセージ */
.error-message {
    color: #dc3545;
    font-size: 0.8rem;
    margin-top: 0.25rem;
    min-height: 1rem;
    display: block;
}

/* ヒントメッセージ */
.input-hint {
    color: #6c757d;
    font-size: 0.8rem;
    margin-top: 0.25rem;
    font-style: italic;
}

/* 出力エリア */
.output-area {
    background: #ffffff;
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-color);
    position: relative;
}

.output-area .section-title {
    color: var(--text-color);
    font-size: 1.25rem;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.output-content h2 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: var(--text-color);
    font-size: 1.1rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

/* 初期メッセージ */
.initial-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    text-align: center;
    color: #999;
}

.initial-message h2 {
    color: #999;
    margin-bottom: 1rem;
    border: none;
}

/* 出力グループ */
.output-group {
    margin-bottom: 2rem;
}

.output-group h3 {
    margin-bottom: 1rem;
    color: var(--text-color);
    font-size: 1.1rem;
    border-left: 4px solid var(--accent-color);
    padding-left: 0.75rem;
}

/* 型番表示 */
.part-number-display {
    display: flex;
    align-items: center;
    background: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 0.75rem;
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    font-weight: bold;
}

#part-number-text {
    flex: 1;
    color: #495057;
}

.copy-button {
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    margin-left: 0.5rem;
    transition: background-color 0.15s ease-in-out;
}

.copy-button:hover {
    background: var(--primary-dark);
}

/* ヘッド画像 */
.head-image-container {
    text-align: center;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 1rem;
}

.head-image {
    max-width: 300px;
    max-height: 300px;
    width: auto;
    height: auto;
    border-radius: 4px;
}

/* 寸法表 */
.dimension-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.dimension-table th,
.dimension-table td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.dimension-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.dimension-table tr:hover {
    background: #f8f9fa;
}

/* 情報プレースホルダー */
.info-placeholder {
    background: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 4px;
    padding: 1rem;
    text-align: center;
    color: #856404;
    font-style: italic;
}

/* PDFエリア */
.pdf-area {
    display: flex;
    justify-content: center;
    padding-top: 1.5rem;
    margin-top: 1rem;
}

.pdf-button {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.75rem 2.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.pdf-button:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.pdf-button:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 推奨マーク */
.recommended {
    position: relative;
}

.recommended::after {
    content: "★";
    color: #ffc107;
    margin-left: 0.25rem;
    font-weight: bold;
}

/* バリデーション状態 */
.field-valid {
    border-color: #28a745 !important;
}

.field-error {
    border-color: #dc3545 !important;
}

/* ローディング状態 */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid var(--accent-color);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* バリデーション関連スタイル */
.validation-errors-container {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    padding: 1rem;
    margin: 1rem 0;
    color: #721c24;
}

.error-summary {
    max-width: 100%;
}

.error-title {
    margin: 0 0 0.75rem 0;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.error-icon {
    margin-right: 0.5rem;
    font-size: 1.2em;
}

.error-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.error-item {
    margin-bottom: 0.5rem;
}

.error-link {
    background: none;
    border: none;
    color: #721c24;
    text-align: left;
    cursor: pointer;
    padding: 0;
    font-size: 0.9rem;
    text-decoration: underline;
    width: 100%;
}

.error-link:hover {
    color: #491217;
}

.field-warning {
    border-color: #ffc107 !important;
}

.warning-message {
    color: #856404;
    font-size: 0.8rem;
    margin-top: 0.25rem;
    display: block;
}

/* 通知システム */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    max-width: 400px;
}

.notification {
    background: white;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-bottom: 0.5rem;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease-in-out;
    overflow: hidden;
}

.notification-show {
    opacity: 1;
    transform: translateX(0);
}

.notification-content {
    padding: 1rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.notification-message {
    flex: 1;
    margin-right: 0.5rem;
    font-size: 0.9rem;
    line-height: 1.4;
}

.notification-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    color: #6c757d;
    line-height: 1;
}

.notification-close:hover {
    color: #495057;
}

.notification-success {
    border-left: 4px solid #28a745;
}

.notification-success .notification-content {
    background: linear-gradient(90deg, #d4edda 0%, #ffffff 100%);
}

.notification-error {
    border-left: 4px solid #dc3545;
}

.notification-error .notification-content {
    background: linear-gradient(90deg, #f8d7da 0%, #ffffff 100%);
}

.notification-info {
    border-left: 4px solid #007bff;
}

.notification-info .notification-content {
    background: linear-gradient(90deg, #d1ecf1 0%, #ffffff 100%);
}

/* アクセシビリティ向上 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* リセットボタン */
.reset-button {
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    width: 100%;
    margin-top: 1rem;
}

.reset-button:hover:not(:disabled) {
    background: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.reset-button:active {
    transform: translateY(0);
}

.reset-button:disabled {
    background: #dee2e6;
    color: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* === 対応シャンク推奨セクション === */

/* === 単位切替トグル === */
.dimension-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.dimension-header .section-heading {
    margin: 0;
    padding-bottom: 0;
    border-bottom: none;
}

/* ヘッダー内の単位切替トグル */
.header .unit-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
}

.header .unit-toggle-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}

.header .unit-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.7);
    padding: 0.2rem 0.7rem;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 3px;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.header .unit-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.header .unit-btn.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* 入力エリア内の単位切替トグル（フォールバック） */
.unit-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
}

.unit-toggle-label {
    font-size: 0.8rem;
    color: #6c757d;
    font-weight: 500;
}

.unit-btn {
    background: #f1f3f5;
    border: 1px solid #ced4da;
    color: #495057;
    padding: 0.2rem 0.7rem;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 3px;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.unit-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.unit-btn.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}
.shank-recommendation-section {
    margin-top: 1.5rem;
    padding: 0 1rem 1rem;
}

.shank-recommendation-section h3 {
    color: var(--section-heading-color);
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 1rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.shank-type-block {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

/* シャンクテーブルのスクロールラッパー */
.shank-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -0.25rem;
    padding: 0 0.25rem;
}

.shank-type-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.75rem 0;
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.25rem;
}

.shank-images {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.shank-image-item {
    flex: 1;
    min-width: 200px;
    text-align: center;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 0.5rem;
}

.shank-image-item img {
    max-width: 100%;
    height: auto;
}

.shank-image-caption {
    display: block;
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.25rem;
}

.shank-spec-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.shank-spec-table th {
    background: var(--primary-color);
    color: #fff;
    padding: 0.4rem 0.6rem;
    text-align: left;
    white-space: nowrap;
}

.shank-spec-table td {
    padding: 0.3rem 0.6rem;
    border-bottom: 1px solid #dee2e6;
    white-space: nowrap;
}

.shank-spec-table tr:nth-child(even) {
    background: #f8f9fa;
}

.shank-spec-table tr:hover {
    background: #e9ecef;
}

.shank-no-match {
    color: #6c757d;
    font-style: italic;
    text-align: center;
    padding: 1rem;
}

/* === 型番内訳グリッド === */
.breakdown-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.breakdown-item {
    display: flex;
    flex-direction: column;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 0.4rem 0.6rem;
}

.breakdown-label {
    font-size: 0.7rem;
    color: #6c757d;
    font-weight: 500;
}

.breakdown-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-color);
    font-family: 'Courier New', monospace;
}

/* === 計算結果テーブル === */
.dimensions-table {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.results-table th,
.results-table td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.results-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.results-table tr:hover {
    background: #f8f9fa;
}

/* === ステータス表示 === */
.status-display {
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.status-display.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
}

.status-display.error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
}

.status-message {
    margin: 0;
    font-weight: 600;
}

.status-message.success {
    color: #155724;
}

.status-message.error {
    color: #721c24;
}

.calculation-time {
    color: #6c757d;
    font-size: 0.8rem;
}

/* === 結果セクション === */
.result-section {
    margin-bottom: 1.5rem;
}

.result-section h3 {
    margin-bottom: 1rem;
    color: var(--text-color);
    font-size: 1.1rem;
    border-left: 4px solid var(--accent-color);
    padding-left: 0.75rem;
}

/* === 型番表示の折り返し === */
.part-number-text {
    word-break: break-all;
}
