/**
 * Customize Styles
 * カスタマイズ用スタイル（QRカメラ機能 + 応募確認ボタン）
 */

/* ========================================
   ユーティリティクラス
   ======================================== */

/* メッセージ表示用dd要素のborderを無効化 */
.app_form__dl div > dd.no-border {
    border: none !important;
    padding: 0 !important;
}

/* ========================================
   ボタンスタイル（共通）
   ======================================== */

/* QRカメラボタン */
.qr-camera-btn {
    display: inline-block;
    margin-left: 10px;
    padding: 8px 16px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    vertical-align: middle;
}

.qr-camera-btn:hover {
    background-color: #0056b3;
}

.qr-camera-btn:active {
    background-color: #004085;
}

.qr-camera-btn i {
    margin-right: 5px;
}

/* 応募確認ボタン */
.check-entry-btn {
    display: inline-block;
    margin-left: 10px;
    padding: 8px 16px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    vertical-align: middle;
}

.check-entry-btn:hover {
    background-color: #218838;
}

.check-entry-btn:active {
    background-color: #1e7e34;
}

/* ========================================
   入力フィールドとボタンの配置（非破壊的）
   ======================================== */

/* input + button の横並びレイアウト用クラス */
.input-with-button {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.input-with-button input {
    flex: 1;
    min-width: 200px;
}

.input-with-button .qr-camera-btn,
.input-with-button .check-entry-btn {
    flex-shrink: 0;
}

/* ========================================
   QRカメラモーダル
   ======================================== */

/* モーダルオーバーレイ */
.qr-camera-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-camera-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
}

/* モーダルコンテンツ */
.qr-camera-modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    text-align: center;
    z-index: 100000;
}

.qr-camera-modal-content h3 {
    margin: 0 0 20px 0;
    font-size: 20px;
    color: #333;
}

/* 閉じるボタン */
.qr-camera-close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 36px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    transition: color 0.3s ease;
}

.qr-camera-close:hover {
    color: #333;
}

/* ビデオコンテナ */
.qr-camera-video-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto 20px;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
}

.qr-camera-video-container video {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

/* QRコードフレーム（ガイド） */
.qr-camera-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    height: 60%;
    border: 3px solid rgba(0, 255, 0, 0.5);
    border-radius: 8px;
    pointer-events: none;
}

.qr-camera-frame::before,
.qr-camera-frame::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 3px solid #00ff00;
}

.qr-camera-frame::before {
    top: -3px;
    left: -3px;
    border-right: none;
    border-bottom: none;
}

.qr-camera-frame::after {
    bottom: -3px;
    right: -3px;
    border-left: none;
    border-top: none;
}

/* ステータス表示 */
.qr-camera-status {
    margin: 15px 0;
    min-height: 30px;
}

.qr-camera-scanning {
    color: #007bff;
    font-size: 16px;
    font-weight: bold;
    margin: 0;
}

.qr-camera-error {
    color: #dc3545;
    background: #f8d7da;
    padding: 12px;
    border-radius: 6px;
    font-size: 14px;
    margin: 10px 0;
    border: 1px solid #f5c6cb;
}

/* 手動入力ボタン */
.qr-camera-manual-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.qr-camera-manual-btn:hover {
    background: #5a6268;
}

/* 読み取り成功時のエフェクト */
.qr-camera-success {
    border: 5px solid #28a745 !important;
    box-shadow: 0 0 20px rgba(40, 167, 69, 0.5);
}

/* ローディングスピナー */
.qr-camera-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(0, 123, 255, 0.3);
    border-top-color: #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

/* ========================================
   アニメーション
   ======================================== */

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

.qr-camera-scanning {
    animation: pulse 1.5s ease-in-out infinite;
}

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

/* ========================================
   レスポンシブ対応
   ======================================== */

@media (max-width: 768px) {
    .qr-camera-modal-content {
        width: 95%;
        padding: 20px;
        max-height: 95vh;
    }

    .qr-camera-modal-content h3 {
        font-size: 18px;
        margin-bottom: 15px;
    }

    .qr-camera-btn,
    .check-entry-btn {
        display: block;
        margin: 10px 0;
        width: 100%;
    }

    .qr-camera-video-container {
        margin-bottom: 15px;
    }

    .qr-camera-close {
        font-size: 30px;
    }
}

@media (max-width: 480px) {
    .input-with-button {
        display: block;
    }

    .input-with-button input {
        width: 100%;
        margin-bottom: 10px;
    }

    .input-with-button .qr-camera-btn,
    .input-with-button .check-entry-btn {
        width: 100%;
        margin-left: 0;
    }
}

/* スマートフォン横向き */
@media (max-width: 768px) and (orientation: landscape) {
    .qr-camera-modal-content {
        max-width: 90%;
        max-height: 95vh;
        overflow-y: auto;
    }

    .qr-camera-video-container {
        max-width: 400px;
    }
}

/* 一括スキャンモード用スタイル */
.qr-camera-batch-modal .qr-camera-guide {
    color: #666;
    font-size: 14px;
    margin: 0 0 15px 0;
}

.qr-camera-batch-modal .qr-camera-counter {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    padding: 10px 15px;
    margin: 0 0 15px 0;
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.qr-camera-batch-modal .qr-camera-counter-current {
    color: #28a745;
    font-size: 22px;
}

.qr-camera-batch-modal .qr-camera-counter-total {
    color: #6c757d;
}

/* 完了ボタン */
.qr-camera-complete-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 12px 40px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease;
    width: 100%;
    max-width: 300px;
    margin: 10px auto;
    display: block;
}

.qr-camera-complete-btn:hover {
    background: #218838;
}

.qr-camera-complete-btn:active {
    background: #1e7e34;
}

/* ボーダーなしdd */
dd.no-border {
    border: none !important;
}

/* 一括読み取りボタン */
.qr-camera-batch-btn {
    margin-left: 0 !important;
}
