/* 主样式表 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
        'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow: hidden;
    font-size: clamp(14px, 2.2vw, 18px); /* Responsive font size with minimum and maximum */
}

#app {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.page {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.page.hidden {
    display: none;
}

/* 加载页面 */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content {
    text-align: center;
}

.loading-content i {
    font-size: 2rem; /* Reduced for better responsiveness */
    color: #667eea;
    margin-bottom: 1rem;
}

.loading-content p {
    font-size: 1.2rem;
    color: #666;
}

/* 通用头部 */
.header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 1rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.header h1 {
    color: white;
    font-size: calc(1.2rem + 0.5vw); /* Responsive font size */
    margin: 0;
    font-weight: 600;
}

/* 状态信息 */
.status-info {
    margin-top: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 0.9375rem; /* Convert 15px to rem */
    font-size: 0.8rem;
    font-weight: 500;
}

.status-badge.passed {
    background: #4CAF50;
    color: white;
}

.status-badge.failed {
    background: #f44336;
    color: white;
}

.status-badge.pending {
    background: #FF9800;
    color: white;
}


/* 主要内容区域 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0.1rem 0.5rem;
    overflow-y: auto;
}

/* 登录页面样式 */
.welcome-section {
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
}

.welcome-section i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.8;
}

.welcome-section h2 {
    font-size: calc(1.4rem + 0.6vw); /* Responsive font size */
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.welcome-section p {
    font-size: calc(0.9rem + 0.4vw); /* Responsive font size */
    opacity: 0.9;
}


/* 录制页面样式 */
.video-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto 0; /* Remove bottom margin since we want it to touch the controls */
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    background: #000;
    aspect-ratio: 16/8.1;
    /* Reduced height by ~10% from original 16/9 */
}

#video-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform: scaleX(-1);
    /* Mirror effect for intuitive user experience */
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    text-align: center;
    padding: 1rem;
}


.head-positioning-guide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* Allow clicks to pass through to video */
    z-index: 1;
    /* Lower than other overlays so it doesn't block messages */
}

.head-positioning-guide svg {
    width: 100%;
    height: 100%;
}

.id-card-positioning-guide {
    position: absolute;
    top: 85%; /* Lower position near the bottom */
    left: 60%; /* More to the right */
    transform: translate(-50%, -50%);
    width: 71.5%; /* Increased by 10% from 65% (65*1.1=71.5) */
    height: 44%; /* Increased by 10% from 40% (40*1.1=44) */
    pointer-events: none;
    /* Allow clicks to pass through to video */
    z-index: 1;
    /* Lower than other overlays so it doesn't block messages */
}


.id-card-positioning-guide svg {
    width: 100%;
    height: 100%;
}

.face-detection-status {
    background: rgba(0, 0, 0, 0.7);
    padding: 1rem;
    border-radius: 0.5rem; /* Convert 8px to rem */
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.id-card-overlay {
    background: rgba(255, 193, 7, 0.9);
    padding: 1rem;
    border-radius: 0.5rem; /* Convert 8px to rem */
    color: #333;
    font-weight: 600;
    position: absolute;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    text-align: center;
}

.question-display {
    margin: 0.0rem 0;
    text-align: center;
    color: white;
    height: 7.3rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.question-text {
    font-size: calc(1rem + 0.4vw); /* Responsive font size */
    line-height: 1.2;
    margin-bottom: 0.0rem;
    font-weight: bold;
    padding: 0rem 0.0rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem; /* Convert 8px to rem */
    backdrop-filter: blur(0.625rem); /* Convert 10px to rem */
    overflow-y: auto;
    /* Allow vertical scrolling when content exceeds space */
    text-overflow: ellipsis;
    word-wrap: break-word;
    display: block;
    /* Change from flex to block to allow scrolling */
    height: 5.3rem;
    /* Fixed height for exactly 4 lines: content (7.2rem) + reduced padding (0.5rem total) */
    box-sizing: border-box;
    /* Include padding in the height calculation */
    flex-shrink: 0;
    /* Don't shrink this element */
}

.flow-tips {
    font-size: calc(0.9rem + 0.4vw); /* Increased responsive font size */
    color: #FFC107;
    font-weight: bold;
    margin-top: 0.25rem;
    flex-shrink: 0;
    /* Don't shrink the ASR result */
    overflow: hidden;
    height: 1.25rem;
    /* Reduced height for ASR result */
}

/* 录制控制按钮 */
.recording-controls {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
    min-height: 64px;
    /* Consistent container height */
}

/* 按钮样式 */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 1.5rem; /* Use relative unit */
    font-size: calc(0.8rem + 0.4vw); /* Responsive font size */
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    text-decoration: none;
    box-shadow: 0 0.3rem 1rem rgba(0, 0, 0, 0.2); /* Convert px to rem */
    min-height: 3rem; /* Convert px to rem */
    /* Consistent button height */
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    padding: 0.75rem 1.75rem; /* Convert 12px/28px to rem */
    border: none;
    border-radius: 0.5rem; /* Convert 8px to rem */
    cursor: pointer;
    font-size: 1rem; /* Convert 16px to rem */
    font-weight: 600;
    transition: all 0.3s ease;

    /* 2. 增强视觉存在感的配色 */
    background-color: #007AFF;
    /* 经典的科技蓝 */
    color: white;

    /* 3. 关键：默认状态下的投影，产生“凸起”感 */
    box-shadow: 0 0.25rem 0.875rem 0 rgba(0, 122, 255, 0.3); /* Convert px to rem */
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-0.125rem); /* Convert 2px to rem */
    box-shadow: 0 0.375rem 1.25rem rgba(0, 0, 0, 0.3); /* Convert px to rem */
}

