/* コンポーネントCSS - AI面接システム */

/* 録画制御 */
.recording-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
}

.recording-status.recording {
    color: var(--accent-red);
}

.recording-status.paused {
    color: var(--accent-orange);
}

.recording-status.stopped {
    color: var(--text-secondary);
}

.recording-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.recording-dot.pulsing {
    background: var(--accent-red);
    animation: pulse 1s infinite;
}

.recording-dot.paused {
    background: var(--accent-orange);
}

.recording-dot.stopped {
    background: var(--text-secondary);
}

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

/* 音声切り替えボタン */
.voice-toggle-btn {
    background: transparent;
    border: 2px solid var(--text-secondary);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px 12px;
    margin-right: 12px;
    transition: all 0.2s ease;
    font-size: 16px;
    min-width: 44px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.voice-toggle-btn.enabled {
    border-color: var(--primary-green);
    color: var(--primary-green);
    background: rgba(76, 175, 80, 0.1);
}

.voice-toggle-btn.disabled {
    border-color: var(--accent-red);
    color: var(--accent-red);
    background: rgba(244, 67, 54, 0.1);
}

.voice-toggle-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.voice-toggle-btn:active {
    transform: translateY(0);
}


/* メインコンテナ */
.main-container {
    width: 100vw;
    height: 100vh;
    background: var(--bg-primary, #18191c);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.content-area {
    display: flex;
    flex: 1;
    height: calc(100vh - 60px);
    padding-top: 60px;
}

/* メインビデオエリア */
.main-video-container {
    flex: 0 0 60%;
    position: relative;
    background: #000;
    overflow: hidden;
}

.main-video-panel {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* メイン面接者ビデオ */
.candidate-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}

.camera-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-secondary);
    font-size: 18px;
}

.camera-placeholder i {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

/* PIP面接官ビデオ */
.pip-video-panel {
    position: absolute !important;
    top: 20px !important;
    right: 20px !important;
    width: 180px;
    height: 135px;
    background: transparent;
    border: none !important;
    border-radius: 0;
    overflow: hidden;
    box-shadow: none;
    z-index: 10;
    transform: none !important;
    left: auto !important;
    bottom: auto !important;
}

/* 面接官ビデオ（PIP内） */
.interviewer-video {
    position: absolute;
    top: 10px;
    left: 10px;
    width: calc(100% - 20px);
    height: calc(100% - 20px);
    object-fit: cover;
    border-radius: 50%;
}

/* ビデオコントロールを完全に隠す */
.interviewer-video::-webkit-media-controls {
    display: none !important;
}

.interviewer-video::-webkit-media-controls-overlay {
    display: none !important;
}

.interviewer-video::-webkit-media-controls-start-playback-button {
    display: none !important;
}

.interviewer-video::-webkit-media-controls-enclosure {
    display: none !important;
}

.interviewer-video::-webkit-media-controls-panel {
    display: none !important;
}

.interviewer-video::-webkit-media-controls-timeline {
    display: none !important;
}

.interviewer-video::-webkit-media-controls-current-time-display {
    display: none !important;
}

.interviewer-video::-webkit-media-controls-time-remaining-display {
    display: none !important;
}

/* すべてのビデオ要素の時間表示を隠す */
video {
    outline: none;
}

/* すべてのビデオ要素のコントロールを隠す */
video::-webkit-media-controls {
    display: none !important;
}

video::-webkit-media-controls-overlay {
    display: none !important;
}

video::-webkit-media-controls-timeline {
    display: none !important;
}

video::-webkit-media-controls-current-time-display {
    display: none !important;
}

.interviewer-image {
    position: absolute;
    top: 10px;
    left: 10px;
    width: calc(100% - 20px);
    height: calc(100% - 20px);
    object-fit: cover;
    border-radius: 50%;
    aspect-ratio: 1/1;
}

/* ビデオコントロールオーバーレイ */
.video-controls-overlay {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 300px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.7);
    border-radius: 8px;
    padding: 12px 16px;
    z-index: 10;
}

.participant-info {
    color: white;
    font-weight: 600;
}

.control-buttons {
    display: flex;
    gap: 12px;
}

.control-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 16px;
}

.control-icon.active {
    background: rgba(76, 175, 80, 0.3);
    color: #4caf50;
}

.control-icon.muted {
    background: rgba(244, 67, 54, 0.3);
    color: #f44336;
}

.control-icon:hover {
    background: rgba(255,255,255,0.3);
}

/* 右側チャットサイドバー */
.sidebar-chat {
    flex: 1;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    z-index: 9997;
}

.chat-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.chat-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
}

.sidebar-chat .chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 0;
    margin-bottom: 0;
    position: relative;
    z-index: 9998;
}

.sidebar-chat .interview-status {
    padding: 16px;
    text-align: center;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 14px;
    border-top: 1px solid var(--border-color);
}

.sidebar-chat .error-message {
    margin: 12px 16px;
}

.sidebar-chat .loading {
    padding: 20px;
    text-align: center;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
}

