/* PersonaHire Ultimate - 主样式文件 */
/* 简约风格设计 + 双模式支持 + Token监控界面 */

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

body {
    font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f8f9fa;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    max-width: 900px;
    width: 100%;
    border: 1px solid #e9ecef;
}

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

.header h1 {
    color: #2c3e50;
    font-size: 2.5em;
    font-weight: 600;
    margin-bottom: 16px;
}

.header p {
    color: #666;
    font-size: 1.2em;
    font-weight: 500;
}

.badge {
    display: inline-block;
    background: #007bff;
    color: white;
    padding: 6px 14px;
    border-radius: 16px;
    font-size: 0.85em;
    font-weight: 500;
    margin-bottom: 20px;
}

/* =============== 面试功能样式 (用户模式) =============== */

.settings-panel {
    background: #f8f9fa;
    padding: 24px;
    border-radius: 8px;
    margin-bottom: 24px;
    border: 1px solid #e9ecef;
}

.voice-settings {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.voice-settings select {
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
}

.chat-area {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    height: 500px;
    overflow-y: auto;
    padding: 24px;
    margin-bottom: 24px;
    background: #fafafa;
}

.message {
    margin-bottom: 16px;
    padding: 16px;
    border-radius: 8px;
    max-width: 85%;
    position: relative;
    animation: fadeIn 0.3s ease;
}

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

.message.interviewer {
    background: #e3f2fd;
    margin-left: 0;
    border-left: 3px solid #2196f3;
}

.message.user {
    background: #f1f8e9;
    margin-left: auto;
    border-right: 3px solid #4caf50;
}

.message strong {
    font-weight: 700;
    margin-bottom: 8px;
    display: block;
}

.voice-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-top: 12px;
}

.voice-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.voice-btn:hover {
    background: #c82333;
}

.input-area {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.input-area textarea {
    flex: 1;
    padding: 16px;
    border: 1px solid #ced4da;
    border-radius: 8px;
    resize: vertical;
    min-height: 100px;
    font-size: 16px;
    font-family: inherit;
    transition: all 0.2s ease;
}

.input-area textarea:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.send-btn {
    background: #28a745;
    color: white;
    padding: 20px 32px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    height: fit-content;
    transition: all 0.2s ease;
}

.send-btn:hover {
    background: #218838;
}

.controls {
    text-align: center;
    margin-bottom: 24px;
}

.controls button {
    background: #17a2b8;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    margin: 0 8px;
    transition: all 0.2s ease;
}

.controls button:hover {
    background: #138496;
}

.user-export-btn {
    background: #6f42c1 !important;
}

.user-export-btn:hover {
    background: #5a2d91 !important;
}

/* =============== API和Token管理样式 (开发者模式) =============== */

.api-setup {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 32px;
    border-radius: 16px;
    margin-bottom: 40px;
    border: 1px solid #dee2e6;
}

.api-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.api-setup input {
    width: 100%;
    padding: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.api-setup input:focus {
    border-color: #667eea;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.api-setup button {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 16px 32px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.api-setup button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

/* Token状态检测面板 */
.token-status {
    background: linear-gradient(135deg, #e8f5e8, #d4edda);
    padding: 20px;
    border-radius: 12px;
    margin-top: 20px;
    border: 1px solid #c3e6cb;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: white;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #dc3545;
}

.status-indicator.connected {
    background: #28a745;
}

.status-indicator.testing {
    background: #ffc107;
    animation: pulse 1.5s infinite;
}

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

/* 使用统计面板 */
.usage-stats {
    background: linear-gradient(135deg, #fff3cd, #ffeaa7);
    padding: 20px;
    border-radius: 12px;
    margin-top: 20px;
    border: 1px solid #ffecb5;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.stat-card {
    background: white;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #dee2e6;
}

.stat-number {
    font-size: 1.5em;
    font-weight: 600;
    color: #007bff;
}

.stat-label {
    font-size: 0.9em;
    color: #666;
    margin-top: 4px;
}

/* Token日志面板 */
.token-logs {
    background: linear-gradient(135deg, #f0f8ff, #e6f3ff);
    padding: 24px;
    border-radius: 16px;
    margin-top: 20px;
    border: 1px solid #bee5eb;
}

.live-logs {
    margin-bottom: 24px;
}

.log-entry {
    background: white;
    border-radius: 6px;
    padding: 12px;
    margin: 8px 0;
    border-left: 3px solid #007bff;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 0.9em;
    border: 1px solid #e9ecef;
}

.log-entry.api-call {
    border-left-color: #28a745;
}

.log-entry.tts-call {
    border-left-color: #ffc107;
}

.log-entry.error {
    border-left-color: #dc3545;
}

.history-stats {
    margin: 24px 0;
}

.detailed-logs {
    margin-top: 24px;
}

.log-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
}

.log-table th, .log-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
    font-size: 0.9em;
}

.log-table th {
    background: #f8f9fa;
    font-weight: 600;
}

/* 高级设置面板 */
.advanced-settings {
    background: linear-gradient(135deg, #f0f8ff, #e6f3ff);
    padding: 20px;
    border-radius: 12px;
    margin-top: 20px;
    border: 1px solid #bee5eb;
}

.settings-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

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

.setting-group label {
    font-size: 0.9em;
    font-weight: 600;
    color: #495057;
}

.setting-group input, .setting-group select {
    padding: 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}

/* =============== 状态和提示样式 =============== */

.loading {
    display: none;
    text-align: center;
    color: #667eea;
    font-style: italic;
    font-weight: 500;
    font-size: 18px;
}

.error {
    background: #f8d7da;
    color: #721c24;
    padding: 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    border-left: 3px solid #dc3545;
    border: 1px solid #f5c6cb;
}

.success {
    background: #d4edda;
    color: #155724;
    padding: 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    border-left: 3px solid #28a745;
    border: 1px solid #c3e6cb;
}

.audio-indicator {
    display: none;
    color: #ff4081;
    font-weight: 600;
    animation: pulse 1.5s infinite;
}

/* =============== 双模式控制 =============== */

/* 用户模式：隐藏所有开发者功能 */
.user-mode .dev-mode-ui { display: none !important; }
.user-mode .api-setup { display: none !important; }
.user-mode .token-status { display: none !important; }
.user-mode .usage-stats { display: none !important; }
.user-mode .token-logs { display: none !important; }
.user-mode .advanced-settings { display: none !important; }

/* 开发者模式：隐藏所有面试功能 */
.dev-mode .user-mode-ui { display: none !important; }
.dev-mode .settings-panel { display: none !important; }
.dev-mode .chat-area { display: none !important; }
.dev-mode .input-area { display: none !important; }
.dev-mode .controls { display: none !important; }

/* 开发者模式专用显示 */
.dev-only {
    display: none;
}

.dev-mode .dev-only {
    display: block;
}

/* =============== 底部链接样式 =============== */

.footer-links {
    text-align: center;
    margin-top: 20px;
    padding: 20px;
}

.footer-links a {
    color: #999;
    font-size: 12px;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: #667eea;
}

.footer-links span {
    color: #ccc;
    font-size: 12px;
    margin: 0 10px;
}

/* =============== 响应式设计 =============== */

@media (max-width: 768px) {
    .container {
        padding: 24px;
        width: 98%;
    }
    
    .header h1 {
        font-size: 2.2em;
    }
    
    .voice-settings {
        grid-template-columns: 1fr;
    }
    
    .api-row {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .settings-row {
        grid-template-columns: 1fr;
    }
    
    .controls button {
        margin: 8px;
        padding: 12px 24px;
    }
}