/* 夸夸颜 - 主样式文件 */

/* 基础样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 页面主体样式 */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 50%, #fecfef 100%);
    min-height: 100vh;
    padding: 10px;
    margin: 0;
}

/* 主容器 */
.container {
    max-width: 100%;
    margin: 0 auto;
    background: white;
    border-radius: 24px;
    box-shadow: 0 12px 40px rgba(255, 154, 158, 0.2);
    overflow: hidden;
    min-height: calc(100vh - 20px);
    border: 3px solid #ffeaa7;
}

/* 头部样式 */
.header {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    color: #fff;
    padding: 24px 16px;
    text-align: center;
    position: relative;
}

.header::before {
    content: '✨';
    position: absolute;
    top: 10px;
    left: 20px;
    font-size: 24px;
    animation: sparkle 2s ease-in-out infinite;
    user-select: none;
    z-index: 10;
}



.header::after {
    content: '💖';
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 24px;
    animation: sparkle 2s ease-in-out infinite 1s;
}

.header h1 {
    font-size: 2em;
    margin-bottom: 8px;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
    background: linear-gradient(45deg, #fff, #ffeaa7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header p {
    font-size: 1em;
    opacity: 0.95;
    font-weight: 500;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

/* 主内容区域 */
.main-content {
    padding: 20px 16px;
}

/* 设置按钮 */
.settings-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid rgba(255, 154, 158, 0.4);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    z-index: 10;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
    line-height: 1;
    text-align: center;
    padding: 0;
    margin: 0;
}

/* 分享按钮 */
.share-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    width: auto;
    min-width: 60px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    z-index: 10;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    line-height: 1;
    text-align: center;
    padding: 0 12px;
    margin: 0;
    color: white;
}

.settings-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 154, 158, 0.6);
}

.share-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
    border-color: rgba(255, 255, 255, 0.5);
}


/* 设置模态框 */
.settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.settings-modal.show {
    display: flex;
}

.settings-content {
    background: linear-gradient(135deg, #fff 0%, #ffeaa7 100%);
    border-radius: 20px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    border: 3px solid #fff;
    position: relative;
    animation: slideInFromTop 0.3s ease-out;
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(255, 154, 158, 0.2);
}

.settings-title {
    font-size: 1.4em;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.settings-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    transition: color 0.3s ease;
}

.settings-close:hover {
    color: #333;
}

.settings-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    border-bottom: 1px solid rgba(255, 154, 158, 0.1);
}

.settings-option:last-child {
    border-bottom: none;
}

.settings-label {
    font-size: 1.1em;
    color: #333;
    font-weight: 500;
}

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

/* 切换开关 */
.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
    background: #ccc;
    border-radius: 13px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.toggle-switch.active {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
}

.toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch.active .toggle-slider {
    transform: translateX(24px);
}

/* 摄像头切换按钮 */
.camera-switch-btn {
    background: transparent;
    color: #333;
    border: none;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    margin: 0;
}

/* 摄像头区域 */
.camera-section {
    margin-bottom: 24px;
    position: relative;
}

.camera-container {
    position: relative;
    width: 280px;
    height: 280px;
    margin: 0 auto;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(255, 154, 158, 0.3);
    background: linear-gradient(135deg, #ffeaa7 0%, #fab1a0 100%);
    border: 4px solid #fff;
    position: relative;
}

.camera-container::before {
    content: '📸';
    position: absolute;
    top: -15px;
    right: -15px;
    font-size: 32px;
    z-index: 10;
    animation: bounce 2s ease-in-out infinite;
}

/* 视频和图片 */
#video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #f0f0f0;
    transition: transform 0.3s ease;
}

#video.mirror {
    transform: scaleX(-1);
}

#canvas {
    display: none;
}

#capturedImg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    transition: transform 0.3s ease;
}

#capturedImg.mirror {
    transform: scaleX(-1);
}

/* 控制按钮 */
.controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}

.btn {
    padding: 16px 24px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 154, 158, 0.4);
    border: 2px solid #fff;
}

.btn-primary:active {
    transform: scale(0.95);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(255, 154, 158, 0.6);
    transform: translateY(-2px);
}

