/**
 * TexMeta - Facebook-Style Photo Upload Styles
 */

/* Modal Overlay */
.photo-upload-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.photo-upload-modal.active {
    display: flex;
}

.photo-upload-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
}

/* Modal Container */
.photo-upload-container {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Modal Header */
.photo-upload-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border, #e5e7eb);
}

.photo-upload-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary, #1f2937);
}

.photo-upload-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--gray-100, #f3f4f6);
    color: var(--text-secondary, #6b7280);
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.photo-upload-close:hover {
    background: var(--gray-200, #e5e7eb);
}

/* Modal Body */
.photo-upload-body {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
}

/* Upload Dropzone */
.upload-dropzone {
    border: 2px dashed var(--border, #e5e7eb);
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--gray-50, #f9fafb);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.upload-dropzone:hover {
    border-color: var(--primary, #7c3aed);
    background: var(--gray-100, #f3f4f6);
}

.upload-dropzone.dragover {
    border-color: var(--primary, #7c3aed);
    background: #f3f0ff;
}

.dropzone-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.dropzone-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary, #1f2937);
    margin: 0 0 8px;
}

.dropzone-hint {
    font-size: 14px;
    color: var(--text-muted, #9ca3af);
    margin: 0;
}

/* Upload Preview */
.upload-preview {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
}

.upload-preview img {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: contain;
    background: #000;
    border-radius: 12px;
}

.preview-change-btn {
    position: absolute;
    bottom: 16px;
    right: 16px;
    padding: 10px 20px;
    background: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.2s;
}

.preview-change-btn svg {
    width: 18px;
    height: 18px;
}

.preview-change-btn:hover {
    background: var(--gray-100, #f3f4f6);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Upload Progress */
.upload-progress {
    text-align: center;
    padding: 40px 20px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--gray-200, #e5e7eb);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 16px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary, #7c3aed), #a78bfa);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary, #6b7280);
    margin: 0;
}

/* Modal Footer */
.photo-upload-footer {
    display: flex;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border, #e5e7eb);
    justify-content: flex-end;
}

.photo-upload-footer .btn {
    padding: 10px 24px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.photo-upload-footer .btn-secondary {
    background: var(--gray-100, #f3f4f6);
    color: var(--text-primary, #1f2937);
}

.photo-upload-footer .btn-secondary:hover {
    background: var(--gray-200, #e5e7eb);
}

.photo-upload-footer .btn-primary {
    background: var(--primary, #7c3aed);
    color: white;
}

.photo-upload-footer .btn-primary:hover:not(:disabled) {
    background: #6d28d9;
}

.photo-upload-footer .btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Upload Buttons on Profile */
.upload-photo-btn {
    position: absolute;
    padding: 8px 16px;
    background: white;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
}

.upload-photo-btn svg {
    width: 16px;
    height: 16px;
}

.upload-photo-btn:hover {
    background: var(--gray-50, #f9fafb);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Profile Picture Upload Button */
.profile-picture-container {
    position: relative;
    display: inline-block;
}

.upload-profile-btn {
    bottom: 8px;
    right: 8px;
}

/* Cover Photo Upload Button */
.cover-photo-container {
    position: relative;
}

.upload-cover-btn {
    bottom: 16px;
    right: 16px;
}

/* Toast Notifications */
.upload-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    z-index: 10001;
    opacity: 0;
    transition: all 0.3s ease;
}

.upload-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.upload-toast svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.upload-toast-success {
    color: #166534;
    background: #dcfce7;
}

.upload-toast-error {
    color: #991b1b;
    background: #fee2e2;
}

/* Mobile Responsive */
@media (max-width: 640px) {
    .photo-upload-container {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .photo-upload-header {
        padding: 16px 20px;
    }
    
    .photo-upload-body {
        padding: 20px;
    }
    
    .upload-dropzone {
        padding: 40px 16px;
    }
    
    .upload-preview img {
        max-height: 300px;
    }
    
    .preview-change-btn {
        bottom: 12px;
        right: 12px;
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .photo-upload-footer {
        padding: 12px 16px;
    }
    
    .upload-photo-btn {
        padding: 6px 12px;
        font-size: 13px;
    }
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    .photo-upload-container {
        background: #1f2937;
    }
    
    .photo-upload-header {
        border-color: #374151;
    }
    
    .photo-upload-header h3 {
        color: white;
    }
    
    .upload-dropzone {
        background: #111827;
        border-color: #374151;
    }
    
    .upload-dropzone:hover,
    .upload-dropzone.dragover {
        background: #1f2937;
    }
    
    .dropzone-text {
        color: white;
    }
    
    .photo-upload-footer {
        border-color: #374151;
    }
    
    .upload-photo-btn {
        background: #1f2937;
        border-color: #374151;
        color: white;
    }
}
