/* 全体のスタイル */
body {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    margin: 0;
    padding: 0;
    background-color: #f9f9f9;
}

header {
    background-color: #4285f4;
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content h1 {
    margin: 0;
    font-size: 1.5rem;
}

.header-info {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    font-size: 0.85rem;
}

.header-info .version {
    background-color: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
}

.header-info .company {
    opacity: 0.9;
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* セクションのスタイル */
.section {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
    padding: 1.5rem;
}

.section h2 {
    margin-top: 0;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
    display: flex;
    align-items: center;
}

.section-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background-color: #4285f4;
    color: white;
    border-radius: 50%;
    margin-right: 10px;
    font-size: 0.9rem;
}

/* フォームのスタイル */
.form-container {
    padding: 1rem 0;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #4285f4;
    outline: none;
    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.2);
}

.help-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.85rem;
    color: #666;
}

.required {
    color: #d93025;
    margin-left: 2px;
}

/* ボタンのスタイル */
.primary-button {
    background-color: #4285f4;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.primary-button:hover {
    background-color: #3367d6;
}

.primary-button:disabled {
    background-color: #a8c7fa;
    cursor: not-allowed;
}

.primary-button.update-mode {
    background-color: #34a853;
}

.primary-button.update-mode:hover {
    background-color: #2d8f47;
}

