:root {
    --fv-indigo: #4f46e5;
    --fv-indigo-dark: #3730a3;
    --fv-sky: #0ea5e9;
    --fv-bg: #f5f7fb;
    --fv-ink: #1e1b2e;
    --fv-muted: #6b7280;
    --fv-border: #e5e7eb;
}

* {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
    background: var(--fv-bg);
    color: var(--fv-ink);
}

/* ===== Navbar ===== */
.fv-navbar {
    background: linear-gradient(90deg, var(--fv-indigo), var(--fv-sky));
    padding: 14px 0;
    box-shadow: 0 2px 12px rgba(79, 70, 229, 0.25);
}

.fv-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 20px;
    letter-spacing: -0.02em;
}

.fv-brand-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
}

.fv-install-btn {
    font-weight: 600;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.fv-icon-toggle {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    margin-right: 10px;
    font-size: 15px;
    cursor: pointer;
}

.fv-plan-badge {
    background: #ffd166;
    color: #7c4a03;
    font-weight: 700;
    font-size: 12px;
    padding: 5px 12px;
    border-radius: 999px;
    margin-right: 12px;
}

/* ===== Hero ===== */
.fv-hero {
    background: linear-gradient(160deg, var(--fv-indigo) 0%, var(--fv-indigo-dark) 45%, var(--fv-sky) 100%);
    color: #fff;
    padding: 64px 0 56px;
    text-align: center;
}

.fv-hero-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 5px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.03em;
    margin-bottom: 18px;
}

.fv-hero-title {
    font-size: clamp(28px, 4vw, 44px);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 16px;
}

.fv-hero-subtitle {
    max-width: 680px;
    margin: 0 auto 26px;
    font-size: 16px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
}

.fv-hero-chips {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.fv-chip {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 500;
    backdrop-filter: blur(4px);
}

.fv-hero-trial {
    margin: 20px 0 0;
    font-size: 13.5px;
    color: rgba(255, 255, 255, 0.85);
}

/* ===== About / feature section ===== */
.fv-about {
    margin-top: -38px;
    margin-bottom: 36px;
}

.fv-section-heading {
    text-align: center;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 22px;
    color: var(--fv-ink);
}

.fv-feature-card {
    background: #fff;
    border-radius: 14px;
    padding: 20px 16px;
    height: 100%;
    box-shadow: 0 10px 30px rgba(30, 27, 46, 0.08);
    border: 1px solid var(--fv-border);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.fv-feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 34px rgba(79, 70, 229, 0.14);
}

.fv-feature-icon {
    font-size: 30px;
    margin-bottom: 10px;
}

.fv-feature-card h6 {
    font-weight: 700;
    margin-bottom: 6px;
    font-size: 15px;
}

.fv-feature-card p {
    font-size: 12.5px;
    color: var(--fv-muted);
    margin: 0;
    line-height: 1.5;
}

/* ===== Generic card ===== */
.fv-card {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(30, 27, 46, 0.06);
    border: 1px solid var(--fv-border);
}

.fv-card-title {
    font-weight: 700;
    margin-bottom: 16px;
    font-size: 17px;
}

/* ===== Dropzone ===== */
.fv-dropzone {
    border: 2px dashed #c7c9fb;
    border-radius: 14px;
    padding: 38px 20px;
    text-align: center;
    cursor: pointer;
    background: #fafaff;
    transition: all 0.15s ease;
}

.fv-dropzone:hover,
.fv-dropzone-active {
    background: #eef0ff;
    border-color: var(--fv-indigo);
}

.fv-dropzone-icon {
    font-size: 40px;
    margin-bottom: 8px;
}

.fv-dropzone-text {
    margin: 0;
    color: var(--fv-muted);
    font-size: 14.5px;
}

.fv-dropzone-link {
    color: var(--fv-indigo);
    font-weight: 600;
    text-decoration: underline;
}

.fv-progress {
    height: 20px;
    border-radius: 10px;
    overflow: hidden;
}

.fv-storage-note {
    margin: 14px 0 0;
    font-size: 12.5px;
    color: var(--fv-muted);
    text-align: center;
}

/* ===== Pricing ===== */
.fv-price-card {
    background: #fff;
    border: 1px solid var(--fv-border);
    border-radius: 16px;
    padding: 26px 22px;
    text-align: center;
    height: 100%;
}

.fv-price-card h6 {
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 12px;
    color: var(--fv-muted);
    font-weight: 700;
    margin-bottom: 10px;
}

.fv-price-amount {
    font-size: 30px;
    font-weight: 800;
    color: var(--fv-ink);
    margin-bottom: 10px;
}

.fv-price-amount span {
    font-size: 14px;
    font-weight: 500;
    color: var(--fv-muted);
}

.fv-price-card p {
    font-size: 13px;
    color: var(--fv-muted);
    margin: 0;
}

.fv-price-card-highlight {
    border: 2px solid var(--fv-indigo);
    box-shadow: 0 10px 30px rgba(79, 70, 229, 0.15);
}

/* ===== Paywall / Share modal ===== */
.fv-paywall-icon {
    font-size: 44px;
    margin-bottom: 6px;
}

.fv-paywall-price {
    font-size: 34px;
    font-weight: 800;
    color: var(--fv-indigo);
    margin: 6px 0 2px;
}

.fv-paywall-price span {
    font-size: 15px;
    font-weight: 500;
    color: var(--fv-muted);
}

.fv-plan-toggle {
    display: flex;
    gap: 8px;
}

.fv-plan-option {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--fv-border);
    border-radius: 12px;
    background: #fff;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.fv-plan-option.active {
    border-color: var(--fv-indigo);
    background: #eef0ff;
    color: var(--fv-indigo-dark);
}

