/* User Profile Avatars - Frontend Styles */

/* WooCommerce Edit Account Form */
.upa-profile-avatar-selector {
    margin: 15px 0;
}

.upa-current-avatar-preview {
    margin-bottom: 20px;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.upa-current-avatar-preview label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
}

.upa-preview-image {
    text-align: center;
}

.upa-preview-image img {
    border-radius: 50%;
    border: 3px solid #2271b1;
    max-width: 120px;
    height: auto;
}

.upa-preview-image .no-avatar {
    color: #999;
    font-style: italic;
}

.upa-avatars-grid label {
    display: block;
    font-weight: 600;
    margin-bottom: 15px;
}

.upa-grid-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
}

.upa-avatar-option {
    position: relative;
    cursor: pointer;
}

.upa-avatar-option input[type="radio"] {
    display: none;
}

.upa-avatar-option label {
    display: block;
    margin: 0;
    cursor: pointer;
    position: relative;
}

.upa-avatar-option .upa-option-thumb {
    width: 100%;
    height: auto;
    border: 3px solid #ddd;
    border-radius: 50%;
    transition: all 0.3s;
    display: block;
}

.upa-avatar-option:hover .upa-option-thumb,
.upa-avatar-option.selected .upa-option-thumb {
    border-color: #2271b1;
    transform: scale(1.05);
}

.upa-avatar-option.selected .upa-selected-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: #2271b1;
    color: #fff;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: bold;
}

/* Shortcode Styles - Dark Mode Optimized & Modern */
.upa-greeting {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px;
    position: relative;
    cursor: pointer;
    border-radius: 50px;
    transition: all 0.3s ease;
    background: transparent;
}

.upa-greeting:hover {
    background: rgba(255, 255, 255, 0.05);
}

.upa-greeting-avatar-wrapper {
    flex-shrink: 0;
    position: relative;
    display: flex;
    align-items: center;
}

.upa-greeting-avatar-wrapper img {
    border-radius: 50%;
    width: 40px !important;
    height: 40px !important;
    max-width: 40px !important;
    max-height: 40px !important;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.25);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: block;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

/* Dropdown Arrow */
.upa-dropdown-arrow {
    margin-left: 6px;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.65);
    transition: all 0.3s ease;
    transform: rotate(0deg);
    display: inline-block;
}

.upa-greeting.dropdown-open .upa-dropdown-arrow {
    color: #ffffff;
    transform: rotate(180deg);
}

/* Hover Effects - Avatar için (dropdown açıkken de çalışsın) */
.upa-greeting:hover .upa-greeting-avatar-wrapper img {
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.08);
    box-shadow: 0 4px 20px rgba(255, 255, 255, 0.25);
}

.upa-greeting.dropdown-open .upa-greeting-avatar-wrapper img {
    border-color: rgba(255, 255, 255, 0.7);
    transform: scale(1.1);
    box-shadow: 0 4px 20px rgba(255, 255, 255, 0.3);
}

.upa-greeting-text {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.upa-greeting-label {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 500;
    transition: color 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upa-greeting:hover .upa-greeting-label {
    color: rgba(255, 255, 255, 0.9);
}

.upa-greeting-name {
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    transition: all 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.upa-greeting:hover .upa-greeting-name {
    color: #ffffff;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}

/* Dropdown Menu - Modern Design */
.upa-greeting-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: rgba(15, 15, 15, 0.98);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    min-width: 220px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.95);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
    padding: 0;
    margin: 0;
    overflow: hidden;
    pointer-events: none;
    max-height: 0;
}

.upa-greeting.dropdown-open .upa-greeting-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
    max-height: 500px;
    margin-top: 5px;
    padding: 6px;
}

.upa-greeting-dropdown::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
}

.upa-dropdown-item {
    display: block;
    padding: 10px 14px;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    pointer-events: auto;
}

.upa-dropdown-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%) scaleY(0);
    width: 3px;
    height: 0;
    background: linear-gradient(180deg, #ffffff, rgba(255, 255, 255, 0.5));
    border-radius: 0 3px 3px 0;
    transition: all 0.2s ease;
}

