.stm-profile-field--document-upload,
.stm-guest-doc-upload,
.stm-admin-doc-upload {
    grid-column: 1 / -1;
}

.stm-guest-doc-upload .stm-field-label,
.stm-admin-doc-upload {
    display: block;
}

.stm-guest-doc-upload .stm-field-label {
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.stm-doc-upload {
    margin-top: 0.35rem;
}

.stm-doc-upload [hidden] {
    display: none !important;
}

.stm-profile-form .stm-doc-upload [hidden],
.stm-customer-dashboard .stm-doc-upload [hidden],
.stm-booking-form .stm-doc-upload [hidden] {
    display: none !important;
}

.stm-doc-upload__dropzone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    min-height: 9.5rem;
    padding: 1rem 1.15rem;
    border: 1.5px dashed rgba(30, 58, 95, 0.35);
    border-radius: 12px;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.stm-doc-upload--readonly .stm-doc-upload__dropzone,
.stm-doc-upload__dropzone--readonly {
    cursor: default;
}

.stm-doc-upload__dropzone:hover,
.stm-doc-upload__dropzone:focus-visible {
    border-color: var(--stm-auth-brand, #1e3a5f);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.12);
    outline: none;
}

.stm-doc-upload--readonly .stm-doc-upload__dropzone:hover,
.stm-doc-upload--readonly .stm-doc-upload__dropzone:focus-visible,
.stm-doc-upload__dropzone--readonly:hover,
.stm-doc-upload__dropzone--readonly:focus-visible {
    border-color: rgba(30, 58, 95, 0.35);
    box-shadow: none;
}

.stm-doc-upload__dropzone--dragover {
    border-color: var(--stm-auth-brand, #1e3a5f);
    background: #eef4fb;
}

.stm-doc-upload__empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    text-align: center;
    color: #4a5568;
}

.stm-doc-upload__icon {
    display: inline-flex;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 999px;
    background: rgba(30, 58, 95, 0.1);
    position: relative;
}

.stm-doc-upload__icon::before {
    content: '';
    position: absolute;
    inset: 0.72rem 0.95rem 0.72rem 0.72rem;
    border: 2px solid var(--stm-auth-brand, #1e3a5f);
    border-radius: 3px;
    box-shadow: inset 0 -0.45rem 0 rgba(30, 58, 95, 0.12);
}

.stm-doc-upload__title {
    font-weight: 600;
    color: #1f2937;
}

.stm-doc-upload__hint {
    font-size: 0.875rem;
    color: #64748b;
}

.stm-doc-upload__preview {
    display: grid;
    grid-template-columns: minmax(5.5rem, 7.5rem) 1fr;
    gap: 1rem;
    align-items: center;
    width: 100%;
}

.stm-doc-upload__preview-media {
    position: relative;
    aspect-ratio: 4 / 3;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.stm-doc-upload__thumb {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.stm-doc-upload__pdf-card {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(145deg, #fee2e2 0%, #fecaca 100%);
}

.stm-doc-upload__pdf-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 3rem;
    padding: 0.35rem 0.55rem;
    border-radius: 8px;
    background: #b91c1c;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.stm-doc-upload__preview-body {
    min-width: 0;
}

.stm-doc-upload__filename {
    margin: 0;
    font-weight: 600;
    color: #111827;
    word-break: break-word;
}

.stm-doc-upload__meta-type {
    margin: 0.2rem 0 0.65rem;
    font-size: 0.8125rem;
    color: #64748b;
    letter-spacing: 0.03em;
}

.stm-doc-upload__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem 0.75rem;
    align-items: center;
}

.stm-doc-upload__open,
.stm-doc-upload__replace,
.stm-doc-upload__remove {
    font-size: 0.875rem;
    line-height: 1.2;
}

.stm-doc-upload__open {
    color: var(--stm-auth-brand, #1e3a5f);
    font-weight: 600;
    text-decoration: none;
}

.stm-doc-upload__open:hover {
    text-decoration: underline;
}

.stm-doc-upload__replace,
.stm-doc-upload__remove {
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
    color: #475569;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.stm-doc-upload__remove {
    color: #b91c1c;
}

.stm-doc-upload__loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    min-height: 5rem;
    color: #475569;
    font-size: 0.9375rem;
}

.stm-doc-upload__spinner {
    width: 1.1rem;
    height: 1.1rem;
    border: 2px solid rgba(30, 58, 95, 0.18);
    border-top-color: var(--stm-auth-brand, #1e3a5f);
    border-radius: 50%;
    animation: stm-doc-upload-spin 0.8s linear infinite;
}

@keyframes stm-doc-upload-spin {
    to {
        transform: rotate(360deg);
    }
}

.stm-doc-upload__status {
    margin: 0.55rem 0 0;
    font-size: 0.875rem;
    color: #555;
}

.stm-doc-upload--error .stm-doc-upload__dropzone {
    border-color: #c0392b;
    background: #fff5f5;
}

.stm-doc-upload--loading .stm-doc-upload__dropzone {
    cursor: wait;
}

.stm-customer-anagraphic .stm-admin-doc-upload {
    max-width: 36rem;
}

@media (max-width: 640px) {
    .stm-doc-upload__preview {
        grid-template-columns: 1fr;
    }

    .stm-doc-upload__preview-media {
        max-width: 12rem;
    }
}
