/* assets/css/style.css */
:root {
    --primary-color: #0056b3;
    --primary-hover: #004494;
    --text-color: #333;
    --bg-color: #f9f9f9;
    --border-color: #ddd;
    --error-color: #d32f2f;
    --white: #fff;
    --radius: 8px;
    --shadow: 0 4px 6px rgba(0,0,0,0.1);
}

body {
    font-family: 'Noto Sans JP', sans-serif;
    color: var(--text-color);
    background-color: var(--bg-color);
    line-height: 1.6;
    margin: 0;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: var(--white);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.form-header {
    text-align: center;
    margin-bottom: 40px;
}

.form-header h1 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: var(--primary-color);
    line-height: 1.4;
}

.form-header h1 .br-sp {
    display: none;
}

@media (max-width: 600px) {
    .form-header h1 {
        font-size: 1.3rem;
        line-height: 1.45;
    }

    .form-header h1 .br-sp {
        display: inline;
    }
}

.form-header .form-description {
    text-align: left;
    margin: 0;
    color: #555;
    font-size: 1.05rem;
    line-height: 1.7;
}

.form-section-title {
    background: #f8f9fa;
    padding: 10px 20px;
    margin: 40px -40px 25px;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.form-section-title h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-color);
}

@media (max-width: 600px) {
    .form-section-title {
        margin-left: -20px;
        margin-right: -20px;
    }
}

/* ラジオボタン・チェックボックス */
.radio-group,
.checkbox-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* PCでは2列 */
    gap: 12px 20px;
    margin-top: 10px;
}

.radio-group label,
.checkbox-group label {
    display: flex;
    align-items: flex-start; /* 2行目以降もツラを揃えるために上寄せ */
    gap: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1.4;
}

.radio-group input,
.checkbox-group input {
    flex-shrink: 0;
    margin: 2px 0 0 0; /* テキストの1行目に合わせる */
    width: 20px;
    height: 20px;
}

@media (max-width: 600px) {
    .radio-group,
    .checkbox-group {
        grid-template-columns: 1fr; /* スマホでは1列 */
    }
}

/* フォーム要素 */
.form-item {
    margin-bottom: 25px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 25px;
}

/* 横並びグループ */
.form-row-group {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 25px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 25px;
}

.form-row-group .form-item-inline {
    flex: 1;
    min-width: 200px;
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.form-item:last-child {
    border-bottom: none;
}

.form-item dt {
    font-weight: bold;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.badge-required {
    background: var(--error-color);
    color: var(--white);
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 10px;
}

.form-item dd {
    margin: 0;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
textarea,
select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    box-sizing: border-box;
    transition: border-color 0.3s;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.1);
}

.form-note {
    font-size: 0.85rem;
    color: #666;
    margin-top: 5px;
}

.field-description {
    margin: 8px 0 0;
    font-size: 0.9rem;
    font-weight: 400;
    color: #555;
    line-height: 1.6;
    flex-basis: 100%;
    width: 100%;
}

.file-upload {
    position: relative;
}

.file-upload-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.file-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    min-height: 140px;
    padding: 24px 16px;
    box-sizing: border-box;
    border: 2px dashed var(--primary-color);
    border-radius: var(--radius);
    background: linear-gradient(180deg, #f3f8ff 0%, #eaf2ff 100%);
    color: var(--primary-color);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    text-align: center;
}

.file-upload-label:hover {
    background: linear-gradient(180deg, #eaf2ff 0%, #dceaff 100%);
    box-shadow: 0 0 0 4px rgba(0, 86, 179, 0.12);
}

.file-upload.is-dragover .file-upload-label {
    background: linear-gradient(180deg, #dceaff 0%, #cfe3ff 100%);
    box-shadow: 0 0 0 4px rgba(0, 86, 179, 0.2);
    border-style: solid;
}

.file-upload-input:focus + .file-upload-label {
    box-shadow: 0 0 0 4px rgba(0, 86, 179, 0.18);
}

.file-upload.is-selected .file-upload-label {
    border-style: solid;
    background: #f0fff4;
    border-color: #2e7d32;
    color: #1b5e20;
}

.file-upload-icon {
    width: 44px;
    height: 36px;
    border: 2px solid currentColor;
    border-radius: 6px;
    position: relative;
    margin-bottom: 4px;
}

.file-upload-icon::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px;
    width: 10px;
    height: 10px;
    border: 2px solid currentColor;
    border-radius: 50%;
    box-sizing: border-box;
}

.file-upload-icon::after {
    content: '';
    position: absolute;
    right: 6px;
    bottom: 6px;
    width: 16px;
    height: 10px;
    border-left: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: skewX(-20deg);
}

.file-upload-title {
    font-size: 1.05rem;
    font-weight: 700;
}

.file-upload-sub {
    font-size: 0.85rem;
    opacity: 0.85;
}

.file-upload-name {
    margin-top: 4px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.85);
    font-size: 0.85rem;
    font-weight: 500;
    color: #444;
    max-width: 100%;
    word-break: break-all;
}

.file-upload-clear {
    display: inline-block;
    margin-top: 12px;
    padding: 8px 16px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    color: #555;
    font-size: 0.9rem;
    cursor: pointer;
}

.file-upload-clear:hover {
    border-color: var(--error-color);
    color: var(--error-color);
    background: #fff5f5;
}

.file-upload-clear[hidden] {
    display: none !important;
}

.file-upload .input-error + .file-upload-label,
.file-upload-input.input-error + .file-upload-label {
    border-color: var(--error-color);
    background: #fff5f5;
}

.form-info-note {
    margin: -8px 0 24px;
    padding: 12px 16px;
    background: #fff8e8;
    border-left: 4px solid #e6a800;
    color: #6a4b00;
    font-size: 0.95rem;
    font-weight: 500;
}

.conditional-field[hidden] {
    display: none !important;
}

.char-count {
    margin-top: 8px;
    font-size: 0.9rem;
    color: #555;
}

.char-count .char-count-status {
    margin-left: 8px;
    font-weight: 700;
}

.char-count.is-short .char-count-status,
.char-count.is-over .char-count-status {
    color: var(--error-color);
}

.char-count.is-ok {
    color: #2e7d32;
}

.draft-banner {
    background-color: #e8f5e9;
    border: 1px solid #c8e6c9;
    color: #1b5e20;
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.draft-hint {
    margin: 16px 0 8px;
    font-size: 0.85rem;
    color: #666;
    font-weight: normal;
}

.draft-toolbar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.draft-status {
    font-size: 0.85rem;
    color: #2e7d32;
    min-height: 1.2em;
}

.btn-text {
    background: none;
    border: none;
    color: #666;
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 4px 8px;
}

.btn-text:hover {
    color: var(--error-color);
}

/* ボタン */
.form-actions {
    text-align: center;
    margin-top: 40px;
}

.form-actions .btn {
    margin: 0 8px 8px;
}

.btn {
    display: inline-block;
    padding: 12px 40px;
    font-size: 1rem;
    font-weight: bold;
    text-align: center;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
}

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

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 86, 179, 0.4);
}

