/* リセットCSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* セキュリティ関連CSS */
::selection {
    background-color: #007acc;
    color: white;
}

::-moz-selection {
    background-color: #007acc;
    color: white;
}

/* アクセシビリティ対応 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

body {
    font-family: 'Helvetica Neue', Arial, 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* コンテナ */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background-color: #fff;
    min-height: 100vh;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

/* ヘッダー */
.header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 2px solid #007acc;
}

.title {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
    line-height: 1.4;
}

.event-title {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
    line-height: 1.4;
}

.event-date {
    font-size: 18px;
    color: #666;
    font-weight: 500;
}

/* 共通 */
.card {
    background-color: #fff;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1),
                0 4px 6px -2px rgba(0,0,0,0.05);
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid #e9ecef;
}

/* アイコンを囲む四角ボックス */
.icon-box {
    width: 2.5rem;
    height: 2.5rem;
    background-color: #dbeafe;
    border: none;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: 0.75rem;
}

.icon-box svg {
    width: 1.25rem;
    height: 1.25rem;
    color: #2563eb;
}

/* エラーアイコン */
.error-icon {
    background-color: #fee2e2;
}

.error-icon svg {
    color: #dc2626;
}

/* ローディングアイコン */
.loading-icon {
    background-color: #dbeafe;
    animation: pulse 2s infinite;
}

.loading-icon svg {
    color: #2563eb;
    animation: spin 1s linear infinite;
}

/* 警告アイコン */
.warning-icon {
    background-color: #fef3c7;
}

.warning-icon svg {
    color: #f59e0b;
}

/* エラーアイコン2 */
.warning-icon2 svg {
    color: #dc3545 ;
}

/* 情報アイコン */
.info-icon {
    background-color: #dbeafe;
}

.info-icon svg {
    color: #2563eb;
}

/* 情報アイコン2 */
.info-icon2 {
    background-color: #ffeeb9;
}

.info-icon2 svg {
    color: #ffc107;
}

/* セキュリティアイコン */
.security-icon {
    background-color: #d1fae5;
}

.security-icon svg {
    color: #059669;
}

/* お問い合わせアイコン */
.contact-icon {
    background-color: #dbeafe;
}

