/* ==========================================================
   Custom Fields — Shared Styles
   Used by: field-image.php, field-pdf.php
   ========================================================== */

/* Wrapper */
.cf-field {
    margin-bottom: 20px;
}

/* Label row */
.cf-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 8px;
}

.cf-required {
    color: #c0392b;
    margin-left: 2px;
}

/* Controls row: button + name badge + remove */
.cf-image-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

/* Hide native input without removing it from tab order */
.cf-file-input {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0,0,0,0) !important;
    white-space: nowrap !important;
}

/* Upload button — matches site's green CTA, larger and more prominent */
.cf-upload-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    padding: 14px 28px !important;
    background-color: #27ae60 !important;
    color: #ffffff !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    letter-spacing: 0.05em !important;
    text-transform: uppercase !important;
    border: none !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    white-space: nowrap !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
    min-width: 140px !important;
}

.cf-upload-btn:hover,
.cf-upload-btn:focus {
    background-color: #229954 !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15) !important;
    outline: 2px solid #1e8449 !important;
    outline-offset: 2px !important;
}

/* Selected file name badge */
.cf-file-name {
    font-size: 13px;
    color: #374151;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Remove / clear button */
.cf-remove-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 22px !important;
    height: 22px !important;
    background: #f3f4f6 !important;
    color: #6b7280 !important;
    border: 1px solid #d1d5db !important;
    border-radius: 50% !important;
    font-size: 13px !important;
    line-height: 1 !important;
    cursor: pointer !important;
    padding: 0 !important;
    transition: background-color 0.15s, color 0.15s !important;
    box-shadow: none !important;
}

.cf-remove-btn:hover {
    background: #fee2e2 !important;
    color: #b91c1c !important;
    border-color: #fca5a5 !important;
}

/* Hint text */
.cf-hint {
    margin: 4px 0 0 !important;
    font-size: 12px !important;
    font-style: italic !important;
    color: #6b7280 !important;
    line-height: 1.4 !important;
}

/* ----------------------------------------------------------
   Image preview
   ---------------------------------------------------------- */
.cf-image-preview {
    margin-top: 10px;
    display: inline-block;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
    max-width: 320px;
    line-height: 0;
}

.cf-image-preview img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 180px;
    object-fit: cover;
}

/* ----------------------------------------------------------
   PDF existing-file link
   ---------------------------------------------------------- */
.cf-current-file {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    margin-top: 8px !important;
    font-size: 13px !important;
    color: #374151 !important;
}

.cf-current-file svg {
    flex-shrink: 0;
    color: #6b7280;
}

.cf-current-file a {
    color: #1a6b47;
    text-decoration: underline;
    word-break: break-all;
}

.cf-current-file a:hover {
    color: #155a3a;
}

/* ----------------------------------------------------------
   Responsive
   ---------------------------------------------------------- */
@media (max-width: 480px) {
    .cf-image-controls {
        flex-direction: column;
        align-items: flex-start;
    }

    .cf-upload-btn {
        width: 100% !important;
        justify-content: center !important;
    }

    .cf-image-preview {
        max-width: 100%;
    }
}