.fv-qr-box {
    display: flex;
    justify-content: center;
}

.fv-qr-box canvas {
    border-radius: 8px;
    border: 1px solid var(--fv-border);
}

/* ===== Section header ===== */
.fv-section-title {
    font-weight: 700;
    font-size: 19px;
}

.fv-count-badge {
    display: inline-block;
    background: var(--fv-indigo);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 999px;
    margin-left: 6px;
    vertical-align: middle;
}

/* ===== File cards ===== */
.fv-file-card {
    background: #fff;
    border: 1px solid var(--fv-border);
    border-radius: 14px;
    padding: 16px 10px;
    text-align: center;
    height: 100%;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.fv-file-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(30, 27, 46, 0.1);
    border-color: #d9dcff;
}

.fv-file-icon {
    font-size: 40px;
    cursor: pointer;
    margin-bottom: 6px;
}

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

.fv-file-size {
    font-size: 11px;
    color: var(--fv-muted);
    margin-top: 2px;
}

.fv-action-btn {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 6px 8px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(90deg, var(--fv-indigo), var(--fv-sky));
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.fv-action-btn:hover {
    opacity: 0.88;
}

.fv-file-actions {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 10px;
}

.fv-icon-btn {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid var(--fv-border);
    background: #fff;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s ease;
}

.fv-icon-btn:hover {
    background: #f1f2ff;
}

.fv-icon-btn-danger:hover {
    background: #fee2e2;
}

/* ===== Footer ===== */
.fv-footer {
    padding: 30px 0 50px;
    text-align: center;
    color: var(--fv-muted);
    font-size: 13px;
}

/* ===== Modal / preview content ===== */
.fv-modal-content {
    border-radius: 16px;
    border: none;
    overflow: hidden;
}

.fv-window-controls {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    margin-left: auto;
}

#previewModal .modal-header,
#shareModal .modal-header,
#paywallModal .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

#previewFileName {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fv-window-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--fv-border);
    background: #f5f5f7;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--fv-ink);
}

.fv-window-btn:hover {
    background: #e9eaf5;
}

.fv-window-btn-close:hover {
    background: #fee2e2;
    color: #b91c1c;
}

.fv-minimized-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    position: fixed;
    bottom: 18px;
    right: 18px;
    z-index: 1060;
    background: #fff;
    border: 1px solid var(--fv-border);
    border-radius: 999px;
    padding: 10px 18px;
    box-shadow: 0 10px 30px rgba(30, 27, 46, 0.18);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.fv-minimized-bar-restore {
    color: var(--fv-indigo);
}

/* When the preview is minimized: shrink the dialog and free up the page
   underneath instead of blocking it like a normal modal. */
#previewModal.fv-modal-minimized {
    pointer-events: none;
}

#previewModal.fv-modal-minimized .modal-dialog,
#previewModal.fv-modal-minimized .modal-content,
#previewModal.fv-modal-minimized .modal-header {
    display: none;
}

