:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    --bg: #f5f7fa;
    --bg-panel: #ffffff;
    --bg-panel-2: #f1f5f9;
    --text: #1f2937;
    --text-dim: #64748b;
    --accent: #4f46e5;
    --accent-2: #0d9488;
    --success: #10b981;
    --danger: #ef4444;
    --border: #e2e8f0;
    --radius: 16px;
    --shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-gradient);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

.hidden {
    display: none !important;
}

/* ---------- Layout (Toolkit Easy pattern) ---------- */

.main-container {
    width: 100%;
    margin: 60px auto;
}

.glass-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: var(--shadow);
    padding: 40px;
}

.header-section h1 {
    font-weight: 800;
    letter-spacing: -0.025em;
    margin-bottom: 12px;
}

.header-section p {
    color: var(--text-dim);
    margin-bottom: 0;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.back-link:hover {
    color: var(--accent);
    text-decoration: none;
}

/* ---------- Content sections (SEO description) ---------- */

.content-section {
    margin-top: 48px;
}

.content-section h2 {
    font-weight: 700;
    font-size: 1.5rem;
    margin-bottom: 16px;
    color: #1f2937;
}

.content-section h3 {
    font-weight: 600;
    font-size: 1.15rem;
    margin-top: 24px;
    margin-bottom: 10px;
    color: #1f2937;
}

.content-section p,
.content-section li {
    color: #64748b;
    line-height: 1.7;
    margin-bottom: 12px;
}

.content-section ul,
.content-section ol {
    padding-left: 20px;
    margin-bottom: 20px;
}

.content-section ul li,
.content-section ol li {
    margin-bottom: 8px;
}

.faq-item {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}

.faq-item:last-child {
    border-bottom: none;
}

.faq-item strong {
    display: block;
    color: #1f2937;
    margin-bottom: 6px;
    font-size: 1rem;
}

.faq-item p {
    color: #64748b;
    margin-bottom: 0;
}

/* ---------- Home option cards ---------- */

.options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    width: 100%;
}

.option-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.option-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: var(--shadow);
    text-decoration: none;
    color: inherit;
}

.option-icon {
    width: 56px;
    height: 56px;
    display: grid;
    place-items: center;
    font-size: 26px;
    font-weight: 700;
    border-radius: 14px;
    margin-bottom: 16px;
}

.send-card .option-icon {
    background: rgba(79, 70, 229, 0.12);
    color: var(--accent);
}

.receive-card .option-icon {
    background: rgba(13, 148, 136, 0.12);
    color: var(--accent-2);
}

.option-card h2 {
    font-size: 20px;
    margin-bottom: 8px;
}

.option-card p {
    color: var(--text-dim);
    font-size: 14px;
    margin-bottom: 16px;
}

.option-link {
    color: var(--accent-2);
    font-size: 14px;
    font-weight: 600;
}

/* ---------- Panels ---------- */

