/* ============================================
   全局样式与变量定义
   ============================================ */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    color: #333;
}

/* ============================================
   主容器样式
   ============================================ */
.container {
    max-width: 1000px;
    margin: 20px auto 30px;
    background-color: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* ============================================
   头部样式
   ============================================ */
header {
    background: white;
    color: #000;
    padding: 25px 30px;
    text-align: center;
}

h1 {
    font-size: 28px;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 16px;
    opacity: 0.9;
    margin-bottom: 10px;
}

/* ============================================
   内容区域
   ============================================ */
.content {
    padding: 30px;
}

/* ============================================
   按钮通用样式
   ============================================ */
.action-btn, .btn {
    padding: 12px 28px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    border: none;
    transition: all 0.3s;
    min-width: 160px;
}

.convert-btn {
    background: linear-gradient(to right, #4a6fa5, #3a5a8c);
    color: white;
}

.convert-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(58, 90, 140, 0.3);
}

.convert-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.reset-btn {
    background: linear-gradient(to right, #6c757d, #545b62);
    color: white;
}

.reset-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(108, 117, 125, 0.3);
}

/* ============================================
   表单元素通用样式
   ============================================ */
textarea, select, input[type="number"], input[type="text"] {
    width: 100%;
    padding: 14px;
    border: 2px solid #c3cfe2;
    border-radius: 10px;
    font-size: 16px;
    background-color: #f8fafc;
    transition: all 0.3s;
}

textarea:focus, select:focus, input[type="number"]:focus, input[type="text"]:focus {
    outline: none;
    border-color: #4a6fa5;
    box-shadow: 0 0 0 3px rgba(74, 111, 165, 0.2);
}

textarea {
    resize: vertical;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #3a5a8c;
    font-size: 16px;
}

/* ============================================
   结果展示区通用样式
   ============================================ */
.results-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.result-box {
    position: relative;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
    min-height: 180px;
}

.result-title {
    font-weight: 600;
    margin-bottom: 15px;
    color: #3a5a8c;
    font-size: 18px;
    display: flex;
    align-items: center;
}

.result-title-icon {
    margin-right: 8px;
    font-size: 20px;
}

.result-content {
    font-size: 16px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ============================================
   复制按钮通用样式
   ============================================ */
.copy-btn {
    position: absolute;
    right: 15px;
    top: 15px;
    padding: 8px 16px;
    font-size: 14px;
    background: linear-gradient(to right, #28a745, #1e7e34);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.copy-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(40, 167, 69, 0.3);
}

/* ============================================
   提示/气泡/提示框样式
   ============================================ */
.tip {
    background-color: #e8f4ff;
    padding: 12px 15px;
    border-radius: 8px;
    margin-top: 15px;
    font-size: 14px;
    border-left: 4px solid #4a6fa5;
}

.tip strong {
    color: #3a5a8c;
}

.copy-bubble {
    position: absolute;
    background-color: #28a745;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    z-index: 10;
    white-space: nowrap;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    animation: bubbleFade 1.5s ease-out;
}

@keyframes bubbleFade {
    0% { opacity: 0; transform: translateY(5px); }
    20% { opacity: 1; transform: translateY(0); }
    80% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-5px); }
}

/* ============================================
   说明书/使用指南样式
   ============================================ */
.instructions {
    background-color: #f8f9fa;
    border-left: 4px solid #4a6fa5;
    padding: 20px;
    margin-top: 30px;
    border-radius: 0 10px 10px 0;
}

.instructions h3 {
    color: #3a5a8c;
    margin-bottom: 15px;
    font-size: 20px;
}

.instructions ul {
    padding-left: 20px;
}

.instructions li {
    margin-bottom: 10px;
    line-height: 1.5;
}

.instructions strong {
    color: #3a5a8c;
}

/* ============================================
   页脚样式
   ============================================ */
footer {
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 14px;
    border-top: 1px solid #e2e8f0;
    margin-top: 30px;
}

/* ============================================
   响应式设计
   ============================================ */
@media (max-width: 768px) {
    .container {
        border-radius: 10px;
    }

    .content {
        padding: 20px;
    }

    .action-buttons {
        flex-direction: column;
        align-items: center;
    }

    .action-btn {
        width: 100%;
        max-width: 300px;
    }

    .results-container {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   页面1: 首饰标题助手 (ssbt.html) 特有样式
   ============================================ */
.input-area {
    margin-bottom: 30px;
}

.input-group {
    margin-bottom: 25px;
}

.input-tip {
    font-size: 14px;
    color: #666;
    margin-top: 5px;
    margin-left: 5px;
}

.controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.control-group {
    display: flex;
    flex-direction: column;
}

.style-select {
    width: 100%;
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.api-notice {
    background-color: #fff3cd;
    color: #856404;
    padding: 12px 15px;
    border-radius: 8px;
    margin-top: 15px;
    font-size: 14px;
    border-left: 4px solid #ffc107;
}

/* ============================================
   页面2: 尺寸换算工具 (chicun.html) 特有样式
   ============================================ */
.converter {
    display: flex;
    flex-direction: column;
    gap: 25px;
    margin-bottom: 30px;
}

@media (min-width: 768px) {
    .converter {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.input-with-unit {
    position: relative;
}

.unit-label {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background-color: #e8f4ff;
    color: #3a5a8c;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
}

.swap-section {
    display: flex;
    justify-content: center;
    align-items: center;
}

.swap-btn {
    background: linear-gradient(to right, #4a6fa5, #3a5a8c);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(58, 90, 140, 0.2);
}

.swap-btn:hover {
    transform: rotate(180deg) scale(1.1);
    box-shadow: 0 6px 15px rgba(58, 90, 140, 0.3);
}

.main-result {
    padding: 25px;
    background: linear-gradient(to right, #e8f4ff, #d4e4ff);
    border-radius: 12px;
    margin-bottom: 20px;
    border: 2px solid #c3cfe2;
    position: relative;
}

.result-value {
    font-size: 28px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 5px;
}

.result-text {
    font-size: 16px;
    color: #4a6fa5;
    font-weight: 500;
}

.precision-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.precision-result {
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
    position: relative;
    transition: all 0.3s;
}

.precision-result:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.precision-label {
    font-weight: 600;
    color: #3a5a8c;
    margin-bottom: 10px;
    font-size: 16px;
    display: flex;
    align-items: center;
}

.precision-label-icon {
    margin-right: 8px;
    font-size: 18px;
}

.precision-value {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
}

.precision-copy-btn {
    position: absolute;
    right: 15px;
    bottom: 15px;
    padding: 6px 12px;
    background: linear-gradient(to right, #4a6fa5, #3a5a8c);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
}

.precision-copy-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(58, 90, 140, 0.3);
}

.unit-reference {
    margin-top: 40px;
    padding: 25px;
    background-color: #f0f8ff;
    border-radius: 12px;
    border-left: 5px solid #4a6fa5;
}

.unit-reference h2 {
    color: #3a5a8c;
    margin-bottom: 20px;
    font-size: 22px;
    display: flex;
    align-items: center;
}

.unit-reference h2 .icon {
    margin-right: 10px;
    font-size: 24px;
}

.unit-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.unit-table th {
    background: linear-gradient(to right, #4a6fa5, #3a5a8c);
    color: white;
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

.unit-table td {
    padding: 15px;
    border-bottom: 1px solid #dee2e6;
}

.unit-table tr:nth-child(even) {
    background-color: #f8f9fa;
}

.unit-table tr:hover {
    background-color: #e8f4ff;
}

.conversion-relation {
    font-weight: 600;
    color: #3a5a8c;
}

/* ============================================
   页面3: PDF拆分工具 (chai.html) 特有样式 (重构为新风格)
   ============================================ */
.upload-section, .json-section, .preview-section, .action-section {
    margin-bottom: 25px;
    padding: 20px;
    border-radius: 12px;
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    transition: all 0.3s;
}

.upload-section:hover, .json-section:hover, .preview-section:hover, .action-section:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

h2 {
    margin-bottom: 15px;
    color: #4a6fa5;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

h2::before {
    content: "📄";
    font-size: 20px;
}

h2:first-of-type::before {
    content: "📁";
}

.json-section h2::before {
    content: "📝";
}

.preview-section h2::before {
    content: "👁️";
}

.action-section h2::before {
    content: "⚙️";
}

.file-input-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

.file-input {
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-input-label {
    display: block;
    padding: 14px 20px;
    background: linear-gradient(to right, #4a6fa5, #3a5a8c);
    color: white;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    font-size: 15px;
}

.file-input-label:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(58, 90, 140, 0.3);
}

.selected-file {
    margin-top: 12px;
    font-style: italic;
    color: #666;
    text-align: center;
    font-size: 14px;
}

.preview {
    background: white;
    padding: 15px;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
    max-height: 250px;
    overflow-y: auto;
}

.preview-item {
    margin-bottom: 12px;
    padding: 12px;
    background: linear-gradient(135deg, #f8f9fa, #fff);
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s;
}

.preview-item:hover {
    transform: translateX(4px);
    border-left: 3px solid #4a6fa5;
}

.preview-item h4 {
    color: #3a5a8c;
    margin-bottom: 8px;
    font-size: 16px;
}

.preview-item p {
    color: #666;
    font-size: 13px;
    margin-bottom: 6px;
}

.preview-item ul {
    padding-left: 20px;
    margin-top: 6px;
}

.preview-item li {
    font-size: 12px;
    color: #888;
}

.status {
    margin-top: 15px;
    padding: 12px;
    border-radius: 8px;
    display: none;
    text-align: center;
    font-weight: 500;
}

.status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
}

.status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
}

.progress-bar {
    width: 100%;
    height: 12px;
    background-color: #e2e8f0;
    border-radius: 20px;
    margin: 15px 0;
    overflow: hidden;
}

.progress {
    height: 100%;
    background: linear-gradient(90deg, #4a6fa5, #3a5a8c);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 20px;
}

.loading {
    display: none;
    text-align: center;
    padding: 20px 0;
}

.spinner {
    border: 4px solid #e2e8f0;
    border-top: 4px solid #4a6fa5;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

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

/* PDF工具响应式覆盖 */
@media (max-width: 768px) {
    .unit-table {
        display: block;
        overflow-x: auto;
    }
    
    .preview-item:hover {
        transform: none;
    }
}