.upa-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    transform: translateX(2px);
    padding-left: 16px;
}

.upa-dropdown-item:hover::before {
    transform: translateY(-50%) scaleY(1);
    height: 60%;
}

.upa-dropdown-icon {
    display: none !important;
}

.upa-dropdown-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    margin: 4px 8px;
}

.upa-dropdown-item.upa-logout {
    color: rgba(255, 107, 107, 0.9);
}

.upa-dropdown-item.upa-logout:hover {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
}

.upa-dropdown-item.upa-logout::before {
    background: linear-gradient(180deg, #ff6b6b, rgba(255, 107, 107, 0.5));
}

/* Tooltip - Gizlendi */
.upa-greeting-tooltip {
    display: none !important;
}

/* No Avatar Placeholder */
.upa-no-avatar {
    display: inline-block;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.25);
    position: relative;
}

.upa-no-avatar::before {
    content: '👤';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    opacity: 0.6;
}

/* Notification Badge */
.upa-notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #ff4757;
    color: #ffffff;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    border: 2px solid rgba(30, 30, 30, 0.95);
    animation: upa-pulse 2s infinite;
}

@keyframes upa-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 4px rgba(255, 71, 87, 0);
    }
}

.upa-profile-photo img {
    border-radius: 50%;
    display: block;
    width: 40px;
    height: 40px;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.upa-profile-photo:hover img {
    border-color: rgba(255, 255, 255, 0.8);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
    .upa-greeting {
        flex-direction: row;
        gap: 10px;
    }
    
    .upa-greeting-avatar-wrapper img {
        width: 35px !important;
        height: 35px !important;
        max-width: 35px !important;
        max-height: 35px !important;
    }
    
    .upa-greeting-name {
        font-size: 14px;
    }
    
    .upa-greeting-label {
        font-size: 10px;
    }
    
    .upa-greeting-dropdown {
        right: auto;
        left: 0;
    }
    
    .upa-grid-wrapper {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 10px;
    }
}

/* ============================================
   MOBİL PROFİL SHORTCODE STYLES
   ============================================ */

.upa-mobile-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    text-decoration: none;
    border-radius: 50px;
    transition: all 0.3s ease;
    background: transparent;
}

.upa-mobile-profile:hover {
    background: rgba(255, 255, 255, 0.05);
    text-decoration: none;
}

.upa-mobile-avatar-wrapper {
    flex-shrink: 0;
    position: relative;
}

.upa-mobile-avatar-wrapper img,
.upa-mobile-avatar-wrapper .upa-no-avatar {
    border-radius: 50%;
    width: 45px;
    height: 45px;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    display: block;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.upa-mobile-profile:hover .upa-mobile-avatar-wrapper img,
.upa-mobile-profile:hover .upa-mobile-avatar-wrapper .upa-no-avatar {
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
}

.upa-mobile-text {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.upa-mobile-label {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 2px;
    font-weight: 500;
    transition: color 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upa-mobile-profile:hover .upa-mobile-label {
    color: rgba(255, 255, 255, 0.9);
}

.upa-mobile-name {
    font-size: 15px;
    font-weight: 600;
    color: #ffffff;
    transition: all 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.upa-mobile-profile:hover .upa-mobile-name {
    color: #ffffff;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
}

/* Mobil için responsive */
@media (max-width: 768px) {
    .upa-mobile-profile {
        gap: 10px;
        padding: 6px 10px;
    }
    
    .upa-mobile-avatar-wrapper img,
    .upa-mobile-avatar-wrapper .upa-no-avatar {
        width: 40px;
        height: 40px;
    }
    
    .upa-mobile-name {
        font-size: 14px;
    }
    
    .upa-mobile-label {
        font-size: 9px;
    }
}

/* ============================================
   ONBOARDING MODAL
   ============================================ */
.upa-onboarding-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    min-height: 100vh;
    min-height: -webkit-fill-available; /* iOS Safari için */
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* iOS smooth scroll */
}

.upa-onboarding-modal.is-open {
    display: flex;
}

.upa-onboarding-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    min-height: 100vh;
    min-height: -webkit-fill-available; /* iOS Safari için */
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px); /* Safari için */
    z-index: 1;
}

.upa-onboarding-dialog {
    position: relative;
    background: #ffffff;
    color: #1f2933;
    border-radius: 12px;
    padding: 24px;
    max-width: 720px;
    width: 92%;
    max-height: 90vh;
    max-height: calc(100vh - 40px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    z-index: 2;
    margin: 20px auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* iOS smooth scroll */
}

.upa-onboarding-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #000000;
    border: none;
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    color: #ffffff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.upa-onboarding-close:hover {
    background: #333333;
    transform: scale(1.1);
}

.upa-onboarding-title {
    margin-top: 0;
    margin-bottom: 6px;
    font-size: 22px;
    font-weight: 700;
}

.upa-onboarding-desc {
    margin-top: 0;
    margin-bottom: 18px;
    color: #6b7280;
    font-size: 15px;
}

.upa-onboarding-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.upa-onboarding-grid .upa-avatar-option {
    border: 1px solid #e5e7eb;
    padding: 10px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    background: #f9fafb;
}

.upa-onboarding-grid .upa-avatar-option:hover,
.upa-onboarding-grid .upa-avatar-option.selected {
    border-color: #2563eb;
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.15);
    background: #eef2ff;
}

