/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    min-height: 100vh;
    padding: 15px;
    color: #333;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    border: 1px solid #e5e7eb;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 30px);
    position: relative;
}

/* 工具栏 */
.toolbar {
    position: absolute;
    top: 15px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 100;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #e0f2fe;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9em;
    font-weight: 500;
    color: #0284c7;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.toolbar-btn:hover {
    background: rgba(14, 165, 233, 0.1);
    border-color: #0ea5e9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.2);
}

.toolbar-btn .btn-icon {
    font-size: 1.2em;
}

.toolbar-btn .btn-text {
    font-size: 0.85em;
}

/* 深色模式 */
body.dark-mode {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

body.dark-mode .container {
    background: #1e293b;
    border-color: #334155;
}

body.dark-mode .header {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
}

body.dark-mode .toolbar-btn {
    background: rgba(30, 41, 59, 0.95);
    border-color: #334155;
    color: #38bdf8;
}

body.dark-mode .toolbar-btn:hover {
    background: rgba(14, 165, 233, 0.2);
    border-color: #0ea5e9;
}

body.dark-mode .upload-area {
    background: #0f172a;
    border-color: #334155;
}

body.dark-mode .upload-area:hover {
    background: #1e293b;
    border-color: #0ea5e9;
}

body.dark-mode .upload-placeholder p {
    color: #38bdf8;
}

body.dark-mode .file-hint {
    color: #64748b;
}

body.dark-mode .image-info {
    background: #0f172a;
    color: #94a3b8;
}

body.dark-mode .usage-guide {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border-color: #334155;
}

body.dark-mode .usage-guide h3 {
    color: #38bdf8;
}

body.dark-mode .guide-step {
    background: #0f172a;
    border: 1px solid #334155;
}

body.dark-mode .step-text strong {
    color: #38bdf8;
}

body.dark-mode .step-text p {
    color: #94a3b8;
}

body.dark-mode .tool-panel {
    background: #0f172a;
    border: 1px solid #334155;
}

body.dark-mode .tool-panel h3 {
    color: #38bdf8;
}

body.dark-mode .form-group label {
    color: #cbd5e1;
}

body.dark-mode .form-group input,
body.dark-mode .form-group select {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

body.dark-mode .result-section {
    background: #0f172a;
    border: 1px solid #334155;
}

body.dark-mode .result-section h3 {
    color: #38bdf8;
}

body.dark-mode .footer {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border-top-color: #334155;
}

body.dark-mode .footer-brand {
    color: #38bdf8;
}

body.dark-mode .footer-brand strong {
    color: #0ea5e9;
}

body.dark-mode .footer-copyright {
    color: #64748b;
}

body.dark-mode .tab-btn {
    background: #0f172a;
    border-color: #334155;
    color: #94a3b8;
}

body.dark-mode .tab-btn:hover {
    border-color: #0ea5e9;
    color: #38bdf8;
}

body.dark-mode .tab-btn.active {
    background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
    color: white;
}

/* 头部 */
.header {
    background: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
    color: white;
    text-align: center;
    padding: 40px 20px;
}

.header h1 {
    font-size: 3em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.2em;
    opacity: 0.9;
}

/* 主内容 */
.main-content {
    padding: 40px;
    flex: 1;
}

/* 上传区域 */
.upload-section {
    margin-bottom: 30px;
}

.upload-area {
    border: 3px dashed #0ea5e9;
    border-radius: 15px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f0f9ff;
    position: relative;
    min-height: 200px;
}

.upload-area:hover {
    border-color: #06b6d4;
    background: #e0f2fe;
    transform: translateY(-2px);
}

.upload-area.dragover {
    border-color: #06b6d4;
    background: #cffafe;
    transform: scale(1.02);
}

.upload-area.has-image {
    padding: 20px;
    cursor: default;
    border: 2px solid #0ea5e9;
}

.upload-icon {
    color: #0ea5e9;
    margin-bottom: 20px;
}

.upload-placeholder p {
    font-size: 1.3em;
    color: #0ea5e9;
    margin-bottom: 10px;
    font-weight: 500;
}

.file-hint {
    color: #999;
    font-size: 0.9em;
}

/* 预览区域 */
.preview-section {
    width: 100%;
    padding: 0;
}

.preview-container {
    text-align: center;
    position: relative;
}

.preview-container img {
    max-width: 100%;
    max-height: 500px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 15px;
}

.btn-change-image {
    margin-top: 10px;
    padding: 10px 20px;
    background: #f0f0f0;
    border: 2px solid #0ea5e9;
    border-radius: 8px;
    color: #0284c7;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.btn-change-image:hover {
    background: #0ea5e9;
    color: white;
    transform: translateY(-2px);
}

.image-info {
    margin-top: 15px;
    padding: 15px;
    background: #f0f9ff;
    border-radius: 10px;
    color: #666;
    font-size: 0.9em;
}

/* 使用说明 */
.usage-guide {
    margin-top: 30px;
    padding: 25px 30px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 15px;
    border: 2px solid #bae6fd;
}

.usage-guide h3 {
    color: #0284c7;
    margin-bottom: 20px;
    font-size: 1.3em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.guide-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.guide-step {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    padding: 15px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.guide-step:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.15);
}

.step-number {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1em;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.3);
}

.step-text {
    flex: 1;
}

.step-text strong {
    color: #0284c7;
    font-size: 1.05em;
    display: block;
    margin-bottom: 5px;
}

.step-text p {
    color: #64748b;
    font-size: 0.9em;
    line-height: 1.5;
    margin: 0;
}

/* 工具区域 */
.tools-section {
    margin-top: 40px;
}

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 30px;
    padding: 0;
}

