﻿* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #ff6b6b;
    --primary-hover: #ff5252;
    --secondary-color: #6b7280;
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --bg-color: #ffffff;
    --card-bg: #ffffff;
    --border-color: #e5e7eb;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --radius-lg: 20px;
    --fruit-orange: #ff9f43;
    --fruit-lemon: #feca57;
    --fruit-apple: #ff6b6b;
    --fruit-grape: #a29bfe;
    --fruit-mint: #1dd1a1;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 12px;
    min-height: 100vh;
}

@media (min-width: 768px) {
    .container {
        max-width: 1200px;
        padding: 20px;
    }
}

/* Header */
header {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

header h1 {
    font-size: 20px;
    font-weight: 600;
}

nav {
    display: flex;
    gap: 8px;
    width: 100%;
    justify-content: center;
}

@media (min-width: 768px) {
    header {
        flex-direction: row;
        justify-content: space-between;
        padding: 20px 30px;
        border-radius: var(--radius-lg);
        margin-bottom: 24px;
    }
    
    header h1 {
        font-size: 24px;
    }
    
    nav {
        width: auto;
    }
}

.nav-btn {
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    max-width: 120px;
}

@media (min-width: 768px) {
    .nav-btn {
        flex: none;
        padding: 10px 20px;
    }
}

.nav-btn:hover {
    background: #f3f4f6;
    color: var(--text-primary);
}

.nav-btn.active {
    background: var(--primary-color);
    color: white;
}

/* Page */
.page {
    display: none;
}

.page.active {
    display: block;
}

/* Preview Page - 白色主题 */
.preview-container {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: var(--radius);
    padding: 20px 16px;
    box-shadow: var(--shadow);
    border: 2px solid #e5e7eb;
    position: relative;
    overflow: hidden;
}

.preview-container::before {
    content: '🍊🍋🍎🍇🥝';
    position: absolute;
    top: 8px;
    right: 12px;
    font-size: 18px;
    opacity: 0.3;
}

.folders-section h2 {
    font-size: 18px;
    margin-bottom: 16px;
    color: var(--fruit-orange);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.folders-section h2::before {
    content: '🌞';
    font-size: 22px;
}

@media (min-width: 768px) {
    .preview-container {
        border-radius: var(--radius-lg);
        padding: 30px;
        box-shadow: var(--shadow-lg);
        border-width: 3px;
    }
    
    .preview-container::before {
        top: 10px;
        right: 20px;
        font-size: 24px;
    }
    
    .folders-section h2 {
        font-size: 22px;
        margin-bottom: 24px;
        gap: 10px;
    }
    
    .folders-section h2::before {
        font-size: 26px;
    }
}

.folder-tags {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.folder-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    border-radius: var(--radius);
    min-height: auto;
    border: 2px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    margin-bottom: 12px;
}

.folder-row:hover {
    border-color: var(--fruit-orange);
    box-shadow: 0 4px 12px rgba(255, 159, 67, 0.2);
}

.folder-label {
    font-weight: 700;
    color: var(--fruit-apple);
    font-size: 14px;
    white-space: nowrap;
    overflow: visible;
    display: flex;
    align-items: center;
    gap: 6px;
}

.folder-label::before {
    content: '🍃';
    font-size: 14px;
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
}

@media (min-width: 768px) {
    .folder-row {
        flex-direction: row;
        align-items: flex-start;
        gap: 16px;
        padding: 16px 20px;
        min-height: 60px;
        margin-bottom: 0;
    }
    
    .folder-row:hover {
        transform: translateX(5px);
    }
    
    .folder-label {
        min-width: 120px;
        font-size: 15px;
        padding-top: 8px;
    }
    
    .tags-container {
        flex: 1;
        width: auto;
    }
}

.user-input-container {
    flex: 1;
    display: flex;
}

.input-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    justify-content: flex-start;
}

.user-text-input {
    width: 100%;
    min-height: 80px;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    outline: none;
    background: #ffffff;
    color: var(--text-primary);
    resize: vertical;
}

/* 价格输入框 - 单行样式 */
.user-text-input[type="text"] {
    min-height: 44px;
    height: 44px;
    padding: 10px 14px;
    resize: none;
}

@media (min-width: 768px) {
    .user-text-input {
        width: 50%;
    }
    
    .user-text-input[type="text"] {
        min-height: 36px;
        height: 36px;
        padding: 8px 14px;
    }
}

.user-text-input:focus {
    border-color: var(--primary-color);
}

.tag {
    padding: 10px 14px;
    background: linear-gradient(135deg, #ffffff 0%, #f0f9ff 100%);
    border: 2px solid #e0f2fe;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    position: relative;
    overflow: hidden;
    color: var(--text-primary);
}

@media (min-width: 768px) {
    .tag {
        padding: 8px 16px;
        border-radius: 25px;
        font-size: 13px;
    }
}

.tag::before {
    content: '🍊';
    margin-right: 4px;
    font-size: 12px;
}

.tag:hover {
    border-color: var(--fruit-orange);
    color: var(--fruit-orange);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(224, 123, 57, 0.3);
}

.tag.selected {
    background: linear-gradient(135deg, #e07b39 0%, #e85a4f 100%);
    border-color: var(--fruit-orange);
    color: white;
    box-shadow: 0 4px 15px rgba(224, 123, 57, 0.4);
}

.tag.selected::before {
    content: '✨';
}

.tag.empty {
    color: var(--text-secondary);
    font-style: italic;
    cursor: default;
    background: #f3f4f6;
    border-color: #e5e7eb;
}

.tag.empty:hover {
    border-color: #e5e7eb;
    color: var(--text-secondary);
    transform: none;
    box-shadow: none;
}

.action-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 24px 0;
    justify-content: center;
}

@media (min-width: 768px) {
    .action-section {
        flex-direction: row;
        gap: 16px;
        margin: 40px 0;
    }
}

.btn-primary {
    padding: 16px 32px;
    background: linear-gradient(135deg, #ff9f43 0%, #ff6b6b 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
    position: relative;
    overflow: hidden;
    width: 100%;
}

@media (min-width: 768px) {
    .btn-primary {
        padding: 14px 32px;
        border-radius: 30px;
        width: auto;
    }
}

.btn-primary::before {
    content: '🍊';
    margin-right: 8px;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff9f43 100%);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.5);
}

.btn-secondary {
    padding: 14px 28px;
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    color: var(--text-primary);
    border: 2px solid #e5e7eb;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

@media (min-width: 768px) {
    .btn-secondary {
        border-radius: 30px;
        width: auto;
    }
}

.btn-secondary::before {
    content: '🧹';
    margin-right: 6px;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-color: var(--fruit-orange);
    transform: translateY(-2px);
}

.btn-danger {
    padding: 10px 20px;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-danger:hover {
    background: var(--danger-hover);
}

.result-section {
    margin-top: 24px;
    padding: 20px 16px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: var(--radius);
    border: 2px dashed #cbd5e1;
    position: relative;
}

.result-section::before {
    content: '📋';
    position: absolute;
    top: -12px;
    left: 20px;
    font-size: 24px;
    background: white;
    padding: 0 8px;
    border-radius: 50%;
}

.result-section h3 {
    font-size: 16px;
    margin-bottom: 16px;
    color: var(--fruit-orange);
    font-weight: 700;
    padding-left: 10px;
}

@media (min-width: 768px) {
    .result-section {
        margin-top: 32px;
        padding: 28px;
        border-radius: var(--radius-lg);
        border-width: 3px;
    }
    
    .result-section::before {
        top: -15px;
        left: 30px;
        font-size: 28px;
        padding: 0 10px;
    }
    
    .result-section h3 {
        font-size: 18px;
        margin-bottom: 20px;
        padding-left: 20px;
    }
}

.result-content {
    min-height: 150px;
    max-height: 300px;
    padding: 16px;
    background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
    border: 2px solid #e5e7eb;
    border-radius: var(--radius);
    font-size: 15px;
    line-height: 1.8;
    white-space: pre-wrap;
    outline: none;
    overflow-y: auto;
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.03);
    color: var(--text-primary);
}

@media (min-width: 768px) {
    .result-content {
        min-height: 180px;
        max-height: 350px;
        padding: 24px;
        font-size: 16px;
        line-height: 2;
    }
}

.result-content:empty::before {
    content: attr(placeholder);
    color: var(--text-secondary);
    font-style: italic;
}

.result-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
    justify-content: center;
}

.result-actions .btn-primary::before {
    content: '📋';
}

.copy-tip {
    color: var(--fruit-mint);
    font-size: 15px;
    font-weight: 600;
    opacity: 0;
    transition: all 0.3s ease;
    background: #ecfdf5;
    padding: 6px 14px;
    border-radius: 20px;
}

.copy-tip.show {
    opacity: 1;
    transform: scale(1.1);
}

/* Admin Page */
.admin-container {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow);
}

