﻿/* ===== Reset ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-light: #eff6ff;
    --primary-bg: rgba(59,130,246,0.08);
    --accent: #06b6d4;
    --accent-hover: #0891b2;
    --success: #22c55e;
    --success-hover: #16a34a;
    --warning: #f59e0b;
    --danger: #ef4444;
    --text: #0f172a;
    --text-2: #334155;
    --text-3: #64748b;
    --text-4: #94a3b8;
    --bg: #f8fafc;
    --card: #ffffff;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.03);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.08);
    --r: 14px;
    --rs: 10px;
    --rxs: 6px;
    --ease: 0.2s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(160deg, #eef2ff 0%, #f8fafc 40%, #ecfeff 100%);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ===== Container ===== */
.container {
    max-width: 460px;
    margin: 0 auto;
    padding: 40px 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.container-top { justify-content: flex-start; padding-top: 28px; }

/* ===== Brand ===== */
.brand { text-align: center; margin-bottom: 36px; }
.brand-icon {
    width: 60px; height: 60px;
    border-radius: 16px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px;
    box-shadow: 0 4px 14px rgba(59,130,246,0.25);
    position: relative;
}
.brand-icon::before { content: ''; width: 22px; height: 22px; border: 2.5px solid white; border-radius: 5px; }
.brand-icon::after { content: ''; position: absolute; width: 9px; height: 9px; background: white; border-radius: 50%; }
.brand h1 { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.brand p { color: var(--text-4); font-size: 13px; }

/* ===== Card ===== */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r);
    padding: 26px;
    width: 100%;
    box-shadow: var(--shadow);
}