/* Recording state visual feedback using consistent button style */
.btn-primary.recording {
    background: linear-gradient(135deg, #e53935 0%, #f44336 100%) !important;
    /* Red gradient for recording state */
    animation: pulse 1.5s infinite;
}

/* Original btn-record class maintained for compatibility but not used in current implementation */
.btn-record {
    background: linear-gradient(135deg, #f44336 0%, #e53935 100%);
    color: white;
}

.btn-record.recording {
    background: linear-gradient(135deg, #4CAF50 0%, #43A047 100%);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }

    100% {
        opacity: 1;
    }
}

.btn-cancel {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    backdrop-filter: blur(10px);
}

.btn-cancel:hover {
    background: rgba(255, 255, 255, 0.3);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 进度信息 */
.progress-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.5rem;
    color: white;
    font-size: 0.9rem;
}

/* 居中的进度信息和总题数信息 - 保持一致的样式 */
.progress-info-centered,
.total-questions-info {
    text-align: center;
    margin: 0rem;
    /* Minimal top margin */
    color: white;
    font-size: calc(0.7rem + 0.4vw); /* Responsive font size */
    /* Smaller font size as requested */
    padding: 0rem 0.5rem;
    max-width: 600px;
    /* Match video container max-width */
    backdrop-filter: blur(10px);
}

/* Questionnaire status display on instructions page */
.questionnaire-status-info {
    text-align: center;
    margin: 1rem auto;
    color: white;
    font-size: 1.6rem;
    /* Increased to 2 times the original size */
    font-weight: 500;
    max-width: 600px;
    margin-bottom: 10rem;
}

.questionnaire-status-info .status-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    /* Increased to 2 times the original gap */
    padding: 1rem 2rem;
    /* Increased to 2 times the original padding */
    border-radius: 16px;
    /* Increased to 2 times the original border radius */
    backdrop-filter: blur(10px);
}

.questionnaire-status-info .status-display i {
    font-size: 2.4rem;
    /* Increased to 2 times the original icon size */
}

/* 确认页面样式 */
.confirmation-content {
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
}

.success-icon {
    font-size: 2.5rem; /* Reduced from 4rem for better responsiveness */
    color: #4CAF50;
    margin-bottom: 1rem;
}

.upload-waiting-icon {
    font-size: 4rem;
    color: #FFC107;
    /* Yellow color */
    margin-bottom: 1rem;
}

.upload-complete-icon {
    font-size: 4rem;
    color: #4CAF50;
    /* Green color */
    margin-bottom: 1rem;
}

.confirmation-content h2 {
    font-size: calc(1.4rem + 0.6vw); /* Responsive font size */
    margin-bottom: 1rem;
    font-weight: 600;
}

.confirmation-content p {
    font-size: calc(0.9rem + 0.4vw); /* Responsive font size */
    margin-bottom: 1.5rem;
    opacity: 0.9;
}

/* Instructions page styling */
.instructions-section {
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    /* Changed from center to start to move content up */
    color: white;
    padding: 1rem 1rem 0;
    /* Reduced top padding */
    margin-top: 0.5rem;
    /* Reduced margin */
}

.instructions-section i {
    font-size: 4rem;
    margin-bottom: 0.8rem;
    opacity: 0.8;
}

.instructions-section h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    /* Reduced margin */
    font-weight: 600;
}

.instructions-list {
    text-align: left;
    max-width: 500px;
    width: 100%;
    margin: 0.8rem 0;
    /* Reduced margin */
    padding-left: 1.5rem;
    flex: 0 0 auto;
    /* Don't grow, only take needed space */
}

.instructions-list li {
    font-size: calc(0.9rem + 0.4vw); /* Responsive font size */
    line-height: 1.6;
    /* Reduced line height */
    margin-bottom: 0.3rem;
    /* Reduced margin */
    opacity: 0.9;
}

/* Layout helpers for instructions page */
.instructions-main {
    display: flex;
    flex-direction: column;
    padding: 10px;
    box-sizing: border-box;
    height: 100vh;
    /* allow main-content to use full view for flex spacing */
    max-width: 900px;
    margin: 0 auto;
}

.instructions-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    margin-bottom: 12px;
}

.instructions-header i {
    font-size: 2.4rem;
    color: #FFEB3B;
    /* Yellow color */
}