.btn-secondary {
    background: linear-gradient(135deg, #ffeaa7 0%, #fab1a0 100%);
    color: #333;
    box-shadow: 0 4px 15px rgba(255, 154, 158, 0.4);
    border: 2px solid #fff;
}

.btn-secondary:active {
    transform: scale(0.95);
}

.btn-secondary:hover {
    box-shadow: 0 6px 20px rgba(255, 154, 158, 0.6);
    transform: translateY(-2px);
}

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

/* 分析结果区域 */
.analysis-section {
    margin-top: 24px;
    padding: 20px 16px;
    background: linear-gradient(135deg, #ffeaa7 0%, #fab1a0 100%);
    border-radius: 20px;
    border: 3px solid #fff;
    box-shadow: 0 8px 24px rgba(255, 234, 167, 0.3);
    position: relative;
}

.analysis-section::before {
    content: '🎨';
    position: absolute;
    top: -15px;
    left: 20px;
    font-size: 28px;
    background: #fff;
    border-radius: 50%;
    padding: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.analysis-section h3 {
    color: #333;
    margin-bottom: 16px;
    font-size: 1.3em;
    font-weight: 600;
    text-align: center;
    margin-top: 20px;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 16px;
}

.spinner {
    border: 4px solid #ffeaa7;
    border-top: 4px solid #ff9a9e;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
    box-shadow: 0 4px 12px rgba(255, 154, 158, 0.3);
}

/* 状态显示 */
.status {
    text-align: center;
    padding: 8px;
    margin: 16px 0;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9em;
}

.status.uploading {
    background: linear-gradient(135deg, #ffeaa7 0%, #fab1a0 100%);
    color: #333;
    border: 2px solid #fff;
}

.status.analyzing {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    color: #fff;
    border: 2px solid #fff;
}

.status.completed {
    background: linear-gradient(135deg, #a8e6cf 0%, #88d8a3 100%);
    color: #333;
    border: 2px solid #fff;
}

/* 结果显示 */
.results {
    background: transparent;
    padding: 0;
    border-radius: 0;
    margin-top: 16px;
    border: none;
    box-shadow: none;
}

.result-item {
    padding: 16px;
    margin: 12px 0;
    background: linear-gradient(135deg, #fff 0%, #ffeaa7 100%);
    border-radius: 12px;
    border-left: 4px solid #ff9a9e;
    box-shadow: 0 2px 8px rgba(255, 154, 158, 0.1);
}

.result-content-simple {
    padding: 0;
    margin: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
}

.result-label {
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
    font-size: 0.9em;
}

.result-confidence {
    color: #666;
    font-size: 0.8em;
}

.result-content {
    color: #333;
    line-height: 1.5;
    margin-top: 6px;
    white-space: pre-wrap;
    font-size: 0.9em;
    text-align: center;
}

.result-usage {
    color: #666;
    font-size: 0.8em;
    margin-top: 4px;
}

.result-model {
    color: #667eea;
    font-weight: 600;
    margin-top: 4px;
    font-size: 0.8em;
}

/* 错误容器 */
.error-container {
    margin: 16px 0;
}

/* 基础错误样式 */
.error-basic,
.error-trial-code,
.error-camera-permission,
.error-network,
.error-analysis,
.error-user-interaction {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border-radius: 12px;
    margin: 12px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

/* 错误图标 */
.error-icon {
    font-size: 24px;
    flex-shrink: 0;
    margin-top: 2px;
}

/* 错误内容区域 */
.error-content {
    flex: 1;
    min-width: 0;
}

.error-title {
    font-weight: 600;
    font-size: 1.1em;
    margin-bottom: 6px;
    color: #333;
}

.error-message {
    color: #666;
    line-height: 1.5;
    font-size: 0.95em;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* 错误操作按钮区域 */
.error-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.error-action-btn {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 154, 158, 0.3);
}

.error-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 154, 158, 0.4);
}

.error-action-btn:active {
    transform: translateY(0);
}

/* 不同类型的错误样式 */
.error-basic {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    border-color: #dc3545;
    color: #721c24;
}

.error-trial-code {
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
    border-color: #17a2b8;
    color: #0c5460;
}

.error-camera-permission {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #5a67d8;
}

.error-network {
    background: linear-gradient(135deg, #ffeaa7 0%, #fab1a0 100%);
    border-color: #f39c12;
    color: #8b4513;
}

.error-analysis {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    border-color: #e91e63;
    color: #8e24aa;
}

.error-user-interaction {
    background: linear-gradient(135deg, #a8e6cf 0%, #88d8a3 100%);
    border-color: #28a745;
    color: #155724;
}


.success {
    background: #d4edda;
    color: #155724;
    padding: 12px;
    border-radius: 8px;
    margin: 16px 0;
    border-left: 4px solid #28a745;
    font-size: 0.9em;
}

/* 动画效果 */
@keyframes slideInFromTop {
    0% {
        opacity: 0;
        transform: translateY(-20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes sparkle {
    0%, 100% { transform: scale(1) rotate(0deg); opacity: 0.7; }
    50% { transform: scale(1.2) rotate(180deg); opacity: 1; }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes ribbonFloat {
    0%, 100% { transform: rotate(-2deg) translateY(0px); }
    50% { transform: rotate(-2deg) translateY(-3px); }
}

@keyframes ribbonShine {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

/* 分享图按钮样式 - 已移动到右上角 */

/* 移动端响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 5px;
    }
    
    .container {
        border-radius: 12px;
        min-height: calc(100vh - 10px);
    }
    
    .header {
        padding: 16px 12px;
    }
    
    .header h1 {
        font-size: 1.5em;
    }
    
    .main-content {
        padding: 16px 12px;
    }
    
    .camera-container {
        width: 240px;
        height: 240px;
    }
    
    .btn {
        font-size: 15px;
        padding: 14px 20px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.3em;
    }
    
    .header p {
        font-size: 0.8em;
    }
    
    .camera-container {
        width: 200px;
        height: 200px;
    }
    
    .btn {
        font-size: 14px;
        padding: 12px 16px;
    }
}

/* 试用码输入模态框样式 */
.trial-code-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.trial-code-modal.show {
    opacity: 1;
    visibility: visible;
}

.trial-code-content {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 450px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
}

.trial-code-modal.show .trial-code-content {
    transform: scale(1) translateY(0);
}

.trial-code-header {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    color: white;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.trial-code-header::before {
    content: '🔑';
    position: absolute;
    top: 15px;
    left: 20px;
    font-size: 20px;
    animation: sparkle 2s ease-in-out infinite;
}

.trial-code-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0;
    margin-left: 30px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.trial-code-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.trial-code-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.trial-code-body {
    padding: 32px 24px;
}

.trial-code-description {
    text-align: center;
    margin-bottom: 24px;
}

.trial-code-description p {
    color: #666;
    font-size: 1rem;
    line-height: 1.5;
    margin: 0;
}

.trial-code-input-group {
    margin-bottom: 24px;
}

.trial-code-input {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid #e1e8ed;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #fafbfc;
    outline: none;
}

.trial-code-input:focus {
    border-color: #ff9a9e;
    background: white;
    box-shadow: 0 0 0 3px rgba(255, 154, 158, 0.1);
    transform: translateY(-1px);
}

.trial-code-input::placeholder {
    color: #a0aec0;
    font-style: italic;
}

.trial-code-input-feedback {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    display: none;
    transition: all 0.3s ease;
}

.trial-code-input-feedback.error {
    background: #fed7d7;
    color: #c53030;
    border: 1px solid #feb2b2;
    display: block;
}

.trial-code-input-feedback.success {
    background: #c6f6d5;
    color: #2f855a;
    border: 1px solid #9ae6b4;
    display: block;
}

.trial-code-input-feedback.info {
    background: #bee3f8;
    color: #2b6cb0;
    border: 1px solid #90cdf4;
    display: block;
}

.trial-code-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.trial-code-submit,
.trial-code-cancel {
    flex: 1;
    padding: 14px 20px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.trial-code-submit {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 154, 158, 0.4);
}

.trial-code-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 154, 158, 0.6);
}

.trial-code-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.trial-code-cancel {
    background: #f7fafc;
    color: #4a5568;
    border: 2px solid #e2e8f0;
}

.trial-code-cancel:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
    transform: translateY(-1px);
}

/* 试用码模态框移动端适配 */
@media (max-width: 768px) {
    .trial-code-content {
        width: 95%;
        max-width: 400px;
    }
    
    .trial-code-body {
        padding: 24px 20px;
    }
    
    .trial-code-actions {
        flex-direction: column;
    }
    
    .trial-code-submit,
    .trial-code-cancel {
        width: 100%;
    }
}