.tab-btn {
    padding: 16px 28px;
    border: 2px solid #e5e7eb;
    background: white;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.05em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #6b7280;
    font-weight: 500;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.tab-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.tab-btn:hover {
    border-color: #0ea5e9;
    color: #0284c7;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(14, 165, 233, 0.25);
}

.tab-btn.active {
    background: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
    color: white;
    font-weight: 600;
    border-color: transparent;
    box-shadow: 0 8px 25px rgba(14, 165, 233, 0.4);
    transform: translateY(-2px);
}

.tab-btn.active::before {
    opacity: 1;
}

.tab-icon {
    font-size: 1.3em;
    margin-right: 8px;
    display: inline-block;
    vertical-align: middle;
}

.tab-text {
    display: inline-block;
    vertical-align: middle;
}

.tool-panel {
    padding: 30px;
    background: #f0f9ff;
    border-radius: 15px;
    margin-bottom: 20px;
}

.tool-panel h3 {
    color: #0284c7;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.tool-desc {
    color: #666;
    margin-bottom: 20px;
    font-size: 1.05em;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.form-group input[type="number"],
.form-group input[type="text"],
.form-group select {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #0ea5e9;
}

.form-group input[type="range"] {
    width: calc(100% - 60px);
    margin-right: 10px;
}

.form-group span {
    display: inline-block;
    min-width: 50px;
    text-align: center;
    font-weight: 600;
    color: #0284c7;
}

.quick-angles {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

/* 按钮样式 */
.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.btn-primary {
    background: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-primary::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-primary:hover::after {
    width: 300px;
    height: 300px;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(14, 165, 233, 0.5);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.5);
}

.btn-secondary {
    background: #f3f4f6;
    color: #6b7280;
    border: 2px solid #e5e7eb;
}

.btn-secondary:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
    transform: translateY(-2px);
}

.btn-small {
    padding: 10px 20px;
    font-size: 0.95em;
    border-radius: 8px;
}

/* 结果区域 */
.result-section {
    margin-top: 40px;
    padding: 30px;
    background: #f0f9ff;
    border-radius: 15px;
}

.result-section h3 {
    color: #0284c7;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.result-container {
    text-align: center;
    margin-bottom: 20px;
}

.result-container img {
    max-width: 100%;
    max-height: 500px;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.result-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* 加载动画 */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #0ea5e9;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading p {
    margin-top: 20px;
    font-size: 1.2em;
    color: #0284c7;
    font-weight: 600;
}

/* 页脚 */
.footer {
    text-align: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #f0f9ff 100%);
    color: #64748b;
    border-top: 2px solid #e0f2fe;
    margin-top: auto;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.03);
}

.footer-content {
    max-width: 800px;
    margin: 0 auto;
}

.footer-brand {
    font-size: 1.1em;
    color: #0284c7;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.footer-icon {
    font-size: 1.4em;
    animation: float 3s ease-in-out infinite;
}

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

.footer-brand strong {
    color: #0ea5e9;
    font-weight: 700;
}

.footer-tech {
    font-size: 0.95em;
    color: #64748b;
    margin-bottom: 12px;
    line-height: 1.6;
}

.footer-tech strong {
    color: #0284c7;
    font-weight: 600;
}

.footer-copyright {
    font-size: 0.9em;
    color: #94a3b8;
    margin-top: 8px;
}

.footer p {
    margin: 0;
    padding: 4px 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        min-height: calc(100vh - 20px);
    }

    .header h1 {
        font-size: 2em;
    }

    .main-content {
        padding: 20px;
    }

    .tabs {
        flex-direction: column;
    }

    .tab-btn {
        width: 100%;
    }

    .result-actions {
        flex-direction: column;
    }

    .result-actions .btn {
        width: 100%;
    }

    .quick-angles {
        flex-direction: column;
    }

    .quick-angles .btn {
        width: 100%;
    }

    .footer {
        padding: 20px 15px;
    }

    .footer-brand {
        font-size: 1em;
        flex-direction: column;
        gap: 4px;
    }

    .footer-tech {
        font-size: 0.85em;
    }

    .footer-copyright {
        font-size: 0.8em;
    }

    .usage-guide {
        padding: 20px 15px;
    }

    .usage-guide h3 {
        font-size: 1.1em;
    }

    .guide-content {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .guide-step {
        padding: 12px;
    }

    .step-number {
        width: 32px;
        height: 32px;
        font-size: 1em;
    }

    .step-text strong {
        font-size: 1em;
    }

    .step-text p {
        font-size: 0.85em;
    }
}

/* ===================== Toast 提示系统 ===================== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 280px;
    max-width: 400px;
    opacity: 0;
    transform: translateX(100px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
    border-left: 4px solid #e5e7eb;
}

.toast-show {
    opacity: 1;
    transform: translateX(0);
}

.toast-hide {
    opacity: 0;
    transform: translateX(100px) scale(0.95);
}

.toast-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 14px;
    font-weight: bold;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
}

/* Toast 类型样式 */
.toast-success {
    border-left-color: #10b981;
}

.toast-success .toast-icon {
    background: #d1fae5;
    color: #10b981;
}

.toast-error {
    border-left-color: #ef4444;
}

.toast-error .toast-icon {
    background: #fee2e2;
    color: #ef4444;
}

.toast-warning {
    border-left-color: #f59e0b;
}

.toast-warning .toast-icon {
    background: #fef3c7;
    color: #f59e0b;
}

.toast-info {
    border-left-color: #3b82f6;
}

.toast-info .toast-icon {
    background: #dbeafe;
    color: #3b82f6;
}

/* 深色模式下的 Toast */
body.dark-mode .toast {
    background: #1f2937;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

body.dark-mode .toast-message {
    color: #e5e7eb;
}

body.dark-mode .toast-success .toast-icon {
    background: rgba(16, 185, 129, 0.2);
}

body.dark-mode .toast-error .toast-icon {
    background: rgba(239, 68, 68, 0.2);
}

body.dark-mode .toast-warning .toast-icon {
    background: rgba(245, 158, 11, 0.2);
}

body.dark-mode .toast-info .toast-icon {
    background: rgba(59, 130, 246, 0.2);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
        align-items: center;
    }
    
    .toast {
        min-width: auto;
        max-width: 100%;
        width: 100%;
    }
}