body.fv-has-minimized-modal {
    overflow: auto !important;
    padding-right: 0 !important;
}

body.fv-has-minimized-modal .modal-backdrop {
    display: none;
}

#previewBody img {
    max-width: 100%;
    height: auto;
}

#previewBody pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 15px;
    border-radius: 6px;
    max-height: 60vh;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

#previewBody iframe, #previewBody embed {
    width: 100%;
    height: 65vh;
    border: none;
}

#previewBody video, #previewBody audio {
    width: 100%;
}

#previewBody table {
    font-size: 12px;
}

#previewBody .table-wrap {
    max-height: 60vh;
    overflow: auto;
}

#modelViewerContainer {
    width: 100%;
    height: 420px;
    background: #1e1e1e;
    border-radius: 6px;
    position: relative;
}

.font-sample {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.hex-dump {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 12px;
    border-radius: 6px;
    max-height: 60vh;
    overflow: auto;
    white-space: pre;
}

.archive-table td, .archive-table th {
    font-size: 13px;
}

/* ===== Responsive ===== */
@media (max-width: 576px) {
    .fv-hero { padding: 48px 0 40px; }
    .fv-about { margin-top: -24px; }
}

/* ===== Dark mode ===== */
body.fv-dark {
    --fv-bg: #0f1117;
    --fv-ink: #e5e7eb;
    --fv-muted: #9ca3af;
    --fv-border: #2a2d3a;
}

body.fv-dark .fv-feature-card,
body.fv-dark .fv-card,
body.fv-dark .fv-file-card,
body.fv-dark .fv-price-card,
body.fv-dark .fv-modal-content,
body.fv-dark .modal-content {
    background: #171923;
    color: var(--fv-ink);
}

body.fv-dark .fv-dropzone {
    background: #171923;
    border-color: #3a3d52;
}

body.fv-dark .fv-icon-btn {
    background: #1f2230;
    color: var(--fv-ink);
    border-color: var(--fv-border);
}

body.fv-dark .fv-icon-btn:hover {
    background: #262a3b;
}

body.fv-dark .fv-plan-option {
    background: #1f2230;
    color: var(--fv-ink);
    border-color: var(--fv-border);
}

body.fv-dark .fv-plan-option.active {
    background: #2a2d5c;
}

body.fv-dark .form-control {
    background: #1f2230;
    color: var(--fv-ink);
    border-color: var(--fv-border);
}

/* ===== Toolbar: search / sort / tag filter ===== */
.fv-toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.fv-search-input {
    width: 180px;
}

.fv-sort-select {
    width: auto;
}

/* ===== Thumbnails + tag chip on cards ===== */
.fv-file-thumb {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
}

.fv-tag-chip {
    display: inline-block;
    background: #eef0ff;
    color: var(--fv-indigo-dark);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
    margin-top: 4px;
}

/* ===== Preview modal: rename + toolbar ===== */
.fv-preview-title-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1 1 auto;
}

.fv-rename-btn {
    background: none;
    border: none;
    font-size: 12px;
    cursor: pointer;
    opacity: 0.6;
    flex-shrink: 0;
}

.fv-rename-btn:hover {
    opacity: 1;
}

.fv-preview-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 20px;
    border-bottom: 1px solid var(--fv-border);
    background: #fafafe;
}

.fv-tag-input {
    width: 160px;
}

.fv-tool-group {
    display: flex;
    gap: 6px;
}

.fv-tool-btn {
    background: #fff;
    border: 1px solid var(--fv-border);
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.fv-tool-btn:hover {
    background: #eef0ff;
}

.fv-crop-box {
    position: absolute;
    display: none;
    border: 2px dashed #4f46e5;
    background: rgba(79, 70, 229, 0.15);
    pointer-events: none;
    z-index: 5;
}

#cropOverlayWrap img {
    cursor: crosshair;
    user-select: none;
    -webkit-user-drag: none;
}

.fv-text-editor {
    width: 100%;
    min-height: 300px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    background: #1e1e1e;
    color: #d4d4d4;
    border: 1px solid var(--fv-border);
    border-radius: 6px;
    padding: 12px;
}

/* ===== Dashboard ===== */
.fv-stat-box {
    background: #fafaff;
    border: 1px solid var(--fv-border);
    border-radius: 12px;
    padding: 14px 8px;
}

