* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

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

.header-with-help {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    position: relative;
    width: 100%;
    min-height: 50px;
}

.header-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-right: 50px; /* ヘルプボタンのスペースを確保 */
}

.status-indicator {
    display: flex;
    gap: 20px;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 600;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-label {
    color: #666;
}

.status-value {
    color: #333;
    font-weight: bold;
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 4px;
    min-width: 20px;
    text-align: center;
}

h1 {
    color: #333;
    text-align: center;
    margin-bottom: 8px;
    font-size: 28px;
    margin-top: 0;
    padding-right: 0;
}


.help-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    position: absolute;
    right: 0;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
    line-height: 1;
}

.help-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #5568d3 0%, #653a8f 100%);
}

.help-button:active {
    transform: scale(0.95);
}

.system-notice {
    text-align: center;
    color: #e74c3c;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 30px;
    padding: 10px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 5px;
}

.notice-box {
    width: 100%;
    margin-bottom: 15px;
    padding: 12px 15px;
    background: #e8f4f8;
    border: 1px solid #3498db;
    border-radius: 5px;
    border-left: 4px solid #3498db;
}

.notice-text {
    color: #2c3e50;
    font-size: 13px;
    line-height: 1.6;
    margin: 0;
}

.notice-text strong {
    color: #2980b9;
    font-weight: 600;
}

.form-group {
    margin-bottom: 30px;
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

label {
    display: block;
    min-width: 120px;
    padding-top: 10px;
    color: #555;
    font-weight: 500;
    font-size: 14px;
    flex-shrink: 0;
}

.form-group > label {
    margin-bottom: 0;
}

.input-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.required {
    color: #e74c3c;
    margin-left: 4px;
}

input[type="text"],
input[type="email"],
input[type="password"],
select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    line-height: 1.4;
    min-height: 42px;
    transition: border-color 0.3s;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
select:focus {
    outline: none;
    border-color: #667eea;
}

input:invalid {
    border-color: #e74c3c;
}

input:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.6;
}

input:disabled::placeholder {
    color: #999;
}

.radio-group {
    display: flex;
    gap: 20px;
    flex: 1;
    padding-top: 8px;
}

.radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: normal;
    font-size: 16px;
}

.radio-label input[type="radio"] {
    width: auto;
    margin-right: 8px;
    cursor: pointer;
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
}

.radio-label input[type="radio"]:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* ターミナル選択のP2を赤色に */
input[name="terminal"][value="P2"] + span strong {
    color: #e74c3c;
}

/* ターミナル選択のP3を水色に近い青色に */
input[name="terminal"][value="P3"] + span strong {
    color: #3498db;
}

.vehicle-number-group {
    display: grid;
    grid-template-columns: 1.2fr 1.2fr 1fr 1.5fr;
    gap: 10px;
    flex: 1;
}

.vehicle-input {
    width: 100%;
    font-size: 12px;
    padding: 12px 6px;
    box-sizing: border-box;
    overflow: visible;
    white-space: nowrap;
    text-align: center;
}

.region-search-wrapper {
    position: relative;
    width: 100%;
}

.region-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 500px;
    width: max-content;
    max-width: 800px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 5px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    margin-top: 2px;
}

.region-dropdown.show {
    display: block;
}

.region-dropdown .prefecture-group {
    border-bottom: 1px solid #eee;
}

.region-dropdown .region-items-container {
    display: flex;
    flex-wrap: wrap;
    padding: 4px 20px 8px 20px;
    gap: 6px;
}

.region-dropdown .prefecture-header {
    padding: 10px 16px;
    background: #f5f5f5;
    font-weight: bold;
    font-size: 16px;
    color: #333;
    cursor: default;
}

.region-dropdown .region-item {
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    color: #555;
    line-height: 1.4;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    background: #fafafa;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.region-dropdown .region-item:hover {
    background: #e8f4f8;
    border-color: #667eea;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.region-dropdown .region-item.selected {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.region-dropdown .prefecture-subheader {
    padding: 8px 24px !important;
    font-weight: 600;
    color: #666;
    font-size: 14px !important;
}

/* ダイアログスタイル */
.dialog-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    justify-content: center;
    align-items: center;
}

.dialog-overlay.show {
    display: flex;
}

.dialog-content {
    background: white;
    border-radius: 10px;
    padding: 30px;
    min-width: 400px;
    max-width: 500px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: dialogFadeIn 0.3s ease;
}

@keyframes dialogFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.dialog-message {
    font-size: 18px;
    color: #333;
    text-align: center;
    margin-bottom: 30px;
    line-height: 1.6;
}

.dialog-buttons {
    display: flex;
    justify-content: space-between;
    gap: 15px;
}

.dialog-btn {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.dialog-btn-ok {
    background: #667eea;
    color: white;
}

.dialog-btn-ok:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.dialog-btn-cancel {
    background: #e0e0e0;
    color: #333;
}

.dialog-btn-cancel:hover {
    background: #d0d0d0;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.error-message {
    display: block;
    color: #e74c3c;
    font-size: 12px;
    margin-top: 5px;
    min-height: 18px;
}

.input-wrapper .error-message {
    margin-left: 0;
    margin-top: 5px;
}

button[type="submit"] {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

button[type="submit"]:active {
    transform: translateY(0);
}

button[type="submit"]:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.message {
    margin-top: 20px;
    padding: 15px;
    border-radius: 5px;
    display: none;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

/* カレンダーのスタイル調整 */
.flatpickr-calendar {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* カレンダーの年と月のフォントサイズを調整 */
.flatpickr-current-month {
    font-size: 13px !important;
    padding: 4px 0 !important;
}

.flatpickr-current-month .flatpickr-monthDropdown-months {
    font-size: 13px !important;
}

.flatpickr-current-month .numInputWrapper {
    font-size: 13px !important;
}

.flatpickr-current-month .numInputWrapper input {
    font-size: 13px !important;
    padding: 2px 4px !important;
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    .form-group {
        flex-direction: column;
        gap: 8px;
    }

    label {
        min-width: auto;
        padding-top: 0;
    }

    .input-wrapper {
        width: 100%;
    }

    .input-wrapper .error-message {
        margin-left: 0;
    }

    .vehicle-number-group {
        grid-template-columns: 1fr;
    }

    .radio-group {
        flex-direction: column;
        gap: 10px;
        padding-top: 0;
    }
}