.contact-icon svg {
    color: #2563eb;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* イベント詳細 */
.event-card .detail-item {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.event-card .detail-item:last-child {
    margin-bottom: 0;
}

.detail-content {
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.detail-text {
    font-size: 1.125rem;
    font-weight: 600;
}

/* 入力フォーム */
.form-card {
    position: relative;
}

.application-form {
    margin: 0;
}

.form-title {
    font-size: 22px;
    font-weight: bold;
    color: #333;
    margin-bottom: 25px;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.form-group {
    margin-bottom: 20px;
}

.label {
    display: block;
    font-weight: bold;
    margin-bottom: 8px;
    color: #333;
}

.label.required::after {
    content: " *";
    color: #e74c3c;
    font-weight: bold;
}

/* 氏名・フリガナフィールドの横並び */
.name-fields {
    display: flex;
    gap: 15px;
}

.name-field {
    flex: 1;
}

.name-field .input-field {
    width: 100%;
}

.input-field {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background-color: #fff;
}

.input-field:focus {
    outline: none;
    border-color: #007acc;
    box-shadow: 0 0 5px rgba(0, 122, 204, 0.3);
}

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

.input-field:disabled {
    background-color: #f8f9fa;
    cursor: not-allowed;
    opacity: 0.6;
}

/* 文字数カウント */
.char-count {
    font-size: 12px;
    color: #666;
    text-align: right;
    margin-top: 5px;
    transition: color 0.3s ease;
}

.char-count.warning {
    color: #ff6b35;
    font-weight: bold;
}

.char-count.danger {
    color: #e74c3c;
    font-weight: bold;
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    75% { transform: translateX(3px); }
}

/* 同意セクション */
.consent-section {
    margin: 30px 0;
    padding: 25px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.consent-group {
    margin-bottom: 25px;
}

.consent-group:last-child {
    margin-bottom: 0;
}

.consent-text {
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 15px;
    color: #555;
}

.privacy-link {
    color: #007acc;
    text-decoration: none;
    transition: color 0.3s ease;
}

.privacy-link:hover {
    color: #005a99;
    text-decoration: underline;
}

.privacy-link:focus {
    outline: 2px solid #007acc;
    outline-offset: 2px;
}

.radio-group {
    display: flex;
    gap: 20px;
    margin-bottom: 8px;
}

.radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 16px;
    transition: color 0.3s ease;
}

.radio-label:hover {
    color: #007acc;
}

.radio-label input[type="radio"] {
    margin-right: 8px;
    transform: scale(1.2);
    cursor: pointer;
}

.radio-label input[type="radio"]:focus {
    outline: 2px solid #007acc;
    outline-offset: 2px;
}

.radio-text {
    user-select: none;
}

.required-mark {
    color: #e74c3c;
    font-weight: bold;
    font-size: 14px;
}

/* エラーメッセージ */
.error-messages {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    color: #991b1b;
    animation: slideDown 0.3s ease-out;
}

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

.error-content {
    display: flex;
    flex-direction: column;
}

.error-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.error-content h4 {
    margin: 0;
    font-size: 16px;
    font-weight: bold;
}

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

.error-content li {
    margin-bottom: 8px;
    line-height: 1.5;
}

/* セキュリティ警告 */
.security-warning {
    background-color: #fef3c7;
    border: 2px solid #f59e0b;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    color: #92400e;
    animation: slideDown 0.3s ease-out;
}

.security-warning .warning-content {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.security-warning .warning-text h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: bold;
    color: #92400e;
}

.security-warning .warning-text p {
    margin: 0;
    line-height: 1.5;
}

/* アクセス警告 */
.access-warning {
    background-color: #fef2f2;
    border: 2px solid #dc3545;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    color: #721c24;
    animation: slideDown 0.3s ease-out;
}

.access-warning .warning-content {
    display: flex;
    align-items: flex-start;
    text-align: left;
    gap: 15px;
}

.access-warning .warning-text h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: bold;
    color: #721c24;
}

.access-warning .warning-text p {
    margin: 0;
    line-height: 1.5;
}

/* 送信中メッセージ */
.loading-message {
    background-color: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    color: #1e40af;
    animation: slideDown 0.3s ease-out;
}

.loading-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.loading-content p {
    margin: 0;
    font-weight: bold;
    font-size: 16px;
}

/* ボタン */
.submit-section {
    text-align: center;
    margin: 30px 0 0 0;
}

.submit-button {
    background-color: #007acc;
    color: white;
    padding: 15px 40px;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
    min-width: 250px;
}

.submit-button:hover:not(:disabled) {
    background-color: #005a99;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 122, 204, 0.3);
}

.submit-button:focus {
    outline: 2px solid #007acc;
    outline-offset: 2px;
}

.submit-button:disabled {
    background-color: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.7;
}

.back-button {
    background-color: #6c757d;
    color: white;
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    margin-right: 15px;
}

.back-button:hover:not(:disabled) {
    background-color: #545b62;
    transform: translateY(-1px);
}

.back-button:focus {
    outline: 2px solid #6c757d;
    outline-offset: 2px;
}

.back-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* お問い合わせ */
.contact-card {
    background-color: #fff;
}

.contact-title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
}

.contact-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.contact-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.contact-label {
    font-weight: bold;
    min-width: 80px;
    color: #374151;
    font-size: 14px;
}

.contact-value {
    flex: 1;
    color: #555;
    line-height: 1.5;
}

.contact-value a {
    color: #007acc;
    text-decoration: none;
    transition: color 0.3s ease;
}

.contact-value a:hover {
    color: #005a99;
    text-decoration: underline;
}

.contact-value a:focus {
    outline: 2px solid #007acc;
    outline-offset: 2px;
}

/* 委託先情報 */
.delegation-info {
    text-align: center;
    margin-top: 30px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.delegation-info p {
    margin: 0;
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

/* 確認ページ */
.confirm-section {
    margin-bottom: 40px;
}

.confirm-message {
    font-size: 16px;
    margin-bottom: 25px;
    color: #555;
    text-align: center;
}

.confirm-details {
    background-color: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    margin-bottom: 30px;
}

.confirm-details .confirm-label {
    font-weight: bold;
    min-width: 265px;
    width: 265px;
    color: #333;
    flex-shrink: 0;
}

.confirm-item {
    display: flex;
    padding: 12px 0;
    border-bottom: 1px solid #ddd;
    align-items: flex-start;
}

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

.confirm-label {
    font-weight: bold;
    min-width: 200px;
    color: #333;
}

.confirm-value {
    flex: 1;
    color: #555;
    word-break: break-word;
}

.confirm-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

/* 成功通知 */
.success-notification {
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideDown 0.3s ease-out;
}

.success-icon svg {
    flex-shrink: 0;
}

.success-text {
    color: #155724;
    font-weight: bold;
    margin: 0;
}

/* 重要なお知らせ */
.important-notes {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

.important-notes .notes-title {
    color: #856404;
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 15px;
}

.important-notes .notes-content ul {
    margin: 0;
    padding-left: 20px;
    color: #856404;
}

.important-notes .notes-content li {
    margin-bottom: 8px;
}

/* 完了ページ */

/* メール送信警告 */
.mail-warning {
    background-color: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    animation: slideDown 0.3s ease-out;
}

.warning-content {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.warning-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
}

.warning-text h4 {
    color: #92400e;
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: bold;
}

.warning-text p {
    color: #92400e;
    margin: 0;
    line-height: 1.5;
}

.completion-section {
    text-align: center;
    margin-bottom: 40px;
}

.completion-icon {
    margin-bottom: 25px;
    animation: bounceIn 0.6s ease-out;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% { transform: scale(0.9); }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.completion-title {
    font-size: 24px;
    font-weight: bold;
    color: #28a745;
    margin-bottom: 25px;
    animation: fadeInUp 0.6s ease-out 0.3s both;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.completion-content {
    animation: fadeInUp 0.6s ease-out 0.6s both;
}

.completion-message {
    font-size: 16px;
    line-height: 1.8;
    margin-bottom: 30px;
    color: #555;
}

.completion-message p {
    margin-bottom: 10px;
}

.completion-notes {
    background-color: #fff3cd;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    border-left: 4px solid #ffc107;
    text-align: left;
}

.notes-title {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
}

.notes-list {
    list-style-type: disc;
    text-align: left;
    padding-left: 20px;
    margin: 0;
}

.notes-list li {
    margin-bottom: 8px;
    color: #555;
    line-height: 1.5;
}

.back-to-top {
    margin-top: 30px;
}

/* フォーカス表示の改善 */
*:focus-visible {
    outline: 2px solid #007acc;
    outline-offset: 2px;
}

/* テキストフィールドのフォーカス表示 */
.input-field:focus {
    outline: none;
    border-color: #007acc;
    box-shadow: 0 0 5px rgba(0, 122, 204, 0.3);
    position: relative;
}

.input-field:focus::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border: 2px solid #007acc;
    border-radius: 7px;
    pointer-events: none;
}

/* ボタンのフォーカス表示 */
.submit-button:focus,
.back-button:focus {
    outline: 2px solid #007acc;
    outline-offset: 2px;
}

/* ハイコントラスト対応 */
@media (prefers-contrast: high) {
    .input-field {
        border-width: 3px;
    }

    .submit-button,
    .back-button {
        border: 2px solid transparent;
    }

    .submit-button:focus,
    .back-button:focus {
        border-color: #fff;
    }
}

/* ダークモード対応（将来の拡張用） */
@media (prefers-color-scheme: dark) {
    /* ダークモード時のスタイルを必要に応じて追加 */
}

/* 印刷対応 */
@media print {
    .submit-button,
    .back-button,
    .loading-message,
    .error-messages {
        display: none !important;
    }

    .container {
        box-shadow: none;
        background: white;
    }

    .card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .title,
    .event-title {
        font-size: 20px;
    }

    .event-date {
        font-size: 16px;
    }

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

    /* 氏名・フリガナフィールドをモバイルで縦並びに */
    .name-fields {
        flex-direction: column;
        gap: 15px;
    }

    .confirm-item {
        flex-direction: column;
        gap: 5px;
    }

    .confirm-label {
        min-width: auto;
        margin-bottom: 5px;
        font-size: 14px;
    }

    .confirm-buttons {
        flex-direction: column;
        align-items: center;
    }

    .back-button {
        margin-right: 0;
        margin-bottom: 10px;
        width: 100%;
        max-width: 250px;
    }

    .submit-button {
        min-width: 200px;
        width: 100%;
        max-width: 250px;
    }

    .success-notification {
        flex-direction: column;
        text-align: center;
    }

    .error-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .loading-content {
        flex-direction: column;
        gap: 10px;
    }

    .contact-item {
        flex-direction: column;
        gap: 5px;
    }

    .contact-label {
        min-width: auto;
    }

    .warning-content {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 10px;
    }

    .warning-icon {
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    .consent-section {
        padding: 15px;
    }

    .confirm-details {
        padding: 15px;
    }

    .completion-notes,
    .completion-security {
        padding: 15px;
    }

    .important-notes {
        padding: 15px;
    }

    .card {
        padding: 1rem;
    }

    .error-messages,
    .loading-message,
    .security-warning,
    .access-warning {
        padding: 15px;
    }

    .form-title {
        font-size: 18px;
    }

    .completion-title {
        font-size: 20px;
    }

    .input-field {
        font-size: 16px; /* iOS Safari でのズーム防止 */
    }

    .delegation-info {
        padding: 10px;
        margin-top: 20px;
    }
}

/* 極小画面対応 */
@media (max-width: 320px) {
    .container {
        padding: 5px;
    }

    .card {
        padding: 0.5rem;
    }

    .submit-button,
    .back-button {
        font-size: 14px;
        padding: 12px 20px;
    }
}

/* 大画面対応 */
@media (min-width: 1200px) {
    .container {
        max-width: 900px;
    }

    .confirm-details .confirm-label {
        min-width: 300px;
        width: 300px;
    }
}