/* フッター入力エリア */
.input-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}


.camera-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 16px;
}

.camera-placeholder i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.video-info {
    background: rgba(0, 0, 0, 0.7);
    padding: 18px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
}

.participant-name {
    font-weight: 700;
    color: var(--text-primary, #fff);
    font-size: 1.25rem;
    letter-spacing: 0.04em;
}

.participant-controls {
    display: flex;
    gap: 16px;
}

.participant-controls .participant-control {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 16px;
    border: none;
}

.participant-controls .participant-control:hover {
    background: rgba(255,255,255,0.3);
}

.participant-controls .participant-control.active {
    background: rgba(76, 175, 80, 0.3);
    color: #4caf50;
}

.participant-controls .participant-control.muted {
    background: rgba(244, 67, 54, 0.3);
    color: #f44336;
}

/* チャットメッセージ共通スタイル */
.chat-messages {
    font-size: 14px;
    line-height: 1.6;
}

.input-area, #responseArea {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 15px;
    background: var(--background-tertiary);
    border-radius: 8px;
    margin-top: 10px;
}

.input-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-end;
}

/* Voice button styles */
.voice-btn {
    background: var(--accent-green);
}

.voice-btn:hover {
    background: var(--accent-green-hover, #43a047);
    transform: scale(1.05);
}

.voice-btn.listening {
    background: var(--accent-red);
    animation: pulse-mic 1s infinite;
}

.voice-btn.listening:hover {
    background: var(--accent-red-hover, #e53e3e);
}

@keyframes pulse-mic {
    0%, 100% { 
        opacity: 1; 
        box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.7);
    }
    50% { 
        opacity: 0.8; 
        box-shadow: 0 0 0 10px rgba(255, 71, 87, 0);
    }
}

.interview-status {
    text-align: center;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    margin-bottom: 16px;
    color: var(--text-secondary);
    font-size: 14px;
}

.message {
    margin-bottom: 16px;
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 80%;
    word-wrap: break-word;
}

.message.ai {
    background: #2d3748 !important;
    color: #ffffff !important;
    margin-right: auto;
    border-bottom-left-radius: 4px;
    border-left: 4px solid #4fd1c7;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    z-index: 99999;
    position: relative;
    font-weight: 500;
    line-height: 1.6;
    min-height: 40px;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.message.user {
    background: var(--accent-blue);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.message.system {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    margin: 8px auto;
    text-align: center;
    font-size: 13px;
    font-style: italic;
    border: 1px solid var(--border-color);
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
}

.name-input-area {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: flex-end;
}

#candidateName {
    width: 250px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

#candidateName:focus {
    border-color: var(--accent-blue);
}

#user-input {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    color: var(--text-primary);
    font-size: 14px;
    resize: vertical;
    min-height: 60px;
    max-height: 120px;
    outline: none;
    transition: border-color 0.2s ease;
    margin-bottom: 10px;
}

#user-input:focus {
    border-color: var(--accent-blue);
}

.btn {
    background: var(--accent-blue);
    color: white;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn.text-btn {
    border-radius: 8px;
    padding: 12px 24px;
    width: auto;
    height: auto;
    font-size: 14px;
    font-weight: 500;
    gap: 8px;
}

.btn:hover {
    background: #4752c4;
    transform: translateY(-1px);
}

.btn:disabled {
    background: var(--hover-bg);
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--hover-bg);
}

.btn-secondary:hover {
    background: #6d717a;
}

.loading {
    display: none;
    text-align: center;
    padding: 16px;
    color: var(--text-secondary);
}

.loading.active {
    display: block;
}

