/* カラーパレット */
:root {
    --primary-blue: #0066cc;
    --red: #dc3545;
    --text-dark: #333;
    --text-light: #666;
    --border-light: #ddd;
    --background-light: #f9f9f9;
    --background-gray: #6c757d;
    --warning-bg: #fff3cd;
    --warning-border: #ffeaa7;
    --white: #ffffff;
    --tag-gray: #e7e7e7;
    --line-height: 1.5;
}

/* リセットとベーススタイル */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    color: var(--text-dark);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: var(--line-height);
    color: var(--text-dark);
    background: var(--white);
    padding: 0;
    padding-bottom: 300px;
}

/* コンテナ */
.container {
    max-width: 800px;
    margin: 0 auto;
}

/* ヘッダー */
header {
    padding: 60px 0;
    text-align: center;
}

header h1 {
    font-size: 1.8em;
    font-weight: 600;
    margin: 0;
}

/* 共通スタイル */
.card {
    padding: 16px;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    background: var(--background-light);
    margin-bottom: 16px;
}

.card-warning {
    background: var(--warning-bg);
    border-color: var(--warning-border);
}

.form-input {
    padding: 8px;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    font-size: 1em;
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-blue);
}

.option-container {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.option-container input[type="radio"],
.option-container input[type="checkbox"] {
    margin: 0;
}

.tag {
    display: inline-block;
    font-size: 0.7em;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 8px;
    font-weight: bold;
    color: var(--white);
}

.tag-required {
    background: var(--red);
}

.tag-optional {
    background: var(--background-gray);
}

.section-title {
    color: var(--text-dark);
    margin-bottom: 16px;
    font-weight: 600;
}

.section-title-large {
    font-size: 1.4em;
}

.section-title-medium {
    font-size: 1.1em;
}

/* 注意事項 */
.disclaimer h2 {
    font-size: 1.1em;
    color: var(--text-dark);
    margin-bottom: 8px;
    font-weight: 600;
}

.disclaimer ul {
    margin: 0;
    padding-left: 20px;
}

.disclaimer li {
    color: var(--text-light);
    margin-bottom: 8px;
    line-height: var(--line-height);
    font-size: 0.9em;
}

.disclaimer li:last-child {
    margin-bottom: 0;
}

.disclaimer a {
    color: var(--primary-blue);
    text-decoration: underline;
    word-break: break-all;
    overflow-wrap: break-word;
}

.disclaimer a:hover {
    color: var(--primary-blue);
}

/* 作例セクション */
.examples-section h2 {
    font-size: 1.4em;
    color: var(--text-dark);
    margin-bottom: 16px;
    font-weight: 600;
}

.examples-section details {
    margin-bottom: 16px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: var(--white);
    overflow: hidden;
}

.examples-section details:last-child {
    margin-bottom: 0;
}

.examples-section summary {
    padding: 16px;
    background: var(--background-light);
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
    transition: background-color 0.2s ease;
}

.examples-section summary:hover {
    background: #e9ecef;
}

.examples-section summary::-webkit-details-marker {
    display: none;
}

.examples-section details[open] summary::before {
    transform: rotate(180deg);
}

.examples-section summary h3 {
    display: inline;
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.examples-section details>div {
    padding: 16px;
}

.examples-section details>div>p {
    color: var(--text-light);
    margin-bottom: 16px;
    line-height: var(--line-height);
    font-size: 0.9em;
    word-break: break-all;
}

.examples-section details>div>div {
    background: var(--background-light);
    padding: 16px;
    border-radius: 4px;
    border: 1px solid var(--border-light);
}

.examples-section details h4 {
    font-size: 1.2em;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-blue);
}

.examples-section details h5 {
    font-size: 1em;
    font-weight: 600;
    color: var(--text-dark);
    margin: 16px 0 8px 0;
}

.examples-section details h5:first-child {
    margin-top: 0;
}

.examples-section details ul {
    margin: 0 0 16px 0;
    padding-left: 16px;
}

.examples-section details li {
    color: var(--text-light);
    margin-bottom: 8px;
    line-height: var(--line-height);
    font-size: 0.9em;
}

.examples-section details li:last-child {
    margin-bottom: 0;
}

.examples-section details a {
    color: var(--primary-blue);
    text-decoration: underline;
    word-break: break-all;
    overflow-wrap: break-word;
}

.examples-section details a:hover {
    color: var(--primary-blue);
}

section {
    padding: 40px 0;
    border-bottom: 1px solid var(--border-light);
}

section:last-child {
    border-bottom: none;
}

section h2 {
    font-size: 1.4em;
    color: var(--text-dark);
    margin-bottom: 16px;
    font-weight: 600;
}

.description {
    color: var(--text-light);
    margin-bottom: 24px;
    line-height: var(--line-height);
}

.business-type-note {
    margin-top: 16px;
}

.business-type-note p {
    color: var(--text-light);
    font-size: 0.9em;
    margin: 0;
}

.business-type-note strong {
    color: var(--text-dark);
}

/* 安全管理措置選択 */
.measures-options {
    margin-bottom: 32px;
}

.measure-option {
    margin-bottom: 16px;
}

.measure-option input[type="radio"] {
    margin: 0;
    flex-shrink: 0;
}

.measure-option span {
    line-height: var(--line-height);
}

.measure-option.disabled {
    opacity: 0.5;
    background: var(--background-light);
}

.measure-option.disabled label {
    cursor: not-allowed;
}

/* 中小規模事業者の判定条件 */
.business-criteria {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.criterion-item {
    margin-bottom: 16px;
}

.criterion-item p {
    color: var(--text-light);
    margin-bottom: 16px;
}

.criterion-options {
    display: flex;
    gap: 16px;
}

.criterion-option input[type="radio"] {
    margin: 0;
}

/* 判定結果 */
.business-type-result {
    margin-top: 16px;
}

.business-type-result h3 {
    font-size: 1.1em;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.result-display {
    text-align: center;
}

.result-display p {
    margin: 0;
    font-weight: bold;
    color: var(--text-dark);
}

.unknown-country-options {
    margin-top: 8px;
}

.unknown-country-option input[type="checkbox"] {
    margin: 0;
}

.unknown-country-details {
    margin-top: 16px;
    margin-bottom: 0;
    background: var(--white);
    border-radius: 4px;
}

.unknown-country-details .criterion-item:last-child {
    margin-bottom: 0;
}

.reason-input {
    margin-top: 4px;
    width: 100%;
    min-height: 80px;
    resize: vertical;
}

/* 個人データ保管国の入力 */
.country-input-container {
    margin-top: 20px;
}

.country-input-group {
    display: flex;
    gap: 8px;
}

.country-input {
    flex: 1;
}

.country-input::placeholder {
    color: var(--text-light);
}

.country-list {
    display: flex;
    flex-direction: column;
}

.country-tag {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    padding: 8px 16px;
    background: var(--tag-gray);
    border-radius: 20px;
    font-size: 0.9em;
    cursor: grab;
    user-select: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.country-tag:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.country-tag.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.country-tag.drag-over {
    border: 2px dashed var(--primary-blue);
    background: var(--background-light);
}

.country-tag button {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 1.2em;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.country-tag button:hover {
    background: var(--red);
    color: var(--white);
}

.generate-button-container {
    text-align: center;
    margin-top: 32px;
}

/* 出力セクション */
.output-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.btn {
    padding: 8px 20px;
    border: none;
    border-radius: 4px;
    font-size: 1em;
    cursor: pointer;
    background: var(--primary-blue);
    color: var(--white);
    text-decoration: none;
    display: inline-block;
}

.btn:hover {
    background: var(--primary-blue);
}

.btn-secondary {
    background: var(--background-gray);
}

.btn-secondary:hover {
    background: var(--text-light);
}

.btn:disabled {
    background: var(--border-light);
    cursor: not-allowed;
}

.output-container {
    position: relative;
}

#outputText {
    width: 100%;
    min-height: 400px;
    line-height: var(--line-height);
    font-family: sans-serif;
    background: var(--white);
    color: var(--text-dark);
    resize: vertical;
    word-break: break-all;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .container {
        padding: 0 20px;
    }

    header h1 {
        font-size: 1.6em;
    }

    .criterion-options {
        flex-direction: column;
        gap: 8px;
    }

    .country-input-group {
        flex-direction: column;
    }

    .output-controls {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .examples-section details {
        margin-bottom: 16px;
    }

    .examples-section summary {
        padding: 12px 16px;
    }

    .examples-section details>div {
        padding: 16px;
    }

    .examples-section details>div>div {
        padding: 12px;
    }
}

/* フォーカス表示 */
.btn:focus,
.country-input:focus,
#outputText:focus {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}