/* Avatar Checkout Styles */
.pmpro_checkout-field-avatar {
    margin: 20px 0;
}

/* Estilo de error cuando el campo está vacío y es requerido */
.pmpro_checkout-field-avatar.avatar-field-error .avatar-preview {
    border-color: #dc3232;
    border-width: 3px;
    border-style: solid;
    background: #fff0f0;
    animation: shake 0.5s ease-in-out;
}

.pmpro_checkout-field-avatar.avatar-field-error .avatar-preview:hover {
    border-color: #dc3232;
    background: #ffe0e0;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

/* Botones de opciones */
.avatar-options {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
    justify-content: space-between;
}

.avatar-option-btn {
    background: #55bcc2;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    transition:
        background-position 0.5s ease,
        transform 0.4s ease,
        box-shadow 0.4s ease,
        background-color 0.4s ease;
    flex: 1;
}

.avatar-option-btn:hover {
    background-color: rgb(77, 175, 181);
    transform: translateY(-3px);
}

.avatar-option-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #ccc;
}

.avatar-option-btn.disabled:hover {
    background-color: #ccc;
    transform: none;
    /* Sin efecto hover */
}

.avatar-upload-area {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-preview {
    width: 120px;
    height: 120px;
    border: 3px dashed #ddd;
    border-radius: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafafa;
    position: relative;
    overflow: hidden;
}

.avatar-preview:hover {
    border-color: #0073aa;
    background: #f0f8ff;
}

.avatar-preview.has-image {
    border-style: solid;
    border-color: #0073aa;
    padding: 0;
}

.avatar-placeholder {
    text-align: center;
    color: #666;
    transition: opacity 0.3s ease;
}

.avatar-icon {
    font-size: 24px;
    display: block;
    margin-bottom: 5px;
}

.avatar-text {
    font-size: 12px;
    line-height: 1.2;
}

.avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 5px;
}

.avatar-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* Modal de cámara */
.camera-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.camera-modal.active {
    display: flex;
}

.camera-modal-content {
    background: white;
    border-radius: 10px;
    padding: 20px;
    max-width: 500px;
    width: 90%;
    max-height: 90%;
    overflow-y: auto;
}

.camera-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
    position: relative;
}

.camera-header h3 {
    margin: 0;
    color: #333;
}

.camera-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    position: absolute;
    left: 95%;
}

.camera-close:hover {
    color: #55bcc2;
}

.camera-container {
    margin-bottom: 20px;
    text-align: center;
    display: flex;
    justify-content: center;
}

#camera-video {
    width: 374px;
    height: 374px;
    border-radius: 100%;
    background: #000;
}

#camera-canvas {
    width: 374px;
    height: 374px;
    border-radius: 100%;
}

.camera-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 15px;
}

.camera-controls button {
    background: #55bcc2;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    transition:
        background-position 0.5s ease,
        transform 0.4s ease,
        box-shadow 0.4s ease,
        background-color 0.4s ease;
    width: 100%;
}

.camera-controls button:hover {
    background: #005a87;
    background-color: rgb(77, 175, 181);
    transform: translateY(-5px);
}

.camera-capture {
    background: #55bcc2;
    width: 100%;
}

.camera-capture:hover {
    background-color: rgb(77, 175, 181);
}

.camera-capture.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #ccc;
}

.camera-capture.disabled:hover {
    background-color: #ccc;
    transform: none;
    /* Sin efecto hover */
}

.camera-use {
    background: #00a32a !important;
}

.camera-use:hover {
    background: #008a20 !important;
}

.camera-status {
    text-align: center;
    padding: 10px;
    border-radius: 5px;
    font-size: 14px;
    margin-top: 10px;
}

.camera-status.error {
    background: #ffebee;
    color: #d32f2f;
    border: 1px solid #ffcdd2;
}

.camera-status.success {
    background: #e8f5e8;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

.camera-status.info {
    background: #e3f2fd;
    color: #1976d2;
    border: 1px solid #90caf9;
}

.avatar-controls {
    margin-top: 10px;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.avatar-controls button {
    background: #55bcc2;
    border: 1px solid #ddd;
    color: #fff;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 16px;
    transition:
        background-position 0.5s ease,
        transform 0.4s ease,
        box-shadow 0.4s ease,
        background-color 0.4s ease;
    flex: 1;
}

.avatar-remove:hover {
    background: #ffebee;
    border-color: #f44336;
    color: #f44336;
}

.avatar-change:hover {
    background: #e3f2fd;
    border-color: #2196f3;
    color: #2196f3;
}

.pmpro_message {
    color: #666;
    font-style: italic;
    display: block;
    margin-top: 10px;
    font-size: 13px;
}

/* Responsive */
@media (max-width: 600px) {
    .camera-modal-content {
        margin: 10px;
        padding: 15px;
    }

    .camera-controls {
        flex-direction: column;
    }

    .avatar-options {
        flex-direction: column;
    }
}

/* Animación de carga */
.avatar-loading {
    background: linear-gradient(-45deg, #f0f0f0, #e0e0e0, #f0f0f0, #e0e0e0);
    background-size: 400% 400%;
    animation: loading-animation 1.5s ease-in-out infinite;
}

@keyframes loading-animation {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

@media only screen and (max-width: 700px) {
    .avatar-options {
        flex-direction: column;
        width: 100%;
    }

    .avatar-option-btn {
        width: 100%;
        margin-bottom: 10px;
    }

    .avatar-controls {
        flex-direction: column;
        width: 100%;
    }

    .avatar-controls button {
        width: 100%;
        margin-bottom: 10px;
    }

    .pmpro_form_field {
        width: 100% !important;
    }

}

@media only screen and (max-width: 470px) {
    #camera-video {
        width: 200px;
        height: 200px;
    }
    #camera-canvas{
        width: 200px;
        height: 200px;
    }
}