.secondary-button {
    background-color: #fff;
    color: #4285f4;
    border: 1px solid #4285f4;
    border-radius: 4px;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.secondary-button:hover {
    background-color: #4285f4;
    color: white;
}

/* ボタングループ */
.button-group {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

/* 結果表示エリアのスタイル */
.result-section {
    background-color: #f5f5f5;
    border-left: 4px solid #4285f4;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    border-bottom: 1px solid #ddd;
    padding-bottom: 0.5rem;
}

.result-header h2 {
    margin: 0;
    border: none;
    padding: 0;
}

.result-content {
    max-height: 600px;
    overflow-y: auto;
}

.result-section h3 {
    margin-top: 0;
    color: #333;
}

.result-section pre {
    background-color: white;
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    margin: 0.5rem 0;
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* 履歴エントリのスタイル */
.history-entry {
    background-color: white;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
    border-left: 4px solid #4285f4;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.history-entry.history-success {
    border-left-color: #34a853;
}

.history-entry.history-error {
    border-left-color: #d93025;
}

.history-entry.history-info {
    border-left-color: #4285f4;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

.history-title {
    font-weight: bold;
    font-size: 1rem;
    color: #333;
}

.history-time {
    font-size: 0.8rem;
    color: #666;
    background-color: #f0f0f0;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.history-content {
    font-size: 0.9rem;
}

.history-content p {
    margin: 0.5rem 0;
}

.history-content ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.history-content details {
    margin-top: 0.75rem;
}

.history-content summary {
    cursor: pointer;
    color: #4285f4;
    font-size: 0.85rem;
    padding: 0.25rem 0;
}

.history-content summary:hover {
    text-decoration: underline;
}

/* 小さいボタン */
.secondary-button.small {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

/* フォームセクションのスタイル */
.form-section {
    margin-bottom: 1.5rem;
    border: 1px solid #eee;
    border-radius: 4px;
    padding: 1rem;
}

.form-section-title {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: #333;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

/* ポップアップメッセージのスタイル */
.popup {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px 20px;
    background-color: #4caf50;
    color: white;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s, transform 0.3s;
}

.popup.error {
    background-color: #d93025;
}

.popup.show {
    opacity: 1;
    transform: translateY(0);
}

/* 操作モード選択のスタイル */
.mode-selector {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

.mode-option {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.mode-option:hover {
    border-color: #4285f4;
    background-color: #f8faff;
}

.mode-option input[type="radio"] {
    width: auto;
    margin-bottom: 0.5rem;
}

.mode-option input[type="radio"]:checked + .mode-label {
    color: #4285f4;
    font-weight: bold;
}

.mode-option:has(input[type="radio"]:checked) {
    border-color: #4285f4;
    background-color: #e8f0fe;
}

.mode-label {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.mode-option small {
    color: #666;
    font-size: 0.85rem;
}

/* 新規登録専用フィールド（更新モード時に非表示） */
.new-only.disabled-field {
    opacity: 0.5;
    pointer-events: none;
}

/* セレクトボックスのスタイル */
select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23333' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

/* 来場者データ取得セクションのスタイル */
.visitor-data-result {
    margin-top: 1.5rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.visitor-data-result h3 {
    margin: 0;
    padding: 1rem;
    background-color: #f5f5f5;
    border-bottom: 1px solid #ddd;
}

.visitor-data-content {
    padding: 1rem;
    max-height: 500px;
    overflow-y: auto;
}

.visitor-card {
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.visitor-card:last-child {
    margin-bottom: 0;
}

.visitor-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #ddd;
    margin-bottom: 0.75rem;
}

.visitor-card-header h4 {
    margin: 0;
    color: #333;
}

.visitor-card-header .visitor-id {
    background-color: #4285f4;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
}

.visitor-card-body {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 0.5rem;
}

.visitor-field {
    display: flex;
    padding: 0.25rem 0;
}

.visitor-field-label {
    font-weight: bold;
    color: #666;
    min-width: 120px;
    font-size: 0.85rem;
}

.visitor-field-value {
    color: #333;
    font-size: 0.9rem;
    word-break: break-all;
}

.visitor-raw-data {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px dashed #ddd;
}

.visitor-raw-data summary {
    cursor: pointer;
    color: #4285f4;
    font-size: 0.85rem;
}

.visitor-raw-data pre {
    background-color: #f0f0f0;
    padding: 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    overflow-x: auto;
    margin-top: 0.5rem;
}

/* CSV一括更新セクションのスタイル */
.csv-upload-area {
    background-color: #f8f9fa;
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 1rem;
}

.csv-upload-area:hover {
    border-color: #4285f4;
    background-color: #f0f7ff;
}

.file-input {
    padding: 0.75rem;
    background-color: white;
    cursor: pointer;
}

.csv-preview {
    margin-top: 1.5rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
}

.csv-preview h3 {
    margin: 0;
    padding: 1rem;
    background-color: #f5f5f5;
    border-bottom: 1px solid #ddd;
}

.csv-info {
    display: flex;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background-color: #e8f0fe;
    font-size: 0.9rem;
}

.csv-info span {
    background-color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
}

.csv-table-wrapper {
    max-height: 400px;
    overflow: auto;
}

.csv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.csv-table th,
.csv-table td {
    padding: 0.5rem 0.75rem;
    border: 1px solid #ddd;
    text-align: left;
    white-space: nowrap;
}

.csv-table th {
    background-color: #4285f4;
    color: white;
    position: sticky;
    top: 0;
    z-index: 1;
}

.csv-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.csv-table tr:hover {
    background-color: #e8f0fe;
}

.csv-table tr.row-success {
    background-color: #d4edda;
}

.csv-table tr.row-error {
    background-color: #f8d7da;
}

.csv-table tr.row-skip {
    background-color: #fff3cd;
}

.csv-table tr.row-processing {
    background-color: #cce5ff;
}

/* 一括更新コントロール */
.batch-controls {
    margin-top: 1.5rem;
    padding: 1.5rem;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.batch-settings {
    margin-bottom: 1rem;
}

.batch-settings .form-group {
    max-width: 300px;
}

/* 進捗表示 */
.batch-progress {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: white;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

.progress-bar-container {
    width: 100%;
    height: 24px;
    background-color: #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4285f4, #34a853);
    border-radius: 12px;
    transition: width 0.3s ease;
}

.progress-stats {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
}

.progress-stats .stat {
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: bold;
}

.progress-stats .stat.success {
    background-color: #d4edda;
    color: #155724;
}

.progress-stats .stat.error {
    background-color: #f8d7da;
    color: #721c24;
}

.progress-stats .stat.skip {
    background-color: #fff3cd;
    color: #856404;
}

/* 停止ボタン */
#stopBatchUpdate {
    background-color: #fff;
    color: #d93025;
    border-color: #d93025;
}

#stopBatchUpdate:hover:not(:disabled) {
    background-color: #d93025;
    color: white;
}

#stopBatchUpdate:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* サンプルCSVダウンロードリンク */
#downloadSampleCsv {
    color: #4285f4;
    text-decoration: none;
}

#downloadSampleCsv:hover {
    text-decoration: underline;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    main {
        padding: 1rem;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .primary-button,
    .secondary-button {
        width: 100%;
    }

    .button-group {
        flex-direction: column;
    }

    .mode-selector {
        flex-direction: column;
    }

    .csv-info {
        flex-direction: column;
        gap: 0.5rem;
    }

    .progress-stats {
        flex-direction: column;
        gap: 0.5rem;
    }

    .csv-table-wrapper {
        max-height: 300px;
    }
}