.loading i {
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

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

.error-message {
    background: rgba(237, 66, 69, 0.1);
    border: 1px solid var(--accent-red);
    color: var(--accent-red);
    padding: 12px;
    border-radius: 8px;
    margin: 12px 0;
    display: none;
}

/* 面接結果表示 */
.interview-results {
    background: var(--bg-tertiary);
    border-radius: 12px;
    padding: 24px;
    margin: 16px 0;
    border-left: 4px solid var(--accent-blue);
}

.interview-results h3 {
    color: var(--text-primary);
    margin: 0 0 16px 0;
    font-size: 18px;
    font-weight: 600;
}

.result-summary {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.result-summary p {
    margin: 8px 0;
    color: var(--text-primary);
    font-size: 14px;
}

.result-summary strong {
    color: var(--accent-blue);
}

.result-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.strengths, .concerns {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 16px;
}

.strengths h4 {
    color: var(--accent-green);
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
}

.concerns h4 {
    color: var(--accent-red);
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
}

.strengths ul, .concerns ul {
    margin: 0;
    padding-left: 20px;
    color: var(--text-primary);
    font-size: 14px;
}

.strengths li, .concerns li {
    margin: 4px 0;
}

@media (max-width: 768px) {
    .result-details {
        grid-template-columns: 1fr;
    }
}

/* リアルタイム評価表示 */
.realtime-evaluation {
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 12px;
    margin: 8px 0;
    border-left: 3px solid var(--accent-blue);
    transition: opacity 0.5s ease;
    font-size: 13px;
}

.evaluation-header {
    margin-bottom: 8px;
}

.evaluation-score {
    font-size: 14px;
}

.evaluation-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.evaluation-details .keywords {
    color: var(--accent-blue);
    font-weight: 500;
}

.evaluation-details .strengths {
    color: var(--accent-green);
}

.evaluation-details .concerns {
    color: var(--accent-orange);
}

/* レスポンシブ対応 */
@media (max-width: 1024px) {
    .content-area {
        flex-direction: column;
    }
    
    .sidebar-chat {
        width: 100%;
        height: 250px;
        border-left: none;
        border-top: 1px solid var(--border-color);
    }
    
    .pip-video-panel {
        width: 150px;
        height: 112px;
        top: 15px;
        right: 15px;
    }
    
    .video-controls-overlay {
        right: 170px;
        width: 250px;
    }
}

@media (max-width: 768px) {
    /* メインコンテナ */
    .main-container {
        height: 100dvh; /* 動的ビューポート高さ */
    }
    
    /* ヘッダー */
    .header-toolbar {
        padding: 8px 12px;
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .header-left {
        flex: 1;
        min-width: 0;
    }
    
    .app-title {
        font-size: 16px;
    }
    
    .recording-status {
        font-size: 12px;
    }
    
    .timer, .progress-info {
        font-size: 12px;
    }
    
    /* コンテンツエリア */
    .content-area {
        height: calc(100dvh - 60px);
    }
    
    .main-video-container {
        flex: 1;
        min-height: 60%;
    }
    
    .sidebar-chat {
        height: 40%;
        min-height: 200px;
    }
    
    /* モバイル版では面接進行中表示を非表示 */
    .sidebar-chat .interview-status {
        display: none;
    }
    
    .chat-header {
        padding: 12px 16px;
    }
    
    .chat-header h3 {
        font-size: 16px;
    }
    
    .chat-messages {
        padding: 12px;
        font-size: 13px;
    }
    
    /* PIPビデオ */
    .pip-video-panel {
        width: 100px;
        height: 75px;
        top: 8px;
        right: 8px;
    }
    
    /* ビデオコントロール */
    .video-controls-overlay {
        width: 200px;
        right: 8px;
        bottom: 8px;
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .control-icon {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
    
    /* 入力フッター */
    .input-footer {
        padding: 12px;
    }
    
    .name-input-area {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    #candidateName {
        width: 100%;
        padding: 12px;
        font-size: 16px; /* iOSズーム防止 */
    }
    
    #user-input {
        padding: 16px;
        font-size: 16px; /* iOSズーム防止 */
        min-height: 80px;
        border-radius: 12px;
        line-height: 1.5;
    }
    
    .input-controls {
        justify-content: center;
        gap: 16px;
    }
    
    .btn {
        width: 56px;
        height: 56px;
        font-size: 20px;
        border-radius: 28px;
    }
    
    .btn.text-btn {
        padding: 12px 20px;
        font-size: 14px;
    }
    
    /* メッセージ */
    .message {
        max-width: 90%;
        padding: 10px 12px;
        font-size: 13px;
    }
    
    /* エラーメッセージ */
    .error-message {
        margin: 8px 0;
        padding: 10px;
        font-size: 13px;
    }
    
    /* ローディング */
    .loading {
        padding: 16px;
        font-size: 13px;
    }
}

/* リアルタイム音声認識スタイル */
#user-input.realtime-input {
    border: 2px solid var(--accent-blue);
    background: rgba(52, 152, 219, 0.05);
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { box-shadow: 0 0 5px rgba(52, 152, 219, 0.3); }
    to { box-shadow: 0 0 15px rgba(52, 152, 219, 0.6); }
}

/* リアルタイム音声認識状態表示 */
.realtime-status {
    position: fixed;
    top: 80px;
    right: 20px;
    background: rgba(52, 152, 219, 0.9);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    z-index: 1000;
    display: none;
}

.realtime-status.active {
    display: block;
    animation: fadeInOut 0.3s ease-in-out;
}

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

@media (max-width: 480px) {
    /* 極小画面対応 */
    .header-toolbar {
        padding: 6px 8px;
    }
    
    .app-title {
        font-size: 14px;
    }
    
    .pip-video-panel {
        width: 80px;
        height: 60px;
        top: 6px;
        right: 6px;
    }
    
    .video-controls-overlay {
        width: 180px;
        padding: 6px 10px;
        font-size: 11px;
    }
    
    .control-icon {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }
    
    .input-footer {
        padding: 8px;
    }
    
    .btn {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }
    
    .chat-messages {
        padding: 8px;
        font-size: 12px;
    }
    
    .message {
        padding: 8px 10px;
        font-size: 12px;
    }
}


#micBtn {
    background: var(--accent-blue);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    transition: background 0.2s;
}
#micBtn.active {
    background: var(--accent-red);
}
#micBtn:focus {
    outline: 2px solid var(--accent-blue);
} 