.admin-header {
    margin-bottom: 24px;
}

.admin-header h2 {
    font-size: 20px;
    margin-bottom: 8px;
}

.admin-desc {
    color: var(--text-secondary);
    font-size: 14px;
}

.folders-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.folder-card {
    background: var(--bg-color);
    border-radius: var(--radius);
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.folder-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.folder-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.folder-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.folder-label-code {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary-color);
    border-radius: 4px;
    font-size: 13px;
    font-weight: 700;
}

.folder-info h4 {
    font-size: 16px;
    margin-bottom: 4px;
}

.folder-info span {
    font-size: 13px;
    color: var(--text-secondary);
}

.folder-files-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.file-badge {
    padding: 4px 10px;
    background: white;
    border-radius: 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

.btn-add-folder {
    width: 100%;
    padding: 20px;
    border: 2px dashed var(--border-color);
    background: transparent;
    border-radius: var(--radius);
    font-size: 15px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add-folder:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--radius);
    width: 95%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

@media (min-width: 768px) {
    .modal-content {
        border-radius: var(--radius-lg);
        width: 100%;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 16px;
}

@media (min-width: 768px) {
    .modal-header {
        padding: 20px 24px;
    }
    
    .modal-header h3 {
        font-size: 18px;
    }
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

@media (min-width: 768px) {
    .modal-body {
        padding: 24px;
    }
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.form-group input[type="text"] {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    outline: none;
}

.form-group input[type="text"]:focus {
    border-color: var(--primary-color);
}

.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #ffffff;
}

.upload-area:hover {
    border-color: var(--primary-color);
    background: #f9fafb;
}

.upload-area.dragover {
    border-color: var(--primary-color);
    background: #f9fafb;
}

.upload-icon {
    font-size: 32px;
    display: block;
    margin-bottom: 8px;
}

.upload-placeholder p {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.upload-hint {
    font-size: 12px;
    color: var(--text-secondary);
}

.files-list {
    max-height: 200px;
    overflow-y: auto;
}

/* 文件排序控件 */
.file-sort-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.sort-label {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}

#file-sort-select {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 13px;
    background: white;
    color: var(--text-primary);
    cursor: pointer;
    outline: none;
}

#file-sort-select:focus {
    border-color: var(--primary-color);
}

/* 文件序号 */
.file-index {
    display: inline-block;
    min-width: 20px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* 序号输入框 */
.file-sort-input {
    width: 40px;
    padding: 4px 6px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    text-align: center;
    color: var(--text-primary);
    background: white;
    outline: none;
    margin-right: 8px;
}

.file-sort-input:focus {
    border-color: var(--primary-color);
}

.file-sort-input::-webkit-inner-spin-button,
.file-sort-input::-webkit-outer-spin-button {
    opacity: 1;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #f9fafb;
    border-radius: var(--radius);
    margin-bottom: 8px;
}

.file-item .file-name {
    font-size: 13px;
    color: var(--text-primary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-item .file-actions {
    display: flex;
    gap: 6px;
}

.file-item .file-actions button {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.file-item .btn-view {
    background: #dbeafe;
    color: #1d4ed8;
}

.file-item .btn-view:hover {
    background: #bfdbfe;
}

.file-item .btn-delete {
    background: #fee2e2;
    color: #dc2626;
}

.file-item .btn-delete:hover {
    background: #fecaca;
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-color);
}

.modal-actions {
    display: flex;
    gap: 12px;
}

/* File Edit Modal */
.file-edit-modal .modal-content {
    max-width: 600px;
}

/* Login Modal */
.login-modal .modal-content {
    max-width: 360px;
}

.login-icon {
    text-align: center;
    font-size: 48px;
    margin-bottom: 12px;
}

.login-desc {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
}

.login-modal .form-group {
    margin-bottom: 8px;
}

.login-modal input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 16px;
    outline: none;
    text-align: center;
    letter-spacing: 4px;
}

.login-modal input[type="password"]:focus {
    border-color: var(--primary-color);
}

.login-error {
    color: var(--danger-color);
    font-size: 13px;
    text-align: center;
    margin-top: 8px;
    opacity: 0;
    transition: opacity 0.2s;
}

.login-error.show {
    opacity: 1;
}

.login-footer {
    justify-content: center;
}

.login-footer .modal-actions {
    width: 100%;
}

.login-footer .modal-actions button {
    flex: 1;
}

.file-edit-modal textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    line-height: 1.6;
    font-family: 'Courier New', monospace;
    resize: vertical;
    outline: none;
    background: #ffffff;
    color: var(--text-primary);
}

.file-edit-modal textarea:focus {
    border-color: var(--primary-color);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.empty-state p {
    font-size: 14px;
}

/* Mobile First Responsive - 手机端优先 */

/* Admin Page Mobile */
.admin-container {
    padding: 20px 16px;
}

.folders-list {
    grid-template-columns: 1fr;
    gap: 12px;
}

.folder-card {
    padding: 16px;
}

@media (min-width: 768px) {
    .admin-container {
        padding: 30px;
    }
    
    .folders-list {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 20px;
    }
    
    .folder-card {
        padding: 20px;
    }
}

/* Modal Footer Mobile */
.modal-footer {
    flex-direction: column;
    gap: 12px;
    padding: 16px 20px;
}

.modal-actions {
    width: 100%;
    justify-content: stretch;
}

.modal-actions button {
    flex: 1;
}

@media (min-width: 768px) {
    .modal-footer {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 16px 24px;
    }
    
    .modal-actions {
        width: auto;
        justify-content: flex-start;
    }
    
    .modal-actions button {
        flex: none;
    }
}