.instructions-header h2 {
    font-size: 1.4rem;
    margin: 0;
    color: #fff;
    font-weight: 600;
}

.warning-text {
    color: #FFEB3B !important;
    /* Yellow color */
}

/* Main content areas that need to account for fixed bottom controls */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0.1rem 0.5rem;
    overflow-y: auto;
}

#instructions-page .instructions-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 10px;
    box-sizing: border-box;
    max-width: 900px;
    margin: 0 auto;
}

#recording-page .main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0.1rem 0.5rem;
    overflow-y: auto;
}

.question-display {
    margin: 0.0rem 0;
    text-align: center;
    color: white;
    height: 7.3rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.video-container {
    position: relative;
    width: 100%;
    max-width: 37.5rem; /* Convert 600px to rem (assuming 16px base) */
    margin: 0 auto 0; /* No bottom margin to bring closer to controls */
    border-radius: 0.75rem; /* Convert 12px to rem */
    overflow: hidden;
    box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.3); /* Convert px to rem */
    background: #000;
    aspect-ratio: 16/9; /* Standard aspect ratio */
    flex-shrink: 0; /* Prevent shrinking */
}

/* Controls remain fixed at the bottom */
#instructions-page .instructions-controls,
#recording-page .recording-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: 1000;
    padding: 0.5rem 0; /* Convert px to rem */
    /* Reduced padding to maintain consistent height */
    box-shadow: 0 -0.25rem 0.75rem rgba(0, 0, 0, 0.1); /* Convert px to rem */
    min-height: 4rem; /* Convert px to rem */
    /* Consistent container height */
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn.full-width {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    border-radius: 12px;
    min-height: 48px;
    /* Consistent button height */
}

/* Special handling for buttons in fixed footers */
#instructions-page .instructions-controls .btn,
#recording-page .recording-controls .btn {
    width: min(100% - 40px, 600px);
    /* Account for side padding and max width */
    margin: 0 auto;
}

/* Tidy up button visual consistency */
.btn {
    border-radius: 12px;
}

/* Reduce heavy shadows on mobile to keep UI clean */
@media (max-width: 480px) {
    .btn {
        box-shadow: none;
    }

    .video-container {
        box-shadow: none;
        border-radius: 8px;
    }

    .instructions-list {
        padding-left: 1rem;
    }
}

.preview-info {
    text-align: center;
    margin: 1rem 0;
    color: white;
    font-size: 1rem;
}

.preview-info p {
    margin: 0.5rem 0;
}

/* Ensure both video elements have consistent styling */
#video-preview,
#video-preview-recording {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 上传进度条 */
.upload-progress {
    width: 100%;
    max-width: 400px;
    margin: 1rem 0;
}

.progress-bar {
    width: 100%;
    height: 0.5rem; /* Convert 8px to rem */
    background: rgba(255, 255, 255, 0.2);
    border-radius: 0.25rem; /* Convert 4px to rem */
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.3s ease;
}

/* 视频预览 */
.video-preview {
    width: 100%;
    max-width: 600px;
    margin-top: 3.0rem;
    position: relative; /* Needed for ID card frame positioning */
    flex-shrink: 0; /* Don't shrink the video preview */
}

#review-video {
    width: 100%;
    max-height: 25rem; /* Convert 400px to rem */
    border-radius: 0.75rem; /* Convert 12px to rem */
    box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.3); /* Convert px to rem */
    background: #000;
}

/* 错误页面样式 */
.error-content {
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
}

.error-icon {
    font-size: 2.5rem; /* Reduced from 4rem for better responsiveness */
    color: #f44336;
    margin-bottom: 1rem;
}

.error-content h2 {
    font-size: calc(1.4rem + 0.6vw); /* Responsive font size */
    margin-bottom: 1rem;
    font-weight: 600;
}

.error-content p {
    font-size: calc(0.9rem + 0.4vw); /* Responsive font size */
    margin-bottom: 1.5rem;
    opacity: 0.9;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main-content {
        padding: 0.2rem;
    }

    .header h1 {
        font-size: 1.2rem;
    }

    .welcome-section h2 {
        font-size: 1.5rem;
    }

    .question-text {
        font-size: 1rem;
        padding: 0.5rem;
    }

    .btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }

    .video-container {
        aspect-ratio: 4/2.7;
        /* Reduced height by ~10% from original 4/3 */
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.1rem;
    }

    .welcome-section {
        padding: 0 1rem;
    }

    .welcome-section h2 {
        font-size: 1.3rem;
    }

    .welcome-section p {
        font-size: 1rem;
    }

    .video-container {
        margin: 0 auto 0.5rem;
        aspect-ratio: 5/6.5;
        /* Reduced height by ~10% from original 3/4 */
    }

    .question-text {
        font-size: 0.9rem;
    }
}

/* 动画效果 */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-up {
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

/* 隐藏元素 */
.hidden {
    display: none !important;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 0.375rem; /* Convert 6px to rem */
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 0.1875rem; /* Convert 3px to rem */
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 0.1875rem; /* Convert 3px to rem */
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}