.fv-stat-num {
    font-size: 24px;
    font-weight: 800;
    color: var(--fv-indigo);
}

.fv-stat-label {
    font-size: 11px;
    color: var(--fv-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.fv-type-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    margin-bottom: 8px;
}

.fv-type-row span:first-child {
    width: 60px;
    flex-shrink: 0;
}

.fv-type-bar-wrap {
    flex: 1;
    background: #eef0ff;
    border-radius: 999px;
    height: 8px;
    overflow: hidden;
}

.fv-type-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--fv-indigo), var(--fv-sky));
}

/* ===== Dark mode additions for new elements ===== */
body.fv-dark .fv-preview-toolbar {
    background: #171923;
    border-color: var(--fv-border);
}

body.fv-dark .fv-tool-btn,
body.fv-dark .fv-stat-box {
    background: #1f2230;
    color: var(--fv-ink);
    border-color: var(--fv-border);
}

body.fv-dark .fv-tag-chip {
    background: #2a2d5c;
    color: #c7c9fb;
}

body.fv-dark .form-select {
    background-color: #1f2230;
    color: var(--fv-ink);
    border-color: var(--fv-border);
}

/* ===== Device ID footer link ===== */
.fv-device-id-link {
    background: none;
    border: none;
    color: var(--fv-muted);
    font-size: 12px;
    text-decoration: underline;
    cursor: pointer;
    margin-top: 6px;
}

.fv-device-id-link:hover {
    color: var(--fv-indigo);
}

/* ===== Audio/Video trimmer ===== */
.fv-trim-panel {
    padding: 14px 20px;
    border-bottom: 1px solid var(--fv-border);
    background: #fafafe;
}

.fv-trim-times {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
}

.fv-trim-track {
    position: relative;
    height: 10px;
    background: #e5e7eb;
    border-radius: 999px;
    margin: 16px 4px;
}

.fv-trim-selected {
    position: absolute;
    top: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--fv-indigo), var(--fv-sky));
    border-radius: 999px;
}

.fv-trim-handle {
    position: absolute;
    top: 50%;
    width: 18px;
    height: 18px;
    background: #fff;
    border: 3px solid var(--fv-indigo);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: ew-resize;
    touch-action: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.fv-trim-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

body.fv-dark .fv-trim-panel {
    background: #171923;
    border-color: var(--fv-border);
}

body.fv-dark .fv-trim-track {
    background: #2a2d3a;
}

/* ===== Word/Excel editing ===== */
.fv-tool-select {
    width: auto;
    font-size: 12px;
    padding: 4px 8px;
}

#docxEditArea {
    outline: none;
    padding: 12px;
    border: 1px dashed transparent;
    border-radius: 6px;
    min-height: 150px;
}

#docxEditArea:focus {
    border-color: var(--fv-indigo);
    background: #fafaff;
}

.fv-xlsx-grid td {
    min-width: 70px;
    outline: none;
}

.fv-xlsx-grid td:focus {
    background: #eef0ff;
    outline: 2px solid var(--fv-indigo);
    outline-offset: -2px;
}

body.fv-dark #docxEditArea:focus {
    background: #1f2230;
}

body.fv-dark .fv-xlsx-grid td:focus {
    background: #2a2d5c;
}

/* ===== Search-inside toggle ===== */
.fv-search-inside-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--fv-muted);
    white-space: nowrap;
    cursor: pointer;
    margin: 0;
}

.fv-search-inside-toggle input {
    cursor: pointer;
}

/* ===== Footer legal links ===== */
.fv-footer-links {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.fv-footer-links a {
    font-size: 12px;
    color: var(--fv-muted);
    text-decoration: none;
}

.fv-footer-links a:hover {
    color: var(--fv-indigo);
    text-decoration: underline;
}

/* ===== Word paragraph-level editor (format-preserving) ===== */
.fv-docx-para {
    padding: 8px 10px;
    margin-bottom: 4px;
    border-radius: 6px;
    border: 1px dashed transparent;
    outline: none;
    line-height: 1.6;
}

.fv-docx-para:focus {
    border-color: var(--fv-indigo);
    background: #fafaff;
}

.fv-docx-para:hover {
    background: #f8f9ff;
}

body.fv-dark .fv-docx-para:focus,
body.fv-dark .fv-docx-para:hover {
    background: #1f2230;
}