.panel {
    background: var(--bg-panel-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    animation: fade-in 0.25s ease;
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.panel h2 {
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent-2);
    margin-bottom: 18px;
}

/* ---------- Buttons & inputs ---------- */

.btn {
    display: inline-block;
    border: none;
    border-radius: 10px;
    padding: 11px 20px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.1s ease;
    font-family: inherit;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn.primary {
    background: linear-gradient(90deg, var(--primary-color), #818cf8);
    color: #fff;
}

.btn.primary:not(:disabled):hover { filter: brightness(1.12); }

.btn.success { background: var(--success); color: #fff; }
.btn.success:not(:disabled):hover { filter: brightness(1.1); }

.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:not(:disabled):hover { filter: brightness(1.1); }
.btn.danger.ghost { background: transparent; color: var(--danger); border: 1px solid var(--danger); }

.btn.ghost {
    background: var(--bg-panel);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn.ghost:hover { border-color: var(--accent); }

.btn.primary.wide, .btn.danger.wide { width: 100%; margin-top: 14px; }

.link-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-size: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    font-family: inherit;
}

input[type="text"], input[type="file"] {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    padding: 11px 14px;
    font-size: 15px;
    width: 100%;
    font-family: inherit;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
}

label {
    display: block;
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 6px;
}

/* ---------- Drop zone ---------- */

.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 36px 20px;
    text-align: center;
    color: var(--text-dim);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
    margin-bottom: 16px;
    background: var(--bg-panel);
}

.drop-zone.dragover {
    border-color: var(--accent);
    background: #eef2ff;
    color: var(--text);
}

.drop-icon { font-size: 40px; margin-bottom: 10px; }

/* ---------- File info ---------- */

.file-info, .transfer-info {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 16px;
}

.file-icon { font-size: 30px; }

.file-meta { flex: 1; min-width: 0; }

.file-name {
    font-weight: 600;
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-size, .file-type {
    color: var(--text-dim);
    font-size: 13px;
}

.file-type { margin-top: 2px; }

/* ---------- Session / QR ---------- */

.session-code {
    text-align: center;
    margin-bottom: 16px;
}

.code-display {
    font-family: "SF Mono", Consolas, monospace;
    font-size: 44px;
    letter-spacing: 0.35em;
    padding-left: 0.35em;
    color: var(--accent-2);
    font-weight: 700;
}

.hint { color: var(--text-dim); font-size: 13px; margin-top: 8px; }

.qr-box {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

#qr-code img, #qr-code canvas {
    border-radius: 10px;
    padding: 10px;
    background: #fff;
    width: 220px;
    height: 220px;
}

.session-link-row {
    display: flex;
    gap: 8px;
}

.session-link-row input {
    flex: 1;
    font-size: 13px;
    color: var(--text-dim);
}

/* ---------- Status banners ---------- */

.status-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 14px;
    margin-top: 16px;
}

.status-banner.waiting {
    background: rgba(13, 148, 136, 0.08);
    border: 1px solid rgba(13, 148, 136, 0.35);
    color: var(--accent-2);
}

.status-banner.ready {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: var(--success);
}

.status-banner.error {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: var(--danger);
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(13, 148, 136, 0.25);
    border-top-color: var(--accent-2);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Tabs ---------- */

.join-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.tab {
    flex: 1;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    color: var(--text-dim);
    border-radius: 10px;
    padding: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.tab.active {
    color: var(--accent-2);
    border-color: var(--accent-2);
    background: rgba(13, 148, 136, 0.08);
}

.tab-body { margin-bottom: 16px; }

/* ---------- Scanner ---------- */

.scanner-box {
    position: relative;
    background: #0f172a;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    display: grid;
    place-items: center;
}

.scanner-box video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scanner-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    text-align: center;
    color: #e2e8f0;
    font-size: 14px;
    background: rgba(0, 0, 0, 0.5);
    padding: 16px;
}

/* ---------- Progress ---------- */

.progress-wrap { margin: 6px 0 18px; }

.progress-bar {
    height: 14px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 7px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    border-radius: 7px;
    transition: width 0.15s linear;
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    font-size: 15px;
}

.progress-substats {
    display: flex;
    justify-content: space-between;
    color: var(--text-dim);
    font-size: 13px;
    margin-top: 4px;
}

.accept-actions {
    display: flex;
    gap: 10px;
}

.accept-actions .btn { flex: 1; }

/* ---------- Send/receive queue ---------- */

.btn.sm { padding: 7px 12px; font-size: 13px; }

.queue-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 16px;
}

.queue-summary {
    color: var(--text-dim);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
}

.queue-list { margin-bottom: 8px; }

.queue-row {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 10px;
    animation: fade-in 0.2s ease;
}

.queue-row .queue-icon { font-size: 26px; }

.queue-row .file-meta { flex: 1; min-width: 0; }

.queue-row .file-name { font-size: 14px; }

.queue-row .file-size { font-size: 12px; }

.queue-row .queue-side {
    display: flex;
    align-items: center;
    gap: 10px;
}

.queue-status {
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    text-align: right;
    min-width: 70px;
}

.queue-status.queued { color: var(--text-dim); }
.queue-status.sending,
.queue-status.receiving { color: var(--accent-2); }
.queue-status.done { color: var(--success); }
.queue-status.cancelled,
.queue-status.failed { color: var(--danger); }

.queue-progress {
    height: 6px;
    background: var(--bg-panel-2);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 6px;
}

.queue-progress .fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    border-radius: 3px;
    transition: width 0.2s linear;
}

/* ---------- Neutral status banner ---------- */

.status-banner.neutral {
    background: var(--bg-panel-2);
    border: 1px solid var(--border);
    color: var(--text);
}

@media (max-width: 767.98px) {
    .main-container { margin: 30px auto; padding: 0 15px; }
    .glass-card { padding: 25px; }
    .header-section h1 { font-size: 1.8rem; }
    .code-display { font-size: 34px; }
}
