/* ================================================================
   Avatar Upload UI
   ================================================================ */

/* Container — must be position:relative so the remove button anchors to it */
.cits-user-avatar.macfw-avatar-uploadable {
    position: relative !important;
    display: inline-block !important;
}

/* ----------------------------------------------------------------
   Circle fix — always active regardless of upload setting.
   WooCommerce sets `.woocommerce img { height: auto }` which turns
   a non-square uploaded image into an oval.
   `aspect-ratio: 1/1` forces a square without fighting height:auto.
   ---------------------------------------------------------------- */
.cits-user-avatar img {
    aspect-ratio: 1 / 1 !important;
    object-fit: cover !important;
    border-radius: 50% !important;
    display: block !important;
}

/* ----------------------------------------------------------------
   Upload label — explicit W/H set via inline style in PHP.
   overflow:hidden + border-radius clips the img to a circle.
   ---------------------------------------------------------------- */
.macfw-avatar-upload-label {
    position: relative;
    display: block;
    cursor: pointer;
    border-radius: 50%;
    overflow: hidden;
    line-height: 0;
    /* width & height come from PHP inline style: matches $cits_avatar_size */
}

.macfw-avatar-upload-label img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    transition: opacity 0.2s ease;
}

/* Camera overlay — fades in on hover */
.macfw-avatar-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.45);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.macfw-avatar-upload-label:hover .macfw-avatar-overlay {
    opacity: 1;
}

.macfw-avatar-overlay .dashicons {
    color: #ffffff !important;
    font-size: 22px !important;
    width: 22px !important;
    height: 22px !important;
    line-height: 1 !important;
}

/* Spinner state while uploading */
.macfw-avatar-upload-label.macfw-avatar-loading .macfw-avatar-overlay {
    opacity: 1;
}

.macfw-avatar-upload-label.macfw-avatar-loading img {
    opacity: 0.35;
}

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

.macfw-spin-icon {
    animation: macfw-spin 0.8s linear infinite !important;
    display: inline-block;
}

/* ---- Remove button ---- */
/* Uses × text so it never depends on dashicons loading */
button.macfw-avatar-remove {
    position: absolute !important;
    top: -3px !important;
    right: -3px !important;
    z-index: 20;
    width: 20px !important;
    height: 20px !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #ef4444 !important;
    border: 2px solid #ffffff !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    color: #ffffff !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25) !important;
    transition: background 0.15s !important;
    font-family: Arial, sans-serif !important;
}

button.macfw-avatar-remove:hover:not(:disabled) {
    background: #dc2626 !important;
}

button.macfw-avatar-remove:disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
}

/* ---- Upload hint ---- */
.macfw-avatar-upload-hint {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 6px;
    text-align: center;
    display: block;
    line-height: 1.4;
}

/* ================================================================
   Account Details page — upload section
   ================================================================ */
.macfw-avatar-upload-section {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 20px 0 24px;
    border-bottom: 1px solid #f0f0f0;
    margin-bottom: 20px;
}

.macfw-avatar-section-label {
    font-size: 12px;
    font-weight: 700;
    color: #6b7280;
    margin: 0 0 4px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.macfw-avatar-upload-section .cits-user-avatar {
    margin-bottom: 0 !important;
}

.macfw-avatar-upload-section .macfw-avatar-upload-hint {
    text-align: left;
    font-size: 12px;
    margin-top: 4px;
}

.macfw-banner-dismiss {
    padding: 3px 3px !important;
}