/* ===== Landing ===== */
.landing-actions { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.btn-action {
    display: flex; align-items: center; gap: 14px;
    padding: 20px 22px;
    border-radius: var(--r);
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    cursor: pointer;
    transition: all var(--ease);
    text-decoration: none;
    box-shadow: var(--shadow-sm);
}
.btn-action:hover { box-shadow: var(--shadow-lg); border-color: var(--primary); transform: translateY(-1px); }
.btn-action:active { transform: translateY(0); }

.btn-icon { width: 48px; height: 48px; border-radius: 13px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.btn-icon-send { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.btn-icon-receive { background: linear-gradient(135deg, #06b6d4, #0891b2); }

.icon-send { position: relative; width: 20px; height: 20px; }
.icon-send::before { content: ''; position: absolute; width: 0; height: 0; border-left: 8px solid white; border-top: 6px solid transparent; border-bottom: 6px solid transparent; left: 2px; top: 4px; }
.icon-send::after { content: ''; position: absolute; width: 12px; height: 2.5px; background: white; right: 0; top: 8px; border-radius: 2px; }

.icon-receive { position: relative; width: 20px; height: 20px; }
.icon-receive::before { content: ''; position: absolute; width: 12px; height: 2.5px; background: white; left: 0; top: 8px; border-radius: 2px; }
.icon-receive::after { content: ''; position: absolute; width: 0; height: 0; border-right: 8px solid white; border-top: 6px solid transparent; border-bottom: 6px solid transparent; right: 0; top: 4px; }

.btn-text h3 { font-size: 15px; font-weight: 600; margin-bottom: 1px; }
.btn-text p { font-size: 12px; color: var(--text-4); }

/* ===== Tabs ===== */
.tabs { display: flex; gap: 3px; background: var(--border-light); border-radius: var(--rs); padding: 3px; margin-bottom: 20px; }
.tab {
    flex: 1; padding: 9px 12px; border: none; background: transparent;
    color: var(--text-4); font-size: 13px; font-weight: 500;
    border-radius: 8px; cursor: pointer; transition: all var(--ease);
    display: flex; align-items: center; justify-content: center; gap: 5px;
}
.tab:hover { color: var(--text-3); }
.tab.active { background: white; color: var(--primary); box-shadow: var(--shadow-sm); font-weight: 600; }

.tab-icon { width: 13px; height: 13px; position: relative; display: inline-block; }
.tab-icon-text::before { content: ''; position: absolute; width: 11px; height: 1.5px; background: currentColor; top: 2px; left: 1px; box-shadow: 0 3px 0 currentColor, 0 6px 0 currentColor, 0 9px 0 currentColor; border-radius: 1px; }
.tab-icon-file::before { content: ''; position: absolute; width: 9px; height: 11px; border: 1.5px solid currentColor; border-radius: 2px; top: 1px; left: 2px; }

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 500; color: var(--text-3); margin-bottom: 5px; }
.form-input, .form-select, .form-textarea {
    width: 100%; padding: 10px 12px;
    background: var(--bg); border: 1.5px solid var(--border);
    border-radius: var(--rxs); color: var(--text);
    font-size: 14px; font-family: inherit; transition: all var(--ease); outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,0.08); background: white;
}
.form-textarea { min-height: 160px; resize: vertical; line-height: 1.7; }
.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px;
}
.form-row { display: flex; gap: 10px; }
.form-row .form-group { flex: 1; }
.form-hint { font-size: 11px; color: var(--text-4); margin-top: 3px; }

/* ===== Toggle ===== */
.toggle-group { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border-light); margin-bottom: 12px; }
.toggle-label { font-size: 13px; color: var(--text-3); }
.toggle { position: relative; width: 40px; height: 22px; cursor: pointer; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider { position: absolute; inset: 0; background: #cbd5e1; border-radius: 11px; transition: all var(--ease); }
.toggle-slider::before { content: ''; position: absolute; width: 16px; height: 16px; background: white; border-radius: 50%; top: 3px; left: 3px; transition: all var(--ease); box-shadow: 0 1px 2px rgba(0,0,0,0.12); }
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }
.password-field { max-height: 0; overflow: hidden; transition: max-height 0.25s ease; }
.password-field.show { max-height: 56px; }

/* ===== Drop Zone ===== */
.dropzone {
    border: 2px dashed var(--border); border-radius: var(--r);
    padding: 36px 16px; text-align: center; cursor: pointer;
    transition: all var(--ease); position: relative; background: var(--bg);
}
.dropzone:hover, .dropzone.dragover { border-color: var(--primary); background: var(--primary-light); }
.dropzone.dragover { transform: scale(1.01); }
.dropzone-icon { width: 40px; height: 40px; margin: 0 auto 12px; position: relative; }
.dropzone-icon::before { content: ''; position: absolute; width: 20px; height: 20px; border: 2px solid var(--text-4); border-radius: 3px; bottom: 0; left: 10px; }
.dropzone-icon::after { content: ''; position: absolute; width: 0; height: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 8px solid var(--text-4); top: 0; left: 14px; }
.dropzone-text { font-size: 13px; color: var(--text-2); margin-bottom: 4px; }
.dropzone-hint { font-size: 11px; color: var(--text-4); }
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ===== File List ===== */
.file-list { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.file-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; background: var(--bg); border-radius: var(--rxs);
    border: 1px solid var(--border-light); animation: fadeIn 0.25s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

.file-type-icon {
    width: 36px; height: 36px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 9px; font-weight: 700; text-transform: uppercase;
    flex-shrink: 0; color: white;
}
.file-type-icon.type-image { background: linear-gradient(135deg, #f472b6, #ec4899); }
.file-type-icon.type-video { background: linear-gradient(135deg, #a78bfa, #8b5cf6); }
.file-type-icon.type-audio { background: linear-gradient(135deg, #34d399, #10b981); }
.file-type-icon.type-pdf { background: linear-gradient(135deg, #f87171, #ef4444); }
.file-type-icon.type-doc { background: linear-gradient(135deg, #60a5fa, #3b82f6); }
.file-type-icon.type-zip { background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.file-type-icon.type-code { background: linear-gradient(135deg, #2dd4bf, #14b8a6); }
.file-type-icon.type-other { background: linear-gradient(135deg, #94a3b8, #64748b); }

.file-info { flex: 1; min-width: 0; }
.file-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-size { font-size: 11px; color: var(--text-4); }

.file-remove {
    width: 24px; height: 24px; border: none; background: #fee2e2;
    color: var(--danger); border-radius: 6px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--ease); flex-shrink: 0; position: relative;
}
.file-remove:hover { background: #fecaca; }
.file-remove::before, .file-remove::after { content: ''; position: absolute; width: 9px; height: 1.5px; background: currentColor; border-radius: 1px; }
.file-remove::before { transform: rotate(45deg); }
.file-remove::after { transform: rotate(-45deg); }

/* ===== Progress ===== */
.progress-container { margin-top: 12px; display: none; }
.progress-container.show { display: block; }
.progress-bar-bg { height: 4px; background: var(--border-light); border-radius: 2px; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 2px; width: 0%; transition: width 0.3s; }
.progress-text { font-size: 11px; color: var(--text-4); margin-top: 5px; text-align: center; }

/* ===== Buttons ===== */
.btn-primary {
    width: 100%; padding: 12px 20px; background: var(--primary); color: white;
    border: none; border-radius: var(--rs); font-size: 14px; font-weight: 600;
    cursor: pointer; transition: all var(--ease);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); box-shadow: 0 2px 8px rgba(59,130,246,0.25); }
.btn-primary:active:not(:disabled) { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
    padding: 9px 16px; background: var(--border-light); color: var(--text-3);
    border: 1px solid var(--border); border-radius: var(--rs);
    font-size: 13px; cursor: pointer; transition: all var(--ease);
}
.btn-secondary:hover { background: #e2e8f0; }

/* ===== Code Input ===== */
.code-input-group { display: flex; gap: 8px; margin-bottom: 20px; }
.code-input {
    flex: 1; padding: 12px; background: var(--bg); border: 1.5px solid var(--border);
    border-radius: var(--rs); color: var(--text);
    font-size: 22px; font-weight: 700; letter-spacing: 8px;
    text-align: center; outline: none; transition: all var(--ease);
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}
.code-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,0.08); background: white; }
.code-input::placeholder { letter-spacing: 1px; font-size: 13px; font-weight: 400; color: var(--text-4); }

.btn-code {
    padding: 12px 20px; background: var(--accent); color: white; border: none;
    border-radius: var(--rs); font-size: 14px; font-weight: 600;
    cursor: pointer; transition: all var(--ease); white-space: nowrap;
}
.btn-code:hover { background: var(--accent-hover); box-shadow: 0 2px 8px rgba(6,182,212,0.25); }

/* ===== View Page ===== */
.view-header { text-align: center; margin-bottom: 20px; }
.view-header h2 { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.view-meta { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.meta-tag { display: flex; align-items: center; gap: 4px; padding: 2px 9px; background: var(--border-light); border-radius: 20px; font-size: 11px; color: var(--text-4); }
.meta-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--success); }
.meta-dot.warning { background: var(--warning); }

.text-content {
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--rs); padding: 16px; max-height: 350px;
    overflow-y: auto; font-size: 12px; line-height: 1.8;
    white-space: pre-wrap; word-break: break-all;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    color: var(--text-2); margin-bottom: 14px;
}
.text-content::-webkit-scrollbar { width: 4px; }
.text-content::-webkit-scrollbar-track { background: transparent; }
.text-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.btn-copy {
    display: flex; align-items: center; justify-content: center; gap: 5px;
    width: 100%; padding: 10px; background: var(--success); color: white;
    border: none; border-radius: var(--rs); font-size: 13px; font-weight: 600;
    cursor: pointer; transition: all var(--ease);
}
.btn-copy:hover { background: var(--success-hover); box-shadow: 0 2px 8px rgba(34,197,94,0.25); }

.file-display { text-align: center; padding: 24px 14px; }
.file-display-icon { width: 64px; height: 64px; border-radius: 16px; margin: 0 auto 14px; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; color: white; }
.file-display-name { font-size: 15px; font-weight: 600; margin-bottom: 4px; word-break: break-all; }
.file-display-size { font-size: 12px; color: var(--text-4); margin-bottom: 18px; }

.file-actions { display: flex; gap: 8px; justify-content: center; }
.btn-download {
    display: flex; align-items: center; gap: 5px;
    padding: 10px 20px; background: var(--primary); color: white;
    border: none; border-radius: var(--rs); font-size: 13px; font-weight: 600;
    cursor: pointer; transition: all var(--ease); text-decoration: none;
}
.btn-download:hover { background: var(--primary-hover); box-shadow: 0 2px 8px rgba(59,130,246,0.25); }
.btn-preview {
    display: flex; align-items: center; gap: 5px;
    padding: 10px 20px; background: var(--border-light); color: var(--text-3);
    border: 1px solid var(--border); border-radius: var(--rs);
    font-size: 13px; font-weight: 600; cursor: pointer; transition: all var(--ease); text-decoration: none;
}
.btn-preview:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* Batch */
.batch-files { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.batch-file-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: var(--bg); border-radius: var(--rxs); border: 1px solid var(--border-light); }
.batch-file-info { flex: 1; min-width: 0; }
.batch-file-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.batch-file-size { font-size: 11px; color: var(--text-4); }
.batch-file-actions { display: flex; gap: 5px; flex-shrink: 0; }
.batch-file-actions a { padding: 4px 9px; border-radius: 5px; font-size: 11px; font-weight: 500; text-decoration: none; transition: all var(--ease); }
.btn-sm-download { background: var(--primary); color: white; }
.btn-sm-download:hover { background: var(--primary-hover); }
.btn-sm-preview { background: var(--border-light); color: var(--text-3); border: 1px solid var(--border); }
.btn-sm-preview:hover { border-color: var(--primary); color: var(--primary); }

/* ===== Result ===== */
.result-box { text-align: center; }
.result-icon {
    width: 52px; height: 52px; border-radius: 50%; background: var(--success);
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 14px; box-shadow: 0 4px 12px rgba(34,197,94,0.25);
}
.result-icon::before { content: ''; width: 13px; height: 22px; border-right: 2.5px solid white; border-bottom: 2.5px solid white; transform: rotate(45deg); margin-top: -3px; }
.result-box h2 { font-size: 17px; margin-bottom: 20px; }

.result-field { margin-bottom: 12px; }
.result-field label { display: block; font-size: 11px; color: var(--text-4); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 500; }
.result-value { display: flex; gap: 6px; }
.result-input { flex: 1; padding: 9px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--rxs); color: var(--text); font-size: 12px; outline: none; }
.btn-copy-small { padding: 9px 14px; background: var(--primary); color: white; border: none; border-radius: var(--rxs); cursor: pointer; font-size: 12px; font-weight: 500; transition: all var(--ease); white-space: nowrap; }
.btn-copy-small:hover { background: var(--primary-hover); }
.btn-copy-small.copied { background: var(--success); }

.result-code {
    font-size: 32px; font-weight: 800; letter-spacing: 7px;
    text-align: center; padding: 12px;
    background: var(--bg); border: 2px solid var(--primary-light);
    border-radius: var(--rs); color: var(--primary);
    font-family: 'SF Mono', 'Fira Code', monospace; margin-bottom: 10px;
}

/* ===== Empty / Error ===== */
.empty-state { text-align: center; padding: 36px 16px; }
.empty-state-icon { width: 52px; height: 52px; border-radius: 50%; background: #fee2e2; display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; }
.empty-state-icon::before { content: ''; width: 18px; height: 18px; border: 2px solid var(--danger); border-radius: 3px; transform: rotate(45deg); }
.empty-state h3 { font-size: 15px; margin-bottom: 4px; }
.empty-state p { color: var(--text-4); font-size: 12px; }

/* ===== Spinner ===== */
.spinner { width: 18px; height: 18px; border: 2px solid rgba(0,0,0,0.08); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Modal ===== */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(15,23,42,0.35);
    backdrop-filter: blur(4px); display: flex; align-items: center;
    justify-content: center; z-index: 1000;
    opacity: 0; visibility: hidden; transition: all var(--ease);
}
.modal-overlay.show { opacity: 1; visibility: visible; }
.modal {
    background: white; border-radius: var(--r); padding: 26px;
    width: 90%; max-width: 340px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    transform: scale(0.95) translateY(8px); transition: all var(--ease);
}
.modal-overlay.show .modal { transform: scale(1) translateY(0); }
.modal h3 { text-align: center; margin-bottom: 16px; font-size: 16px; }

/* ===== Toast ===== */
.toast {
    position: fixed; bottom: 20px; left: 50%;
    transform: translateX(-50%) translateY(60px);
    background: white; border: 1px solid var(--border);
    border-radius: var(--rs); padding: 9px 18px;
    font-size: 13px; color: var(--text);
    box-shadow: var(--shadow-lg); z-index: 2000;
    transition: transform 0.25s ease; pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }

/* ===== Responsive ===== */
@media (max-width: 380px) {
    .container { padding: 16px 12px; }
    .card { padding: 18px; border-radius: 12px; }
    .brand h1 { font-size: 20px; }
    .brand-icon { width: 50px; height: 50px; }
    .btn-action { padding: 16px 16px; gap: 12px; }
    .btn-icon { width: 42px; height: 42px; border-radius: 11px; }
    .code-input { font-size: 18px; letter-spacing: 5px; padding: 10px; }
    .result-code { font-size: 24px; letter-spacing: 4px; }
    .form-textarea { min-height: 120px; }
    .file-display-icon { width: 52px; height: 52px; }
    .file-actions { flex-direction: column; }
    .file-actions a, .file-actions button { width: 100%; justify-content: center; }
}

@media (min-width: 381px) and (max-width: 480px) {
    .container { padding: 24px 16px; }
    .card { padding: 22px; }
}

@media (min-width: 481px) and (max-width: 768px) {
    .container { max-width: 480px; padding: 32px 20px; }
}

@media (min-width: 769px) {
    .container { max-width: 500px; }
}

/* Landscape */
@media (max-height: 500px) and (orientation: landscape) {
    .container { padding: 12px; min-height: auto; }
    .brand { margin-bottom: 16px; }
    .brand-icon { width: 44px; height: 44px; margin-bottom: 8px; }
    .brand h1 { font-size: 18px; }
}

/* Safe area */
@supports (padding: env(safe-area-inset-bottom)) {
    .container { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
}