.btn-secondary {
    background-color: #ccc;
    color: #333;
    margin-right: 15px;
}

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

/* エラー表示 */
.error-banner {
    background-color: #ffebee;
    border: 1px solid #ffcdd2;
    color: #c62828;
    padding: 15px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.error-message {
    color: var(--error-color);
    font-size: 0.85rem;
    margin-top: 5px;
    display: block;
}

.input-error {
    border-color: var(--error-color) !important;
    background-color: #fff8f8;
}

/* モーダル */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    overflow: auto;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex; /* flexboxで中央寄せ */
}

.modal-content {
    background-color: #fff;
    width: 96%;
    max-width: 920px;
    border-radius: var(--radius);
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    animation: slideIn 0.3s ease-out;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fdfdfd;
    border-radius: var(--radius) var(--radius) 0 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--primary-color);
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #eee;
    text-align: center;
    background: #fdfdfd;
    border-radius: 0 0 var(--radius) var(--radius);
}

/* 確認画面のテーブル */
.confirm-table {
    width: 100%;
    border-collapse: collapse;
}

.confirm-table th, 
.confirm-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.confirm-table th {
    width: 30%;
    background-color: #fafafa;
    color: #666;
    font-weight: bold;
}

.confirm-lead {
    margin: 0 0 14px;
    font-size: 0.9rem;
    color: #555;
}

.print-card {
    border: none;
    border-radius: 0;
    padding: 8px 0;
    background: #fff;
    color: #222;
}

.print-card-top {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 16px;
    align-items: stretch;
    margin-bottom: 14px;
}

.print-card-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.print-card-facility {
    margin: 0 0 12px;
    font-size: 1.55rem;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: 0.02em;
}

.print-card-contact-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 12px;
}

.print-card-address {
    flex: 1;
    min-width: 0;
    font-size: 0.95rem;
    line-height: 1.55;
}

.print-card-address p {
    margin: 0 0 2px;
}

.print-card-url {
    word-break: break-all;
}

.print-card-url.muted {
    color: #999;
}

.print-card-qr {
    flex: 0 0 92px;
    width: 92px;
    height: 92px;
    border: 1px solid #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    overflow: hidden;
}

.print-card-qr canvas {
    width: 88px !important;
    height: 88px !important;
}

.print-card-qr-fallback {
    font-size: 0.7rem;
    color: #888;
    text-align: center;
    padding: 4px;
    line-height: 1.3;
}

.print-card-visit {
    border: none;
    padding: 8px 0;
    max-width: 280px;
    margin-top: auto;
}

.print-card-box-title {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.print-card-visit .print-card-box-title {
    text-align: left;
}

.print-card-box-body {
    font-size: 0.95rem;
    line-height: 1.5;
}

.print-card-photo-wrap {
    border: 1px solid #bbb;
    background: #f3f3f3;
    min-height: 220px;
    height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.print-card-photo {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.print-card-photo-empty {
    color: #888;
    font-size: 0.9rem;
    padding: 20px;
    text-align: center;
}

.print-card-feature {
    border: none;
    padding: 12px 0 0;
}

.print-card-feature .print-card-box-title {
    text-align: center;
    margin-bottom: 8px;
    font-size: 1rem;
}

.print-card-feature-body {
    font-size: 0.92rem;
    line-height: 1.7;
    white-space: normal;
}

.confirm-private {
    margin-top: 20px;
    padding-top: 12px;
    border-top: 1px dashed #ccc;
}

.confirm-private h4 {
    margin: 0 0 10px;
    font-size: 0.95rem;
    color: #444;
}

.confirm-private h4 span {
    font-weight: 400;
    color: #c62828;
    font-size: 0.85rem;
}

@media (max-width: 700px) {
    .print-card-top {
        grid-template-columns: 1fr;
    }

    .print-card-visit {
        max-width: none;
    }

    .print-card-photo-wrap {
        height: 220px;
        min-height: 220px;
    }
}

/* レスポンシブ */
@media (max-width: 600px) {
    .container {
        padding: 20px;
    }

    .confirm-table th,
    .confirm-table td {
        display: block;
        width: 100%;
    }
    
    .confirm-table th {
        background: none;
        padding-bottom: 4px;
        color: var(--primary-color);
    }
    
    .confirm-table td {
        padding-top: 0;
        border-bottom: none;
        margin-bottom: 15px;
    }

    .modal-content {
        width: 95%;
    }
}

@keyframes slideIn {
    from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
