/**
 * استایل‌های فرانت‌اند - پلاگین تصویر پروفایل پیشرفته
 * طراحی مدرن و کاربرپسند
 */

/* کانتینر اصلی */
.app-upload-container {
    max-width: 800px;
    margin: 30px auto;
    padding: 30px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* تصویر فعلی */
.app-current-picture {
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: #fff;
}

.app-current-picture h3 {
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 600;
}

.app-current-image-wrapper {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.app-current-image {
    width: 150px;
    height: 150px;
    object-fit: cover;
    border-radius: 12px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.app-image-info {
    flex: 1;
    min-width: 250px;
}

.app-image-info p {
    margin: 8px 0;
    font-size: 14px;
    opacity: 0.95;
}

.app-image-info strong {
    margin-left: 8px;
    opacity: 1;
}

/* بخش آپلود */
.app-upload-section {
    text-align: center;
    margin: 30px 0;
}

.app-upload-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px 40px;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.app-upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.5);
}

.app-upload-btn:active {
    transform: translateY(0);
}

.app-btn-icon {
    font-size: 24px;
}

.app-file-info {
    margin-top: 15px;
    padding: 12px 20px;
    background: #f0f9ff;
    border: 2px solid #bfdbfe;
    border-radius: 8px;
    color: #1e40af;
    font-size: 14px;
}

/* بخش پیش‌نمایش و برش */
.app-preview-section {
    margin-top: 30px;
    padding: 30px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 16px;
    border: 3px solid #cbd5e1;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.app-preview-section h3 {
    margin: 0 0 10px 0;
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    text-align: center;
}

.app-instruction {
    text-align: center;
    color: #64748b;
    font-size: 14px;
    margin: 0 0 25px 0;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    border: 1px solid #cbd5e1;
}

.app-crop-container {
    max-width: 500px;
    max-height: 500px;
    margin: 0 auto 30px;
    background: #1e293b;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    position: relative;
}

.app-crop-container img {
    max-width: 100%;
    display: block;
}

/* استایل دایره‌ای برای Cropper */
.app-circular-crop {
    border-radius: 50% !important;
    border: 3px solid #fff !important;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5) !important;
}

/* استایل گوشه‌گرد برای Cropper */
.app-rounded-crop {
    border: 3px solid #fff !important;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5) !important;
}

.cropper-view-box {
    border-radius: 50%;
    outline: 0;
    box-shadow: 0 0 0 1px #39f, 0 0 0 3px rgba(255, 255, 255, 0.5);
}

.cropper-face {
    background-color: transparent !important;
}

.cropper-point {
    background-color: #667eea !important;
    width: 12px !important;
    height: 12px !important;
    opacity: 1 !important;
    border-radius: 50% !important;
    border: 2px solid #fff !important;
}

.cropper-point.point-se {
    width: 14px !important;
    height: 14px !important;
    background-color: #10b981 !important;
}

.cropper-line {
    background-color: #667eea !important;
    opacity: 0.5 !important;
}

.cropper-dashed {
    opacity: 0 !important;
}

.app-btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* دکمه‌های عملیات */
.app-upload-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.app-btn-primary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #fff;
    font-size: 16px;
    padding: 14px 30px;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.app-btn-primary:hover {
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
    transform: translateY(-1px);
}

.app-btn-secondary {
    background: #ef4444;
    color: #fff;
    font-size: 16px;
    padding: 14px 30px;
}

.app-btn-secondary:hover {
    background: #dc2626;
}

.app-spinner {
    display: inline-block;
    animation: spin 1s linear infinite;
}

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

/* جعبه پیام */
.app-message-box {
    margin-top: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    text-align: center;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.app-message-box.success {
    background: #d1fae5;
    color: #065f46;
    border: 2px solid #10b981;
}

.app-message-box.error {
    background: #fee2e2;
    color: #991b1b;
    border: 2px solid #ef4444;
}

.app-message-box.info {
    background: #dbeafe;
    color: #1e40af;
    border: 2px solid #3b82f6;
}

/* راهنمای crop */
.app-crop-hint {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    z-index: 1000;
    pointer-events: none;
    animation: fadeInUp 0.5s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* اطلاعات آپلود */
.app-upload-info {
    margin-top: 20px;
    padding: 20px;
    background: #f1f5f9;
    border-radius: 8px;
    text-align: center;
}

.app-info-item {
    margin: 8px 0;
    font-size: 14px;
    color: #475569;
}

.app-info-item strong {
    color: #1e293b;
    margin-left: 5px;
}

/* نمایش تصویر پروفایل */
.app-profile-picture {
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #e2e8f0;
}

.app-size-small {
    width: 50px;
    height: 50px;
}

.app-size-medium {
    width: 100px;
    height: 100px;
}

.app-size-large {
    width: 150px;
    height: 150px;
}

/* پیام خطا */
.app-message.app-error {
    padding: 15px 20px;
    background: #fee2e2;
    border: 2px solid #ef4444;
    border-radius: 8px;
    color: #991b1b;
    text-align: center;
    font-weight: 500;
}

/* ریسپانسیو */
@media (max-width: 768px) {
    .app-upload-container {
        padding: 20px;
        margin: 20px 10px;
    }

    .app-current-image-wrapper {
        flex-direction: column;
        align-items: center;
    }

    .app-crop-controls,
    .app-upload-actions {
        flex-direction: column;
    }

    .app-btn {
        width: 100%;
    }
}

/* انیمیشن‌های اضافی */
.fade-in {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-up {
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* دکمه‌های عملیات تصویر */
.app-picture-actions {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.app-btn-danger {
    background: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%);
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(255, 65, 108, 0.3);
}

.app-btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 65, 108, 0.4);
}

.app-btn-danger:active {
    transform: translateY(0);
}

.app-btn-danger:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.app-picture-actions .description {
    margin: 10px 0 0 0;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.8);
}

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

/* ========================================
   استایل شورت‌کد پاپ‌آپ [profile_picture_popup]
   ======================================== */

/* کانتینر اصلی */
.app-popup-container {
    display: inline-block;
    position: relative;
}

/* نمایش تصویر (وقتی تصویر داره) */
.app-popup-picture-display {
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    position: relative;
}

.app-popup-picture-display.app-popup-clickable {
    cursor: pointer;
}

.app-popup-picture-display.app-popup-clickable:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.app-popup-picture-display.app-popup-clickable::after {
    content: '✏️';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 40px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.app-popup-picture-display.app-popup-clickable:hover::after {
    opacity: 0.9;
}

.app-popup-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* دکمه آپلود (وقتی تصویر نداره) */
.app-popup-upload-trigger {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    overflow: hidden;
    position: relative;
}

.app-popup-upload-trigger::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.app-popup-upload-trigger:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.app-popup-upload-trigger:hover::before {
    opacity: 1;
}

.app-popup-icon {
    font-size: 40px;
    margin-bottom: 10px;
    animation: pulse 2s ease-in-out infinite;
}

.app-popup-text {
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    padding: 0 15px;
    line-height: 1.4;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Modal/Popup */
.app-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.app-modal-content {
    position: relative;
    background: #fff;
    border-radius: 20px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
    z-index: 1;
}

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

.app-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #333;
    z-index: 2;
}

.app-modal-close:hover {
    background: rgba(255, 65, 108, 0.2);
    color: #ff416c;
    transform: rotate(90deg);
}

.app-modal-content h2 {
    margin: 0;
    padding: 30px 30px 20px;
    font-size: 24px;
    font-weight: 700;
    color: #333;
    border-bottom: 2px solid #f0f0f0;
}

.app-modal-body {
    padding: 30px;
}

.app-modal-upload-section {
    text-align: center;
    margin-bottom: 20px;
}

.app-modal-select-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    padding: 15px 40px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.app-modal-select-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.app-modal-file-info {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 14px;
    color: #333;
}

.app-modal-preview-section {
    margin-top: 20px;
}

.app-modal-instruction {
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    padding: 15px;
    border-radius: 10px;
    font-size: 14px;
    color: #555;
    margin-bottom: 20px;
    border-left: 4px solid #667eea;
}

.app-modal-crop-container {
    max-width: 100%;
    height: 400px;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
}

.app-modal-crop-container img {
    max-width: 100%;
    display: block;
}

.app-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.app-modal-message-box {
    margin-top: 15px;
    padding: 15px;
    border-radius: 8px;
    font-size: 14px;
}

.app-modal-info {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 13px;
    color: #666;
}

.app-modal-info p {
    margin: 5px 0;
}

/* استایل Cropper.js در Modal */
.app-modal-crop-container .cropper-view-box,
.app-modal-crop-container .cropper-face {
    border-radius: 50%;
}

/* Responsive */
@media (max-width: 768px) {
    .app-modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .app-modal-content h2 {
        font-size: 20px;
        padding: 20px;
    }

    .app-modal-body {
        padding: 20px;
    }

    .app-modal-crop-container {
        height: 300px;
    }

    .app-popup-text {
        font-size: 12px;
    }

    .app-popup-icon {
        font-size: 30px;
    }
}
