/* Avatar Upload Modal and Cropper Styling */

/* Modal Overlay */
.avatar-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.avatar-modal-overlay.active {
    display: flex;
}

/* Modal Container */
.avatar-modal {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 2rem;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

/* Modal Header */
.avatar-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.avatar-modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #f1f5f9;
    margin: 0;
}

.avatar-modal-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.3s ease;
}

.avatar-modal-close:hover {
    color: #f1f5f9;
}

/* Cropper Container */
.avatar-cropper-container {
    width: 100%;
    max-height: 400px;
    background: #0f172a;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.avatar-cropper-container img {
    max-width: 100%;
    display: block;
}

/* Upload Zone (now a label) */
.avatar-upload-zone {
    display: block;
    /* Important since it's now a label */
    border: 2px dashed rgba(94, 179, 228, 0.3);
    border-radius: 8px;
    padding: 3rem 2rem;
    text-align: center;
    background: rgba(94, 179, 228, 0.05);
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 1.5rem;
}

/* Visually hidden but accessible file input */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.avatar-upload-zone:hover {
    border-color: rgba(94, 179, 228, 0.5);
    background: rgba(94, 179, 228, 0.1);
}

.avatar-upload-zone.drag-over {
    border-color: #5eb3e4;
    background: rgba(94, 179, 228, 0.15);
}

.avatar-upload-icon {
    font-size: 3rem;
    color: #5eb3e4;
    margin-bottom: 1rem;
    pointer-events: none;
    /* Allow clicks to pass through to parent */
}

.avatar-upload-text {
    color: #cbd5e1;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    pointer-events: none;
    /* Allow clicks to pass through to parent */
}

.avatar-upload-hint {
    color: #64748b;
    font-size: 0.875rem;
    pointer-events: none;
    /* Allow clicks to pass through to parent */
}

/* Modal Actions */
.avatar-modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

.avatar-modal-actions .btn {
    min-width: 100px;
}

/* Remove Avatar Button */
.remove-avatar-btn {
    margin-top: 0;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 0.5rem 1.5rem;
    border-radius: 6px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
    text-align: center;
    width: auto;
}

.remove-avatar-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
}

.remove-avatar-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Avatar Container Enhancement */
.avatar-container {
    position: relative;
    display: inline-block;
}

.avatar-upload-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: pointer;
}

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

.avatar-upload-overlay-icon {
    color: white;
    font-size: 2rem;
}

/* Loading State */
.avatar-loading {
    position: relative;
}

.avatar-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Responsive */
@media (max-width: 640px) {
    .avatar-modal {
        padding: 1.5rem;
        width: 95%;
    }

    .avatar-cropper-container {
        max-height: 300px;
    }

    .avatar-modal-actions {
        flex-direction: column;
    }

    .avatar-modal-actions .btn {
        width: 100%;
    }
}