/* Custom Avatar Upload Frontend Styles */

.cau-upload-container {
    max-width: 600px;
    margin: 20px 0;
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.cau-avatar-display {
    margin-bottom: 20px;
    text-align: center;
}

.cau-avatar-display h4 {
    margin-bottom: 10px;
    color: #333;
}

.cau-avatar-display .avatar {
    border-radius: 50%;
    border: 3px solid #ddd;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#cau-avatar-image {
    margin-bottom: 10px;
}

.cau-delete-btn {
    background: #dc3232;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.cau-delete-btn:hover {
    background: #a02020;
}

.cau-delete-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.cau-upload-field {
    margin-bottom: 20px;
}

.cau-upload-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #333;
}

.cau-upload-field input[type="file"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 3px;
    background: #fff;
}

.cau-upload-field .description {
    margin-top: 5px;
    margin-bottom: 0;
    font-style: italic;
    color: #666;
    font-size: 0.9em;
}

/* Crop Interface Styles - Floating Modal */
#cau-crop-interface {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    overflow: auto;
}

.cau-crop-modal {
    position: relative;
    background: #fff;
    margin: 20px auto;
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    animation: cropModalFadeIn 0.3s ease-out;
}

@keyframes cropModalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.cau-crop-modal-header {
    padding: 20px 20px 10px 20px;
    border-bottom: 1px solid #eee;
    text-align: center;
}

.cau-crop-modal-body {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.cau-crop-modal-header h4 {
    margin: 0;
    color: #333;
    font-size: 18px;
}

.cau-crop-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.cau-crop-close:hover {
    background: #f0f0f0;
    color: #333;
}

#cau-crop-container {
    margin-bottom: 20px;
    text-align: center;
}

#cau-crop-wrapper {
    position: relative;
    display: inline-block;
    max-width: 100%;
    max-height: 60vh;
    overflow: hidden;
    border: 1px solid #ddd;
    background: #f0f0f0;
    margin: 0 auto;
}

#cau-crop-image {
    display: block;
    max-width: 100%;
    max-height: 60vh;
    height: auto;
}

#cau-crop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

#cau-crop-selection {
    position: absolute;
    border: 2px solid #007cba;
    background: transparent;
    cursor: move;
    min-width: 50px;
    min-height: 50px;
}

#cau-crop-selection::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: rgba(0, 124, 186, 0.1);
}

.crop-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #007cba;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.crop-handle-nw {
    top: -6px;
    left: -6px;
    cursor: nw-resize;
}

.crop-handle-ne {
    top: -6px;
    right: -6px;
    cursor: ne-resize;
}

.crop-handle-sw {
    bottom: -6px;
    left: -6px;
    cursor: sw-resize;
}

.crop-handle-se {
    bottom: -6px;
    right: -6px;
    cursor: se-resize;
}

.cau-crop-preview {
    text-align: center;
    margin-bottom: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 5px;
}

.cau-crop-preview h5 {
    margin-bottom: 10px;
    color: #333;
}

#cau-preview-canvas {
    border: 2px solid #ddd;
    border-radius: 50%;
    background: #fff;
}

.cau-crop-buttons {
    text-align: center;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid #eee;
    background: #f9f9f9;
    flex-shrink: 0;
}

.cau-btn-primary,
.cau-btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 16px;
    margin: 0 5px;
    transition: background-color 0.3s;
}

.cau-btn-primary {
    background: #007cba;
    color: white;
}

.cau-btn-primary:hover {
    background: #005a87;
}

.cau-btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.cau-btn-secondary {
    background: #666;
    color: white;
}

.cau-btn-secondary:hover {
    background: #444;
}

.cau-upload-button {
    text-align: center;
    margin-bottom: 20px;
}

.cau-upload-button button {
    background: #007cba;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

.cau-upload-button button:hover {
    background: #005a87;
}

.cau-upload-button button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

#cau-message {
    text-align: center;
}

#cau-message p {
    padding: 10px;
    border-radius: 3px;
    margin: 0;
}

#cau-message .success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

#cau-message .error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

#cau-message .loading {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

#cau-preview {
    margin-top: 15px;
    text-align: center;
}

#cau-preview h4 {
    margin-bottom: 10px;
    color: #333;
}

#cau-preview-img {
    border: 3px solid #ddd;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* User Profile Styles */
.cau-profile-avatar {
    margin-bottom: 15px;
}

.cau-profile-avatar .avatar {
    border-radius: 50%;
    border: 3px solid #ddd;
}

.cau-profile-upload input[type="file"] {
    margin-bottom: 5px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .cau-upload-container {
        margin: 10px 0;
        padding: 15px;
    }
    
    .cau-crop-modal {
        margin: 10px;
        max-width: calc(100% - 20px);
        max-height: calc(100% - 20px);
    }
    
    .cau-crop-modal-body {
        padding: 15px;
        max-height: calc(90vh - 120px);
    }
    
    #cau-crop-wrapper {
        max-height: 50vh;
    }
    
    #cau-crop-image {
        max-height: 50vh;
    }
    
    .cau-crop-buttons {
        padding: 15px;
    }
    
    .cau-btn-primary,
    .cau-btn-secondary {
        width: calc(50% - 10px);
        margin: 5px;
        padding: 15px 12px;
    }
    
    .cau-upload-button button {
        width: 100%;
        padding: 15px;
    }
}

/* Loading states */
.cau-loading {
    opacity: 0.6;
    pointer-events: none;
}

.cau-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #007cba;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

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