/* User Profile Styles */

/* Profile Modal */
#profileModal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5000;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

#profileModal.hidden {
    display: none;
}

.profile-modal-content {
    background: var(--secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.4s ease-out;
}

.profile-header {
    background: linear-gradient(135deg, var(--highlight), var(--violet));
    padding: 2rem;
    text-align: center;
    color: var(--primary);
    position: relative;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin: 0 auto 1rem;
    border: 3px solid rgba(255, 255, 255, 0.3);
}

.profile-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.profile-email {
    font-size: 0.95rem;
    opacity: 0.9;
}

.profile-stats {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--highlight);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.3rem;
}

.profile-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    padding: 0 1.5rem;
}

.profile-tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 1rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.profile-tab-btn.active {
    color: var(--highlight);
    border-bottom-color: var(--highlight);
}

.profile-tab-btn:hover {
    color: var(--text-primary);
}

.profile-content {
    padding: 1.5rem;
}

.profile-tab-pane {
    display: none;
}

.profile-tab-pane.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* Account Settings Tab */
.setting-group {
    margin-bottom: 2rem;
}

.setting-label {
    font-weight: 600;
    color: var(--text-primary);
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.setting-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--primary);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.setting-input:focus {
    outline: none;
    border-color: var(--highlight);
    box-shadow: 0 0 0 3px rgba(79, 209, 197, 0.1);
}

.setting-description {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.3rem;
}

/* Favorites Tab */
.favorites-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.favorite-item {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--primary);
    transition: all 0.3s ease;
}

.favorite-item:hover {
    border-color: var(--highlight);
    box-shadow: 0 4px 12px rgba(79, 209, 197, 0.1);
}

.favorite-reference {
    font-weight: 600;
    color: var(--highlight);
    margin-bottom: 0.5rem;
}

.favorite-text {
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.5;
    margin-bottom: 0.8rem;
}

.favorite-actions {
    display: flex;
    gap: 0.5rem;
}

.favorite-btn {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.favorite-btn:hover {
    border-color: var(--highlight);
    color: var(--highlight);
}

.favorites-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-secondary);
}

.favorites-empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* History Tab */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.history-item {
    padding: 0.8rem;
    border-left: 3px solid var(--highlight);
    background: var(--primary);
    border-radius: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-text {
    flex: 1;
}

.history-search {
    font-weight: 500;
    color: var(--text-primary);
}

.history-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

.history-delete {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.history-delete:hover {
    color: var(--error);
}

.history-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-secondary);
}

/* Preferences Tab */
.preference-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.preference-item:last-child {
    border-bottom: none;
}

.preference-label {
    font-weight: 500;
    color: var(--text-primary);
}

.preference-toggle {
    position: relative;
    width: 48px;
    height: 28px;
}

.toggle-checkbox {
    display: none;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border);
    border-radius: 14px;
    cursor: pointer;
    transition: 0.4s;
}

.toggle-slider:before {
    content: "";
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: 0.4s;
}

.toggle-checkbox:checked + .toggle-slider {
    background-color: var(--highlight);
}

.toggle-checkbox:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* Action Buttons */
.profile-actions {
    display: flex;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border);
}

.profile-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-primary);
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.profile-btn:hover {
    border-color: var(--highlight);
    color: var(--highlight);
}

.profile-btn.danger {
    border-color: var(--error);
    color: var(--error);
}

.profile-btn.danger:hover {
    background: rgba(255, 71, 87, 0.1);
}

.profile-btn.primary {
    background: linear-gradient(135deg, var(--highlight), var(--violet));
    border: none;
    color: var(--primary);
}

.profile-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 209, 197, 0.3);
}

/* Close Button */
.profile-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.3s ease;
}

.profile-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
    .profile-modal-content {
        max-width: 100%;
        width: 95%;
        max-height: 95vh;
    }
    
    .profile-stats {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .profile-modal-content {
        width: 100%;
        max-height: 100vh;
        border-radius: 12px 12px 0 0;
    }
    
    .profile-header {
        padding: 1.5rem;
    }
    
    .profile-avatar {
        width: 70px;
        height: 70px;
        font-size: 2rem;
    }
    
    .profile-name {
        font-size: 1.3rem;
    }
    
    .profile-actions {
        flex-direction: column;
    }
    
    .profile-btn {
        width: 100%;
    }
}
