/* ============================================================
   tf-file-input - Custom file upload card
   Used everywhere a <input type="file"> would have been.
   ============================================================ */

.tf-file-input {
    width: 100%;
    margin-bottom: 4px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.tf-file-input .tf-file-real {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    border: 0 !important;
}

/* The clickable card */
.tf-file-card {
    display: block;
    cursor: pointer;
    background: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 22px 18px;
    transition: all .18s ease;
    margin-bottom: 0;
    position: relative;
    user-select: none;
}

.tf-file-card:hover {
    background: #fff7f3;
    border-color: #ef5122;
}

.tf-file-card.tf-drag-over {
    background: #fff1ec;
    border-color: #ef5122;
    border-style: solid;
}

.tf-file-card.tf-invalid {
    background: #fef2f2;
    border-color: #dc2626;
}

/* ── Empty state ── */
.tf-file-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
}

.tf-file-card[data-state="empty"] .tf-file-empty {
    display: flex;
}

.tf-file-card[data-state="selected"] .tf-file-empty,
.tf-file-card[data-state="existing"] .tf-file-empty {
    display: none;
}

.tf-file-icon-circle {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
}

.tf-file-icon-circle i {
    font-size: 22px;
    color: #64748b;
}

.tf-file-card:hover .tf-file-icon-circle {
    border-color: #ef5122;
    background: #ffffff;
}

.tf-file-card:hover .tf-file-icon-circle i {
    color: #ef5122;
}

.tf-file-text {
    font-size: 13px;
    font-weight: 500;
    color: #334155;
    margin: 0;
    line-height: 1.4;
}

.tf-file-browse {
    color: #ef5122;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.tf-file-hint {
    font-size: 11px;
    color: #94a3b8;
    margin: 4px 0 0;
    font-weight: 500;
    letter-spacing: .2px;
}

/* ── Selected / existing state ── */
.tf-file-selected {
    display: none;
    align-items: center;
    gap: 14px;
}

.tf-file-card[data-state="selected"] .tf-file-selected,
.tf-file-card[data-state="existing"] .tf-file-selected {
    display: flex;
}

.tf-file-card[data-state="selected"],
.tf-file-card[data-state="existing"] {
    background: #ffffff;
    border-style: solid;
    border-color: #e2e8f0;
    padding: 14px 16px;
}

.tf-file-card[data-state="selected"]:hover,
.tf-file-card[data-state="existing"]:hover {
    border-color: #ef5122;
    background: #fff7f3;
}

.tf-file-thumb {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    background: #f1f5f9;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.tf-file-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tf-file-doc-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.tf-file-doc-icon i {
    font-size: 26px;
    color: #ef5122;
}

.tf-file-thumb img:not([hidden])~.tf-file-doc-icon {
    display: none;
}

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

.tf-file-name {
    font-size: 13px;
    font-weight: 600;
    color: #1a1d21;
    margin: 0 0 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tf-file-size {
    font-size: 11px;
    color: #64748b;
    margin: 0 0 2px;
    font-weight: 500;
}

.tf-file-view-link {
    color: #ef5122;
    font-weight: 600;
    text-decoration: none;
    font-size: 11px;
}

.tf-file-view-link:hover {
    color: #d94518;
    text-decoration: underline;
}

.tf-file-replace-hint {
    font-size: 10px;
    color: #94a3b8;
    margin: 0;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .6px;
}

.tf-file-remove {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: #f1f5f9;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .15s ease;
    flex-shrink: 0;
}

.tf-file-remove:hover {
    background: #fee2e2;
    color: #dc2626;
}

.tf-file-remove i {
    font-size: 16px;
    line-height: 1;
}

.tf-file-error {
    font-size: 11px;
    color: #dc2626;
    font-weight: 500;
    margin: 6px 2px 0;
}

/* Clickable image preview - opens in Fancybox lightbox */
.tf-img-fancybox {
    cursor: zoom-in;
    transition: transform .18s ease, box-shadow .18s ease;
}

.tf-img-fancybox:hover {
    transform: scale(1.04);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.18);
}

.tf-file-card[data-state="existing"] .tf-file-preview:not([hidden]),
.tf-file-card[data-state="selected"] .tf-file-preview:not([hidden]) {
    cursor: zoom-in;
}

@media (max-width: 576px) {
    .tf-file-card {
        padding: 18px 14px;
    }

    .tf-file-card[data-state="selected"],
    .tf-file-card[data-state="existing"] {
        padding: 12px;
    }

    .tf-file-thumb {
        width: 48px;
        height: 48px;
    }
}