.upa-onboarding-grid .upa-option-thumb {
    border-radius: 50%;
    width: 100%;
    height: auto;
    border: 3px solid transparent;
}

.upa-onboarding-grid .upa-avatar-option.selected .upa-option-thumb {
    border-color: #2563eb;
}

.upa-onboarding-grid .upa-selected-badge {
    display: none;
    font-size: 12px;
    background: #2563eb;
    color: #fff;
    padding: 3px 8px;
    border-radius: 999px;
}

.upa-onboarding-grid .upa-avatar-option.selected .upa-selected-badge {
    display: inline-block;
}

.upa-onboarding-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.upa-onboarding-actions .button-secondary {
    background: #e5e7eb;
    color: #1f2933;
    border-color: #d1d5db;
}

body.upa-modal-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100%;
    /* iOS Safari için scroll pozisyonunu koru */
    -webkit-overflow-scrolling: touch;
}

/* Footer ve diğer yüksek z-index'li elementlerin modal'ın altında kalmasını engelle */
.upa-onboarding-modal {
    z-index: 999999 !important;
    position: fixed !important;
}

.upa-onboarding-backdrop {
    z-index: 999998 !important;
    position: fixed !important;
}

.upa-onboarding-dialog {
    z-index: 999999 !important;
    position: relative !important;
}

/* iOS Safari için özel düzenlemeler */
@supports (-webkit-touch-callout: none) {
    body.upa-modal-open {
        position: fixed;
        width: 100%;
        height: 100%;
        overflow: hidden;
    }
    
    .upa-onboarding-modal {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        min-height: -webkit-fill-available;
    }
}

@media (max-width: 640px) {
    .upa-onboarding-modal {
        padding: 10px;
        align-items: flex-start;
        padding-top: 20px;
    }
    
    .upa-onboarding-dialog {
        padding: 18px;
        width: calc(100% - 20px);
        max-width: calc(100% - 20px);
        margin: 0 auto;
        max-height: calc(100vh - 40px);
        max-height: calc(100dvh - 40px); /* Dynamic viewport height */
    }
    
    .upa-onboarding-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 12px;
    }
    
    .upa-onboarding-title {
        font-size: 20px;
    }
    
    .upa-onboarding-desc {
        font-size: 14px;
    }
    
    .upa-onboarding-actions {
        flex-direction: column-reverse;
        width: 100%;
    }
    
    .upa-onboarding-actions button {
        width: 100%;
    }
}

/* Chrome, Safari, Firefox için viewport düzenlemeleri */
@media (max-width: 768px) {
    .upa-onboarding-modal {
        /* Mobilde tam ekran modal */
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height - modern tarayıcılar */
    }
    
    .upa-onboarding-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
    }
}
