/* モバイル専用CSS - AI面接システム */

/* モバイルデバイス対応（768px以下） */
@media screen and (max-width: 768px) {
    /* 強制的にモバイルレイアウトを適用 */
    body {
        font-size: 16px;
    }
    /* 基本レイアウト */
    .main-container {
        flex-direction: column;
        height: 100vh;
        height: 100dvh;
    }

    /* ヘッダーツールバー - モバイル最適化 */
    .header-toolbar {
        padding: 8px 12px;
        height: 50px;
        font-size: 13px;
    }

    .app-title {
        font-size: 14px;
        gap: 6px;
    }

    .header-right {
        gap: 12px;
        font-size: 12px;
    }

    .timer {
        font-size: 14px;
    }

    .progress-info {
        font-size: 12px;
    }

    /* メインコンテンツエリア */
    .content-area {
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        margin-top: 50px !important;
        height: calc(100vh - 50px) !important;
        height: calc(100dvh - 50px) !important;
    }

    /* メインビデオコンテナ - 全画面表示 */
    .main-video-container {
        flex: 1 !important;
        position: relative !important;
        background: #000 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    /* メインビデオパネル - フルスクリーン */
    .main-video-panel {
        width: 100% !important;
        height: 100% !important;
        position: relative !important;
        background: #000 !important;
    }

    /* 候補者ビデオ - フルスクリーン */
    .candidate-video {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        background: #000 !important;
    }

    /* カメラプレースホルダー - フルスクリーン */
    .camera-placeholder {
        width: 100% !important;
        height: 100% !important;
        background: #000 !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        color: var(--text-secondary) !important;
        font-size: 16px !important;
        gap: 12px !important;
    }

    .camera-placeholder i {
        font-size: 48px;
        color: var(--text-secondary);
    }

    /* PIP面接官ビデオ - 右上配置 */
    .pip-video-panel {
        position: absolute;
        top: 20px;
        right: 20px;
        width: 80px;
        height: 80px;
        border-radius: 50%;
        overflow: hidden;
        border: none;
        background: var(--bg-secondary);
        z-index: 5;
    }

    /* モバイルではロゴ動画を非表示 */
    .interviewer-video {
        display: none !important;
    }

    /* モバイルではロゴ画像のみ表示 */
    .interviewer-image {
        display: block !important;
        width: 100%;
        height: 100%;
        object-fit: contain;
        border-radius: 50%;
    }

    /* ビデオコントロールオーバーレイ */
    .video-controls-overlay {
        position: absolute;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 12px;
        z-index: 6;
    }

    /* 参加者情報 */
    .participant-info {
        background: rgba(0, 0, 0, 0.7);
        padding: 6px 12px;
        border-radius: 16px;
        font-size: 12px;
        color: var(--text-primary);
        backdrop-filter: blur(10px);
    }

    /* コントロールボタン */
    .control-buttons {
        display: flex;
        gap: 16px;
    }

    .control-btn {
        width: 48px;
        height: 48px;
        border-radius: 50%;
        border: none;
        background: rgba(0, 0, 0, 0.7);
        color: var(--text-primary);
        font-size: 20px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.2s ease;
        backdrop-filter: blur(10px);
    }

    .control-btn:hover,
    .control-btn:active {
        background: rgba(0, 0, 0, 0.9);
        transform: scale(1.1);
    }

    .control-btn.camera-off,
    .control-btn.mic-off {
        background: var(--accent-red);
        color: white;
    }

    /* チャットエリア - 非表示（モバイルでは吹き出し表示） */
    .sidebar-chat {
        display: none !important;
    }

    /* 面接官の発言吹き出し */
    .interviewer-speech-bubble {
        position: absolute;
        bottom: 120px;
        left: 20px;
        right: 20px;
        background: rgba(45, 55, 72, 0.95);
        border: 1px solid var(--border-color);
        border-radius: 16px;
        padding: 16px;
        color: var(--text-primary);
        font-size: 14px;
        line-height: 1.5;
        backdrop-filter: blur(10px);
        z-index: 7;
        animation: fadeInUp 0.3s ease;
    }

    .interviewer-speech-bubble::before {
        content: '';
        position: absolute;
        bottom: -10px;
        left: 30px;
        width: 0;
        height: 0;
        border-left: 10px solid transparent;
        border-right: 10px solid transparent;
        border-top: 10px solid rgba(45, 55, 72, 0.95);
    }

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

    /* 入力エリア - 最下部固定 */
    .input-footer {
        background: var(--bg-secondary) !important;
        border-top: 1px solid var(--border-color) !important;
        padding: 12px !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 8 !important;
        display: flex !important;
    }

    /* 回答入力エリア */
    .input-area {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    /* 録音インジケーター */
    .recording-indicator {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 8px 12px;
        background: rgba(207, 46, 46, 0.1);
        border: 1px solid var(--accent-red);
        border-radius: 8px;
        font-size: 12px;
        color: var(--accent-red);
    }

    .pulse-dot {
        width: 8px;
        height: 8px;
        background: var(--accent-red);
        border-radius: 50%;
        animation: pulse 1s infinite;
    }

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

    /* テキストエリア */
    #user-input {
        width: 100%;
        min-height: 60px;
        max-height: 120px;
        padding: 14px 16px;
        background: var(--bg-tertiary);
        border: 1px solid var(--border-color);
        border-radius: 12px;
        color: var(--text-primary);
        font-size: 16px;
        resize: none;
        outline: none;
        font-family: inherit;
    }

    #user-input::placeholder {
        color: var(--text-secondary);
        font-size: 14px;
    }

    #user-input:focus {
        border-color: var(--accent-blue);
        box-shadow: 0 0 0 2px rgba(0, 91, 172, 0.2);
    }

    /* 入力コントロール */
    .input-controls {
        display: flex;
        align-items: center;
        gap: 12px;
        justify-content: center;
    }

    .input-controls .btn {
        width: 48px;
        height: 48px;
        border-radius: 50%;
        border: none;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
        cursor: pointer;
        transition: all 0.2s ease;
        flex-shrink: 0;
    }

    /* マイクボタン */
    .voice-btn {
        background: var(--accent-blue);
        color: white;
    }

    .voice-btn:hover,
    .voice-btn:active {
        background: var(--accent-blue-light);
        transform: scale(1.1);
    }

    /* 一時停止ボタン */
    .pause-btn {
        background: var(--accent-orange);
        color: white;
    }

    .pause-btn:hover,
    .pause-btn:active {
        background: #e55d00;
        transform: scale(1.1);
    }

    /* 送信ボタン */
    .input-controls .btn:not(.voice-btn):not(.pause-btn) {
        background: var(--accent-green);
        color: white;
    }

    .input-controls .btn:not(.voice-btn):not(.pause-btn):hover,
    .input-controls .btn:not(.voice-btn):not(.pause-btn):active {
        background: #6bc5a0;
        transform: scale(1.1);
    }

    /* 名前入力エリア - モバイル最適化 */
    .name-input-area {
        padding: 20px;
        background: var(--bg-secondary);
        border-top: 1px solid var(--border-color);
    }

    .name-input-wrapper {
        margin-bottom: 16px;
    }

    .name-input-wrapper label {
        display: block;
        margin-bottom: 8px;
        color: var(--text-primary);
        font-size: 14px;
        font-weight: 500;
    }

    .name-input-wrapper input {
        width: 100%;
        padding: 14px 16px;
        background: var(--bg-tertiary);
        border: 1px solid var(--border-color);
        border-radius: 8px;
        color: var(--text-primary);
        font-size: 16px;
        outline: none;
    }

    .name-input-wrapper input:focus {
        border-color: var(--accent-blue);
        box-shadow: 0 0 0 2px rgba(0, 91, 172, 0.2);
    }

    /* ウェルカム画面 - モバイル最適化 */
    .welcome-screen {
        padding: 20px;
    }

    .welcome-content {
        text-align: center;
        max-width: none;
        width: 100%;
    }

    .welcome-logo {
        width: 80px;
        height: 80px;
        margin-bottom: 20px;
    }

    .welcome-content h1 {
        font-size: 24px;
        margin-bottom: 12px;
    }

    .welcome-content p {
        font-size: 14px;
        margin-bottom: 24px;
    }

    .welcome-instructions {
        margin-bottom: 24px;
    }

    .instruction-item {
        padding: 12px 16px;
        margin-bottom: 8px;
        font-size: 14px;
    }

    /* ウェルカム画面の名前入力 */
    .welcome-name-input {
        width: 100%;
    }

    .welcome-name-input label {
        font-size: 14px;
        margin-bottom: 8px;
    }

    .welcome-name-input input {
        padding: 14px 16px;
        font-size: 16px;
        margin-bottom: 16px;
    }

    .welcome-start-btn {
        width: 100%;
        padding: 16px 24px;
        font-size: 16px;
        border-radius: 8px;
    }

    /* リアルタイムステータス - モバイル最適化 */
    .realtime-status {
        position: fixed;
        top: 60px;
        left: 50%;
        transform: translateX(-50%);
        background: rgba(207, 46, 46, 0.9);
        color: white;
        padding: 8px 16px;
        border-radius: 16px;
        font-size: 12px;
        z-index: 15;
        backdrop-filter: blur(10px);
    }

    /* ローディングオーバーレイ - モバイル最適化 */
    .loading-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(30, 33, 36, 0.95);
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 20;
        backdrop-filter: blur(10px);
    }

    .loading-content {
        text-align: center;
        color: var(--text-primary);
    }

    .loading-spinner {
        margin-bottom: 16px;
    }

    .loading-text {
        font-size: 16px;
        color: var(--text-secondary);
    }

    /* モーダル - モバイル最適化 */
    .modal-overlay {
        padding: 20px;
    }

    .voice-input-modal,
    .answer-validation-modal,
    .answer-edit-modal {
        width: 100%;
        max-width: none;
        margin: 0;
        border-radius: 16px;
        max-height: calc(100vh - 40px);
        overflow-y: auto;
    }

    .modal-header h3 {
        font-size: 18px;
    }

    .modal-body {
        font-size: 14px;
    }

    .modal-footer {
        flex-direction: column;
        gap: 12px;
    }

    .modal-footer .btn {
        width: 100%;
        padding: 14px;
        font-size: 15px;
    }

    /* エラーメッセージ - モバイル最適化 */
    .error-message {
        position: fixed;
        top: 70px;
        left: 20px;
        right: 20px;
        z-index: 15;
        padding: 12px 16px;
        border-radius: 8px;
        font-size: 14px;
    }
}

/* 極小画面対応（320px以下） */
@media screen and (max-width: 320px) {
    .header-toolbar {
        padding: 6px 8px;
        height: 45px;
    }

    .app-title {
        font-size: 12px;
    }

    .header-right {
        font-size: 11px;
        gap: 8px;
    }

    .pip-video-panel {
        width: 60px;
        height: 60px;
        top: 15px;
        right: 15px;
    }

    .control-btn {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }

    .input-controls .btn {
        width: 44px;
        height: 44px;
        font-size: 16px;
    }

    .interviewer-speech-bubble {
        bottom: 100px;
        left: 15px;
        right: 15px;
        font-size: 13px;
        padding: 12px;
    }
}