/**
 * TM特殊ヘッド作図システム - メインスタイル
 * 全体的なレイアウト、タイポグラフィ、ベーススタイルを定義
 */

/* CSS変数定義 */
:root {
    --primary-color: #c40000;
    --primary-dark: #a00000;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f5f5f5;
    --dark-color: #333333;
    --text-color: #333333;
    --border-color: #ddd;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --border-radius: 4px;
    --transition: all 0.15s ease-in-out;
    --accent-color: #c40000;
    --header-bg: #333333;
    --section-heading-color: #c40000;
}

/* リセットスタイル */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ベーススタイル */
html {
    font-size: 16px;
    line-height: 1.5;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans JP", sans-serif;
    color: var(--text-color);
    background-color: var(--light-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* スクロールバーのスタイル（WebKit系ブラウザ） */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #e8e8e8;
}

::-webkit-scrollbar-thumb {
    background: #bbb;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* タイポグラフィ */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

h1 {
    font-size: 2rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.25rem;
}

p {
    margin-bottom: 1rem;
}

/* リンク */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ボタンベーススタイル */
button {
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
    user-select: none;
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    transition: var(--transition);
    outline: none;
}

button:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* フォーム要素ベーススタイル */
input,
select,
textarea {
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-color);
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    outline: none;
    transition: var(--transition);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 0.2rem rgba(196, 0, 0, 0.15);
}

/* レイアウト */
/* ヘッダー */
.header {
    background: var(--header-bg);
    color: white;
    padding: 1rem 2rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    flex-direction: column;
}

.header h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
}

.header-subtitle {
    margin: 0.15rem 0 0;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* 言語切替ボタン */
.lang-switcher {
    display: flex;
    gap: 2px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    padding: 2px;
}

.lang-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 3px;
    transition: background 0.15s, color 0.15s;
}

.lang-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
}

.lang-btn.active {
    background: var(--primary-color);
    color: #fff;
}

.header .version {
    background: rgba(255, 255, 255, 0.15);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
}

/* フッター */
.footer {
    background: var(--header-bg);
    padding: 1.25rem 2rem;
    text-align: center;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: auto;
}

.footer p {
    margin: 0;
}

.main-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    padding: 0;
}

/* ボタンスタイルの改善 */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-align: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 4px rgba(196, 0, 0, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(196, 0, 0, 0.4);
}

.btn-primary:disabled {
    background: #6c757d;
    color: #adb5bd;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-secondary {
    background: #ffffff;
    color: #666;
    border: 1px solid #ccc;
}

.btn-secondary:hover {
    background: #f0f0f0;
    color: #333;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.form-actions .btn-primary {
    flex: 1;
}

.form-actions .btn-secondary {
    flex: 1;
}

/* 計算ボタンのアニメーション */
.btn-primary:not(:disabled):active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(196, 0, 0, 0.3);
}

/* ユーティリティクラス */
.d-none {
    display: none !important;
}

.d-block {
    display: block !important;
}

.d-flex {
    display: flex !important;
}

.text-center {
    text-align: center !important;
}

.text-left {
    text-align: left !important;
}

.text-right {
    text-align: right !important;
}

.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mt-5 { margin-top: 3rem !important; }

.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mb-5 { margin-bottom: 3rem !important; }

.p-1 { padding: 0.25rem !important; }
.p-2 { padding: 0.5rem !important; }
.p-3 { padding: 1rem !important; }
.p-4 { padding: 1.5rem !important; }
.p-5 { padding: 3rem !important; }

/* アクセシビリティ */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* プリント用スタイル */
@media print {
    body {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .no-print {
        display: none !important;
    }
}